Sha256: 720d97650513775c111d378e64ebe43b5aba1a639287d9cdd81325cfeb115b61

Contents?: true

Size: 995 Bytes

Versions: 14

Compression:

Stored size: 995 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: SpecConfig.instance.test_db)
    end

    before do
      users = root_authorized_client.database.users
      if users.info('durran').any?
        users.remove('durran')
      end
      users.create(user)
    end

    context 'when user update was successful' do

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/mongo/operation/update_user_spec.rb
mongo-2.14.1 spec/mongo/operation/update_user_spec.rb
mongo-2.13.2 spec/mongo/operation/update_user_spec.rb
mongo-2.14.0 spec/mongo/operation/update_user_spec.rb
mongo-2.14.0.rc1 spec/mongo/operation/update_user_spec.rb
mongo-2.13.1 spec/mongo/operation/update_user_spec.rb
mongo-2.12.4 spec/mongo/operation/update_user_spec.rb
mongo-2.13.0 spec/mongo/operation/update_user_spec.rb
mongo-2.12.3 spec/mongo/operation/update_user_spec.rb
mongo-2.13.0.rc1 spec/mongo/operation/update_user_spec.rb
mongo-2.12.2 spec/mongo/operation/update_user_spec.rb
mongo-2.13.0.beta1 spec/mongo/operation/update_user_spec.rb
mongo-2.12.1 spec/mongo/operation/update_user_spec.rb
mongo-2.12.0.rc0 spec/mongo/operation/update_user_spec.rb