1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
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
|