spec/mongo/operation/read_preference_spec.rb in mongo-2.3.1 vs spec/mongo/operation/read_preference_spec.rb in mongo-2.4.0.rc0
- old
+ new
@@ -53,11 +53,11 @@
let(:expected) do
{ :$query => selector, :$readPreference => read_pref.to_mongos }
end
it 'returns a special selector' do
- expect(operation.send(:update_selector, server)).to eq(expected)
+ expect(operation.send(:update_selector_for_read_pref, operation.send(:selector), server)).to eq(expected)
end
context 'when the selector already has $query in it' do
let(:selector) do
@@ -68,11 +68,11 @@
let(:expected) do
selector.merge(:$readPreference => read_pref.to_mongos)
end
it 'returns an unaltered special selector' do
- expect(operation.send(:update_selector, server)).to eq(expected)
+ expect(operation.send(:update_selector_for_read_pref, operation.send(:selector), server)).to eq(expected)
end
end
end
shared_context 'not a selector updater' do
@@ -80,11 +80,11 @@
let(:read_pref) do
Mongo::ServerSelector.get(:mode => mode)
end
it 'returns a selector' do
- expect(operation.send(:update_selector, server)).to eq(selector)
+ expect(operation.send(:update_selector_for_read_pref, operation.send(:selector), server)).to eq(selector)
end
end
context 'when the server is a mongos' do
@@ -166,11 +166,11 @@
let(:expected) do
{ }
end
it 'does not set the slave_ok flag' do
- expect(operation.send(:update_options, server)).to eq(expected)
+ expect(operation.send(:update_options_for_slave_ok, operation.send(:options), server)).to eq(expected)
end
end
context 'when the server is not a mongos' do
@@ -181,11 +181,11 @@
let(:expected) do
{ :flags => [ :slave_ok ] }
end
it 'sets the slave_ok flag' do
- expect(operation.send(:update_options, server)).to eq(expected)
+ expect(operation.send(:update_options_for_slave_ok, operation.send(:options), server)).to eq(expected)
end
end
end
context 'when the topology is not Single' do
@@ -203,11 +203,11 @@
let(:expected) do
{ }
end
it 'does not set the slave_ok flag' do
- expect(operation.send(:update_options, server)).to eq(expected)
+ expect(operation.send(:update_options_for_slave_ok, operation.send(:options), server)).to eq(expected)
end
end
context 'when there is a read preference' do
@@ -220,11 +220,11 @@
let(:expected) do
{ :flags => [ :slave_ok ] }
end
it 'sets the slave_ok flag' do
- expect(operation.send(:update_options, server)).to eq(expected)
+ expect(operation.send(:update_options_for_slave_ok, operation.send(:options), server)).to eq(expected)
end
end
context 'when the read preference does not require the slave_ok flag' do
@@ -235,10 +235,10 @@
let(:expected) do
{ }
end
it 'does not set the slave_ok flag' do
- expect(operation.send(:update_options, server)).to eq(expected)
+ expect(operation.send(:update_options_for_slave_ok, operation.send(:options), server)).to eq(expected)
end
end
end
end
end