在Michael Hartl的Rails on Rails教程中,請求示例對響應進行斷言。我安裝了cabybara和牛排寶石來創建驗收測試。安裝水豚後,請求示例配置爲使用水豚。水豚的例子有不同的語法,並且不能識別響應。
如何重置請求示例以RSpec示例運行?Rails by Example教程請求示例和水豚
測試錯誤:
4) Users signup failure should not make a new user
Failure/Error: click_button
wrong number of arguments (0 for 1)
# ./spec/requests/users_spec.rb:13
# ./spec/requests/users_spec.rb:7
請求示例
describe "failure" do
it "should not make a new user" do
lambda do
visit signup_path
fill_in "Name", :with => ""
fill_in "Email", :with => ""
fill_in "Password", :with => ""
fill_in "Confirmation", :with => ""
click_button
response.should render_template('users/new')
end.should_not change(User, :count)
end
end
請給我們一些代碼或錯誤。 – 2011-02-17 20:27:57