Sha256: 4f54175935396b1abee89a273d2909a45ae6005f16cc2583578b055b35c44cd8

Contents?: true

Size: 365 Bytes

Versions: 3

Compression:

Stored size: 365 Bytes

Contents

module RSpec::Rails::Matchers
  class BeANewRecord < RSpec::Matchers::BuiltIn::BaseMatcher

    # @api private
    def matches?(actual)
      !actual.persisted?
    end
  end

  # Passes if actual returns `false` for `persisted?`.
  #
  # @example
  #
  #     get :new
  #     assigns(:thing).should be_new_record
  def be_new_record
    BeANewRecord.new
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rspec-rails-2.11.4 lib/rspec/rails/matchers/be_new_record.rb
gem_repackager-0.1.0 support/gems/rspec-rails-2.11.0/lib/rspec/rails/matchers/be_new_record.rb
rspec-rails-2.11.0 lib/rspec/rails/matchers/be_new_record.rb