Sha256: d60e2b010c84b94a376f2eeddafe4534bb0080c17b03d46e649fecc6adfea5fb
Contents?: true
Size: 1.07 KB
Versions: 14
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' describe Mongo::Operation::CreateUser do describe '#execute' do let(:user) do Mongo::Auth::User.new( user: 'durran', password: 'password', roles: [ Mongo::Auth::Roles::READ_WRITE ] ) end let(:operation) do described_class.new(user: user, db_name: SpecConfig.instance.test_db) end before do users = root_authorized_client.database.users if users.info('durran').any? users.remove('durran') end end context 'when user creation was successful' do let!(:response) do operation.execute(root_authorized_primary, client: nil) end it 'saves the user in the database' do expect(response).to be_successful end end context 'when creation was not successful' do it 'raises an exception' do expect { operation.execute(root_authorized_primary, client: nil) operation.execute(root_authorized_primary, client: nil) }.to raise_error(Mongo::Error::OperationFailure) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems