Sha256: 8d1f08f5ff2ee4d002c5a3721beb7cb1c92654680fdffd68f68127ad2a7f9bfe

Contents?: true

Size: 902 Bytes

Versions: 1

Compression:

Stored size: 902 Bytes

Contents

require "spec_helper"

describe Moped::WriteConcern::Propagate do

  describe "#operation" do

    let(:concern) do
      described_class.new(w: 1)
    end

    it "returns the gle command" do
      expect(concern.operation).to eq(getlasterror: 1, w: 1)
    end
  end

  describe "#initialize" do

    context "when the concern is an options hash" do

      context "when the value is an integer" do

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

        it "merges the options into the gle" do
          expect(concern.operation).to eq(getlasterror: 1, w: 3)
        end
      end

      context "when the value is a symbol" do

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

        it "converts the symbol to a string" do
          expect(concern.operation).to eq(getlasterror: 1, w: "majority")
        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/write_concern/propagate_spec.rb