Sha256: 4c7daa9d7b15fcf4dc19948c1fc3b436f63493534b3b85a6af6a44c0f0eea94c

Contents?: true

Size: 949 Bytes

Versions: 6

Compression:

Stored size: 949 Bytes

Contents

require 'spec_helper'

describe Mongo::Operation::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

6 entries across 6 versions & 1 rubygems

Version Path
mongo-2.6.4 spec/mongo/operation/update_user_spec.rb
mongo-2.6.2 spec/mongo/operation/update_user_spec.rb
mongo-2.6.1 spec/mongo/operation/update_user_spec.rb
mongo-2.6.0 spec/mongo/operation/update_user_spec.rb
mongo-2.5.3 spec/mongo/operation/update_user_spec.rb
mongo-2.5.2 spec/mongo/operation/update_user_spec.rb