ruby on rails - Rspec, expect scope to change by -


i have written following test in rspec:

expect {          ...         }.to change( user.where(:profile.exists => true), :count ).by(1) 

but scope executed once , it's same array same size. how make rspec execute scope before , after running code in expect?

the ops solution, posted answer

this may or may not work else similar problem. no corpus included in original question, , not independently verified.

expect {   # test goes here }.to change{ user.where(:profile.exists => true).count }.by(1) 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -