Sha256: 02ce01b69810c17bbbb8d095fee7789dd13e6fb3ad61c2ce453f241373b99888

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'spec_helper'

describe Mongo::Operation::UpdateUser do
  require_no_required_api_version

  let(:context) { Mongo::Operation::Context.new }

  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, context: context)
      end

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mongo-2.16.4 spec/mongo/operation/update_user_spec.rb
mongo-2.17.4 spec/mongo/operation/update_user_spec.rb
mongo-2.18.3 spec/mongo/operation/update_user_spec.rb
mongo-2.18.2 spec/mongo/operation/update_user_spec.rb
mongo-2.17.3 spec/mongo/operation/update_user_spec.rb
mongo-2.18.1 spec/mongo/operation/update_user_spec.rb
mongo-2.18.0 spec/mongo/operation/update_user_spec.rb
mongo-2.17.2 spec/mongo/operation/update_user_spec.rb
mongo-2.16.3 spec/mongo/operation/update_user_spec.rb
mongo-2.18.0.beta1 spec/mongo/operation/update_user_spec.rb
mongo-2.16.2 spec/mongo/operation/update_user_spec.rb
mongo-2.17.1 spec/mongo/operation/update_user_spec.rb
mongo-2.16.1 spec/mongo/operation/update_user_spec.rb
mongo-2.17.0 spec/mongo/operation/update_user_spec.rb
mongo-2.16.0 spec/mongo/operation/update_user_spec.rb
mongo-2.15.1 spec/mongo/operation/update_user_spec.rb
mongo-2.16.0.alpha1 spec/mongo/operation/update_user_spec.rb
mongo-2.15.0 spec/mongo/operation/update_user_spec.rb