在rspec的,我有一個規範,看起來是這樣的:RSPEC,乾燥的測試與使用情況100S
require 'spec_helper'
describe IncomingMailsController do
include Devise::TestHelpers
it "should find the correct text in the sample" do
sample_text = '100s of these'
target_text = 'find me'
.... ALL Kinds of stuff to process (30+ lines)
thread.content.should == 'find me'
end
end
是否有使用RSpec的方式,讓我莫名其妙地使用所有邏輯一個塊?然後創建它的「xxxxx」100s做,並通過一個變量作爲示例文本?
感謝
謝謝ctcherry,集合是一個大的文件目錄。所以我不知道這是否會起作用? – AnApprentice 2011-03-20 19:56:34
正在創建一個可能的幫手嗎?我可以製作100個特定於場景的塊,然後在裏面使用助手? – AnApprentice 2011-03-20 19:57:00
不錯的更新。你能舉一個例子嗎? thxs – AnApprentice 2011-03-20 19:58:44