Sha256: f8b86f6737cec3acd0430b45e85c987993b01f82fb5e6ba697329e4e3b652ba0

Contents?: true

Size: 777 Bytes

Versions: 6

Compression:

Stored size: 777 Bytes

Contents

require 'spec_helper'

describe "Equality" do
  context "Case equality" do
    before do
      @klass = Class.new do
        include MarkMapper::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

6 entries across 6 versions & 1 rubygems

Version Path
mark_mapper-0.0.6 spec/unit/equality_spec.rb
mark_mapper-0.0.5 spec/unit/equality_spec.rb
mark_mapper-0.0.4 spec/unit/equality_spec.rb
mark_mapper-0.0.3 spec/unit/equality_spec.rb
mark_mapper-0.0.2 spec/unit/equality_spec.rb
mark_mapper-0.0.1 spec/unit/equality_spec.rb