Closed Austio closed 11 years ago
Thanks @tmock12. I'll wait for clarification from @Austio before accepting.
@danielkehoe and @tmock12 you are correct, this was because i removed the database cleaner and needed to deal with having users in the database already.
Instead of storing the Role count in an instance variable it would be better to use Rspecs expect methods. Something like:
it "wont remove original role from database" do
expect { @user.update_plan(@role2) }.to_not change(Role.count)
end
I agree and if you think this/your rspec addition is valuable enough to add please feel free. If not, no biggie
Updated user_spec to store the number of initial roles in the database before FactoryGirl creates 2 additional ones. Then we check for the number of roles after the @user role is changes for the number we had before plus the number that we have added (@number_of_initial_roles + 2)