Sha256: 79801cf311c7069d540a03b7cebd769c1a99d870b31fbfd9b1f78637e7a9edf6
Contents?: true
Size: 1.32 KB
Versions: 9
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' describe Mongo::Auth::X509::Conversation do let(:user) do Mongo::Auth::User.new( database: Mongo::Database::ADMIN, user: 'user', ) end let(:conversation) do described_class.new(user, double('connection')) end describe '#start' do let(:query) do conversation.start(nil) end let(:selector) do query.selector end it 'sets username' do expect(selector[:user]).to eq('user') end it 'sets the mechanism' do expect(selector[:mechanism]).to eq('MONGODB-X509') end context 'when a username is not provided' do let(:user) do Mongo::Auth::User.new( database: Mongo::Database::ADMIN ) end it 'does not set the username' do expect(selector[:user]).to be_nil end it 'sets the mechanism' do expect(selector[:mechanism]).to eq('MONGODB-X509') end end context 'when the username is nil' do let(:user) do Mongo::Auth::User.new( database: Mongo::Database::ADMIN, user: nil ) end it 'does not set the username' do expect(selector.has_key?(:user)).to be(false) end it 'sets the mechanism' do expect(selector[:mechanism]).to eq('MONGODB-X509') end end end end
Version data entries
9 entries across 9 versions & 1 rubygems