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
Post a Comment