Sha256: 46ea3412baa3aa0a8879ac0dfb74380bbdf1f22a7cabae5cd54ce6c236ae734e
Contents?: true
Size: 1.05 KB
Versions: 5
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe Mongo::Auth::SCRAM do let(:address) do Mongo::Address.new(DEFAULT_ADDRESS) end let(:server) do Mongo::Server.new(address, Mongo::Event::Listeners.new) end let(:connection) do Mongo::Server::Connection.new(server) end describe '#login' do context 'when the user is not authorized' do let(:user) do Mongo::Auth::User.new( database: 'driver', user: 'notauser', password: 'password' ) end let(:cr) do described_class.new(user) end it 'raises an exception', if: list_command_enabled? do expect { cr.login(connection) }.to raise_error(Mongo::Auth::Unauthorized) end end end context 'when the user is authorized for the database' do let(:cr) do described_class.new(root_user) end let(:login) do cr.login(connection).documents[0] end it 'logs the user into the connection', if: list_command_enabled? do expect(login['ok']).to eq(1) end end end
Version data entries
5 entries across 5 versions & 1 rubygems