Sha256: db410b62d94b83afc2593d90ee09c5e181575f811be36fb65ec6904fe34f2e6b

Contents?: true

Size: 770 Bytes

Versions: 16

Compression:

Stored size: 770 Bytes

Contents

require "spec_helper"

describe "be_a_new matcher" do
  context "new record" do
    let(:record) do
      Class.new do
        def new_record?; true; end
      end.new
    end
    context "right class" do
      it "passes" do
        record.should be_a_new(record.class)
      end
    end
    context "wrong class" do
      it "fails" do
        record.should_not be_a_new(String)
      end
    end
  end

  context "existing record" do
    let(:record) do
      Class.new do
        def new_record?; false; end
      end.new
    end
    context "right class" do
      it "fails" do
        record.should_not be_a_new(record.class)
      end
    end
    context "wrong class" do
      it "fails" do
        record.should_not be_a_new(String)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rspec-rails-2.0.0.beta.19 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.18 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.17 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.16 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.15 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.14.2 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.14.1 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.13 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.12 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.11 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.10 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.9.1 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.8 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.7 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.6 spec/rspec/rails/matchers/be_a_new_spec.rb
rspec-rails-2.0.0.beta.5 spec/rspec/rails/matchers/be_a_new_spec.rb