Sha256: cbe7076467929a9cda9f4c79c7bc1f83c2972f4a279b7ea6885dcd79a06c47ec

Contents?: true

Size: 1 KB

Versions: 26

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Mongo::Operation::Specifiable do

  let(:spec) do
    {}
  end

  let(:specifiable) do
    Class.new do
      include Mongo::Operation::Specifiable
    end.new(spec)
  end

  describe '#==' do

    context 'when the other object is a specifiable' do

      context 'when the specs are equal' do

        let(:other) do
          Class.new do
            include Mongo::Operation::Specifiable
          end.new(spec)
        end

        it 'returns true' do
          expect(specifiable).to eq(other)
        end
      end

      context 'when the specs are not equal' do

        let(:other) do
          Class.new do
            include Mongo::Operation::Specifiable
          end.new({ :db_name => 'test' })
        end

        it 'returns false' do
          expect(specifiable).to_not eq(other)
        end
      end
    end

    context 'when the other object is not a specifiable' do

      it 'returns false' do
        expect(specifiable).to_not eq('test')
      end
    end
  end
end

Version data entries

26 entries across 25 versions & 3 rubygems

Version Path
mongo-2.0.3 spec/mongo/operation/specifiable_spec.rb
mongo-2.0.2 spec/mongo/operation/specifiable_spec.rb
mongo-2.0.1 spec/mongo/operation/specifiable_spec.rb
mongo-2.0.0 spec/mongo/operation/specifiable_spec.rb
mongo-2.0.0.rc spec/mongo/operation/specifiable_spec.rb
mongo-2.0.0.beta spec/mongo/operation/specifiable_spec.rb