spec/mongo/auth/x509_spec.rb in mongo-2.4.0.rc1 vs spec/mongo/auth/x509_spec.rb in mongo-2.4.0

- old
+ new

@@ -5,23 +5,28 @@ let(:address) do default_address end let(:monitoring) do - Mongo::Monitoring.new + Mongo::Monitoring.new(monitoring: false) end let(:listeners) do Mongo::Event::Listeners.new end let(:cluster) do double('cluster').tap do |cl| + allow(cl).to receive(:topology).and_return(topology) allow(cl).to receive(:app_metadata).and_return(app_metadata) end end + let(:topology) do + double('topology') + end + let(:server) do Mongo::Server.new(address, cluster, monitoring, listeners, TEST_OPTIONS) end let(:connection) do @@ -34,20 +39,20 @@ describe '#login' do context 'when the user is not authorized for the database' do - let(:cr) do + let(:x509) do described_class.new(user) end let(:login) do - cr.login(connection).documents[0] + x509.login(connection).documents[0] end it 'logs the user into the connection' do expect { - cr.login(connection) + x509.login(connection) }.to raise_error(Mongo::Auth::Unauthorized) end end end end