I upgraded rspec version from 2 to 3. This is one of the issues I faced:
Failures:
1) Slide after .destroy(force: false) visible if .with_deleted
Failure/Error: expect{@slide.destroy(force: false)}.to_not change(Slide.with_deleted, :count).by(1)
NotImplementedError:
`expect { }.not_to change { }.by()` is not supported
# ./spec/models/slide_spec.rb:36:in `block (3 levels) in <top (required)>'
and in the rspec's changelog I can read it was never supported (oink ?!@#). At the same time there are still some examples how to use change syntax but without not
keyword.
So the question is how to expect no change ?
.by(n)
. I found this answer and didn't understand why this happen. If anyone else have the same problem: the reason is thatto_not change
means don't change at all, soby
is wrong. Other solution could beto change.by(0)
– Closefisted