Sha256: 7a67b1bc578a0c9aa74a49f46c8468100504045ac6a153ec66aea584b2ba55de
Contents?: true
Size: 594 Bytes
Versions: 2
Compression:
Stored size: 594 Bytes
Contents
module RSpec::Rails::Matchers class BeANewRecord < RSpec::Matchers::BuiltIn::BaseMatcher # @api private def matches?(actual) !actual.persisted? end def failure_message "expected #{actual.inspect} to be a new record, but was persisted" end def failure_message_when_negated "expected #{actual.inspect} to be persisted, but was a new record" end end # Passes if actual returns `false` for `persisted?`. # # @example # # get :new # expect(assigns(:thing)).to be_new_record def be_new_record BeANewRecord.new end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec-rails-3.0.0.rc1 | lib/rspec/rails/matchers/be_new_record.rb |
rspec-rails-3.0.0.beta2 | lib/rspec/rails/matchers/be_new_record.rb |