Sha256: 2cc6144c14ff0f0773eba515a14bec0965d011a6f961d810fc852723653014fa

Contents?: true

Size: 778 Bytes

Versions: 14

Compression:

Stored size: 778 Bytes

Contents

require 'spec_helper'

describe "Equality" do
  context "Case equality" do
    before do
      @klass = Class.new do
        include MongoMapper::Plugins::Equality
      end
      @subklass = Class.new(@klass)

      @faker = Class.new do
        def initialize(faked)
          @faked = faked
        end

        def is_a?(klass)
          @faked.is_a? klass
        end
      end
    end

    it "should work with regular instance" do
      @klass.should === @klass.new
    end

    it "should work with instances of subclasses" do
      @klass.should === @subklass.new
    end

    it "should work with a faker class" do
      @klass.should === @faker.new(@klass.new)
    end

    it "should not work with other instances" do
      @klass.should_not === 1
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mongo_mapper-0.16.0 spec/unit/equality_spec.rb
mongo_mapper-0.15.6 spec/unit/equality_spec.rb
mongo_mapper-0.15.5 spec/unit/equality_spec.rb
mongo_mapper-0.15.4 spec/unit/equality_spec.rb
mongo_mapper-0.15.3 spec/unit/equality_spec.rb
mongo_mapper-0.15.2 spec/unit/equality_spec.rb
mongo_mapper-0.15.1 spec/unit/equality_spec.rb
mongo_mapper-0.15.0 spec/unit/equality_spec.rb
mongo_mapper-0.14.0 spec/unit/equality_spec.rb
mongo_mapper-0.14.0.rc1 spec/unit/equality_spec.rb
mongo_mapper-0.13.1 spec/unit/equality_spec.rb
mongo_mapper-0.13.0 spec/unit/equality_spec.rb
mongo_mapper-0.13.0.beta2 spec/unit/equality_spec.rb
mongo_mapper-0.13.0.beta1 spec/unit/equality_spec.rb