Sha256: b5ac1745aea47ac81e47b00ca9208c37e9c03347c6ed313e92a8f63c42dc34d5

Contents?: true

Size: 956 Bytes

Versions: 13

Compression:

Stored size: 956 Bytes

Contents

require 'spec_helper'

describe Mongo::Operation::Write::UpdateUser do

  describe '#execute' do

    let(:user) do
      Mongo::Auth::User.new(
          user: 'durran',
          password: 'password',
          roles: [ Mongo::Auth::Roles::READ_WRITE ]
      )
    end

    let(:user_updated) do
      Mongo::Auth::User.new(
          user: 'durran',
          password: '123',
          roles: [ Mongo::Auth::Roles::READ ]
      )
    end

    let(:operation) do
      described_class.new(user: user_updated, db_name: TEST_DB)
    end

    before do
      root_authorized_client.database.users.create(user)
    end

    after do
      root_authorized_client.database.users.remove('durran')
    end

    context 'when user update was successful' do

      let!(:response) do
        operation.execute(root_authorized_primary)
      end

      it 'updates the user in the database' do
        expect(response).to be_successful
      end
    end
  end
end

Version data entries

13 entries across 11 versions & 2 rubygems

Version Path
mongo-2.5.0.beta spec/mongo/operation/write/update_user_spec.rb
mongo-2.4.3 spec/mongo/operation/write/update_user_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/write/update_user_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/write/update_user_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.2/spec/mongo/operation/write/update_user_spec.rb
mongo-2.4.2 spec/mongo/operation/write/update_user_spec.rb
tdiary-5.0.4 vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/write/update_user_spec.rb
mongo-2.4.1 spec/mongo/operation/write/update_user_spec.rb
mongo-2.4.0 spec/mongo/operation/write/update_user_spec.rb
mongo-2.3.1 spec/mongo/operation/write/update_user_spec.rb
mongo-2.4.0.rc1 spec/mongo/operation/write/update_user_spec.rb
mongo-2.4.0.rc0 spec/mongo/operation/write/update_user_spec.rb
mongo-2.3.0 spec/mongo/operation/write/update_user_spec.rb