我從Webrat遷移到水豚,現在我收到了很多錯誤。例如,在webrat我可以使用,在集成測試:Ruby on Rails 3 + Rspec + Capybara:檢查回覆狀態
response.should be_success
但水豚表明:
Failure/Error: response.should be_success
NoMethodError:
undefined method `success?' for nil:NilClass
有沒有提供這種功能的方法?
UPD:我的規格:
require 'spec_helper'
describe "Admins" do
before(:each) do
@admin = FactoryGirl.create(:admin)
visit '/'
click_link "Login"
fill_in "Email", :with => @admin.email
fill_in "Password", :with => 'qwerty'
click_button "Sign in"
end
describe "Admin panel" do
it "should have correct links" do
click_link "User"
response.should be_success
end
end
end