Sha256: fa480527f4a8f640a487560654863b98581d25ae6a2b1f1a075ea90840dfaadf
Contents?: true
Size: 1.13 KB
Versions: 26
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' describe Mongo::Operation::Write::RemoveUser do describe '#execute' do before do root_authorized_client.database.users.create( 'durran', password: 'password', roles: [ Mongo::Auth::Roles::READ_WRITE ] ) end let(:operation) do described_class.new(user_name: 'durran', db_name: TEST_DB) end context 'when user removal was successful' do let!(:response) do operation.execute(root_authorized_primary.context) end it 'removes the user from the database' do expect(response).to be_successful end end context 'when removal was not successful' do before do operation.execute(root_authorized_primary.context) end it 'raises an exception', if: write_command_enabled? do expect { operation.execute(root_authorized_primary.context) }.to raise_error(Mongo::Error::OperationFailure) end it 'does not raise an exception', unless: write_command_enabled? do expect(operation.execute(root_authorized_primary.context).written_count).to eq(0) end end end end
Version data entries
26 entries across 25 versions & 3 rubygems