Sha256: 2423479780d923dbce22b00a0a620eed732be6393b23fd6612cc9446d2185586

Contents?: true

Size: 401 Bytes

Versions: 23

Compression:

Stored size: 401 Bytes

Contents

require "spec_helper"

describe "be_new_record" do
  include RSpec::Rails::Matchers

  context "un-persisted record" do
    it "passes" do
      record = double('record', :persisted? => false)
      record.should be_new_record
    end
  end

  context "persisted record" do
    it "fails" do
      record = double('record', :persisted? => true)
      record.should_not be_new_record
    end
  end
end

Version data entries

23 entries across 18 versions & 4 rubygems

Version Path
rspec-rails-2.8.1 spec/rspec/rails/matchers/be_new_record_spec.rb
rspec-rails-2.8.0 spec/rspec/rails/matchers/be_new_record_spec.rb
rspec-rails-2.8.0.rc2 spec/rspec/rails/matchers/be_new_record_spec.rb