I upgraded my version of rspec to the most current version and I have tests breaking that have similar syntax
it "should delete a company" do
expect { click_link "Delete Company" }.should change(Company, :count).by(-1)
end
I looked at the documentation and I could not see anything that will do this in the current verion...any ideas on how to achieve this
The error I get is
9) Company Pages Edit page as an admin user should delete a company
Failure/Error: expect { click_link "Delete Company" }.should change(Company, :count).by(-1)
NoMethodError:
undefined method `call' for #<RSpec::Expectations::ExpectationTarget:0x007fccafdfc360>
# ./spec/requests/companies_spec.rb:79:in `block (3 levels) in <top (required)>'
Here's the doc on using expectations
it "should delete a company" do
expect { click_link "Delete Company" }.to change{Company.count}.by(-1)
end
Note the following changes
should
becomes to
(Company, :count)
becomes {Company.count}
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