Sha256: 5878d50f71c07927420475fa2d48cd298d24982498910ed409a862ee25c15971
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
require 'spec_helper' describe Mongo::Auth::SCRAM do let(:address) do default_address end let(:monitoring) do Mongo::Monitoring.new end let(:listeners) do Mongo::Event::Listeners.new end let(:cluster) do double('cluster').tap do |cl| allow(cl).to receive(:app_metadata).and_return(app_metadata) end end let(:server) do Mongo::Server.new(address, cluster, monitoring, listeners, TEST_OPTIONS) end let(:connection) do Mongo::Server::Connection.new(server, TEST_OPTIONS) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongo-2.4.0.rc1 | spec/mongo/auth/scram_spec.rb |
mongo-2.4.0.rc0 | spec/mongo/auth/scram_spec.rb |