1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
require 'spec_helper'
describe Mongo::Operation::Write::Command::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
|