Sha256: 4a29e3d816650dab0483d516a36a86dff8c50e80abcd1fa5343b492838e3c28d

Contents?: true

Size: 1.12 KB

Versions: 52

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Mongo::WriteConcern::Acknowledged do

  describe '#acknowledged?' do

    let(:concern) do
      described_class.new(:w => :majority)
    end

    it 'returns true' do
      expect(concern.acknowledged?).to be(true)
    end
  end

  describe '#get_last_error' do

    let(:get_last_error) do
      concern.get_last_error
    end

    context 'when the options are symbols' do

      let(:concern) do
        described_class.new(:w => :majority)
      end

      it 'converts the values to strings' do
        expect(get_last_error).to eq(:getlasterror => 1, :w => 'majority')
      end
    end

    context 'when the options are strings' do

      let(:concern) do
        described_class.new(:w => 'majority')
      end

      it 'keeps the values as strings' do
        expect(get_last_error).to eq(:getlasterror => 1, :w => 'majority')
      end
    end

    context 'when the options are numbers' do

      let(:concern) do
        described_class.new(:w => 3)
      end

      it 'keeps the values as numbers' do
        expect(get_last_error).to eq(:getlasterror => 1, :w => 3)
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
mongo-2.13.3 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.14.1 spec/mongo/write_concern/acknowledged_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongo-2.8.0/spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.15.0.alpha spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.13.2 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.14.0 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.14.0.rc1 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.13.1 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.12.4 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.11.6 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.13.0 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.12.3 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.13.0.rc1 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.12.2 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.10.5 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.11.5 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.13.0.beta1 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.12.1 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.12.0.rc0 spec/mongo/write_concern/acknowledged_spec.rb
mongo-2.11.4 spec/mongo/write_concern/acknowledged_spec.rb