I have written following test in Rspec:
expect {
...
}.to change( User.where(:profile.exists => true), :count ).by(1)
but this scope is executed only once and it’s always the same Array with the same size. How to make rspec execute this scope before and after running the code in expect?
The OPs Solution, Posted As Answer
This may or may not work for anyone else with a similar problem. No corpus was included in the original question, and it was not independently verified.