Transforms the key to a method and calls it.
# File lib/rspec/rails/mocks.rb, line 40 def [](key) send(key) end
Stubs `persisted?` to return `false` and `id` to return `nil`.
# File lib/rspec/rails/mocks.rb, line 34 def destroy RSpec::Mocks.allow_message(self, :persisted?).and_return(false) RSpec::Mocks.allow_message(self, :id).and_return(nil) end
Returns the opposite of `persisted?`
# File lib/rspec/rails/mocks.rb, line 45 def new_record? !persisted? end