Just came across an interesting error message from rspec. I had a spec that looked like this:
it "should not mass-assign 'confirmed'" do Blog.new(:confirmed => true).confirmed.should_not be_true end
Obviously it failed, as I hadn’t written the code yet, but there was more in the error message than I expected:
..........F 1) RuntimeError in 'Blog should not mass-assign 'confirmed'' 'should_not be true' not only FAILED, it is a bit confusing. It might be more clearly expressed in the positive? .../spec/models/blog_spec.rb:20: Finished in 0.06192 seconds 11 examples, 1 failure
In fact, rewriting this as should be_false
wouldn’t work, as the expected value is nil. I took the hint though, and rewrote it as should be_nil
.