I am trying to figure out another way of writing the should change count test (without lambda). I am using Rails 3. I am also utilizing the shoulda matcher gem
Reason - All test cases are in the format
describe "some stuff" do
it { should ... }
end
But I am not able to follow the same pattern for testing the should change count
Here is what I have
describe "some stuff" do
it "should change count by one" do
lambda { ... }.should change(Model, :count).by(1)
end
end
Is there a way to write it
describe "some stuff" do
it { should change(Model, :count).by(1) }
end
Thanks a lot !!