Sha256: c776d231bc3f64e376eefff9cf279971dfb2d20e29dcbc347685758b1b8c531c
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require "spec_helper" describe Moped::ReadPreference::SecondaryPreferred do describe "#name" do let(:preference) do described_class.new end it "returns secondaryPreferred" do expect(preference.name).to eq(:secondaryPreferred) end end describe "#with_node", replica_set: true do let(:preference) do described_class.new end context "when a secondary is available" do let(:cluster) do Moped::Cluster.new(@secondaries.map(&:address), {}) end let(:node) do end it "returns the secondary" do preference.with_node(cluster) do |node| expect(node).to be_secondary end end end context "when a secondary is not available" do context "when a primary is available" do let(:cluster) do Moped::Cluster.new([ @primary.address ], {}) end before do @secondaries.each(&:stop) end it "returns the primary" do preference.with_node(cluster) do |node| expect(node).to be_primary end end end context "when a primary is not available" do let(:cluster) do Moped::Cluster.new([], {}) end it "raises an error" do expect { preference.with_node(cluster) {} }.to raise_error(Moped::Errors::ConnectionFailure) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ish_lib_manager-0.0.1 | test/dummy/vendor/bundle/ruby/2.3.0/bundler/gems/moped-cf817ca58a85/spec/moped/read_preference/secondary_preferred_spec.rb |