Class: RSpec::Rails::Matchers::BeANewRecord

Inherits:
Matchers::BuiltIn::BaseMatcher
  • Object
show all
Defined in:
lib/rspec/rails/matchers/be_new_record.rb

Instance Method Summary collapse

Instance Method Details

#failure_message_for_shouldObject



9
10
11
# File 'lib/rspec/rails/matchers/be_new_record.rb', line 9

def failure_message_for_should
  "expected #{actual.inspect} to be a new record, but was persisted"
end

#failure_message_for_should_notObject



13
14
15
# File 'lib/rspec/rails/matchers/be_new_record.rb', line 13

def failure_message_for_should_not
  "expected #{actual.inspect} to be persisted, but was a new record"
end

#matches?(actual) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


5
6
7
# File 'lib/rspec/rails/matchers/be_new_record.rb', line 5

def matches?(actual)
  !actual.persisted?
end