Rspec has a really cool feature where, if you assert that something
should be_something_else it’ll assume there’s a method called
So for example;
Suppose you had a model called Sushi.
In your spec you could write:
describe Sushi do
it “should be awesome”
This will assume there is a method called awesome? available to @sushi
and will call it and expect it to return true.
ActiveRecord::Base, which all of your models will inherit from has a
method called “new_record?”.
By using “@model.should be_new_record” or “@model.should
be_a_new_record” you’re essentially saying that the new_record? method
should be called and should return true.
If you’re getting a NoMethod error specifically on “be_a_new_record”
then you might want to ensure you have the latest versions of rspec
Hope that helps?