Sha256: 082eb5e0f07f235f732d04816a564abe5ebfa6ca1ef9b3951e16cf4111b2acff
Contents?: true
Size: 1.55 KB
Versions: 7
Compression:
Stored size: 1.55 KB
Contents
require 'spec_helper' describe Mongo::Auth::User::View do let(:view) do described_class.new(root_authorized_client.database) end describe '#create' do let!(:response) do view.create( 'durran', password: 'password', roles: [ Mongo::Auth::Roles::READ_WRITE ] ) end after do view.remove('durran') end context 'when user creation was successful' do 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 { view.create('durran', password: 'password') }.to raise_error(Mongo::Error::OperationFailure) end end end describe '#remove' do context 'when user removal was successful' do before do view.create( 'durran', password: 'password', roles: [ Mongo::Auth::Roles::READ_WRITE ] ) end let(:response) do view.remove('durran') end it 'saves the user in the database' do expect(response).to be_successful end end context 'when removal was not successful' do it 'raises an exception', if: write_command_enabled? do expect { view.remove('notauser') }.to raise_error(Mongo::Error::OperationFailure) end it 'does not raise an exception', unless: write_command_enabled? do expect(view.remove('notauser').written_count).to eq(0) end end end describe '#update' do end end
Version data entries
7 entries across 7 versions & 1 rubygems