I migrated from Webrat to Capybara and now i get a lot of errors. For example in webrat i could use that in integration test:
response.should be_success
But Capybara shows that:
Failure/Error: response.should be_success
NoMethodError:
undefined method `success?' for nil:NilClass
Is there any method that provides such function?
UPD: My spec:
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
You're mixing controller and request specs.
In a controller spec you check the response
, in a request spec, you check the page
content, since you have only access to the html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With