spec/mongo/auth/x509_spec.rb in mongo-2.12.4 vs spec/mongo/auth/x509_spec.rb in mongo-2.13.0.beta1
- old
+ new
@@ -21,11 +21,11 @@
let(:user) do
Mongo::Auth::User.new(database: '$external')
end
it 'works' do
- described_class.new(user)
+ described_class.new(user, connection)
end
end
context 'when user specifies database other than $external' do
@@ -33,38 +33,38 @@
Mongo::Auth::User.new(database: 'foo')
end
it 'raises InvalidConfiguration' do
expect do
- described_class.new(user)
+ described_class.new(user, connection)
end.to raise_error(Mongo::Auth::InvalidConfiguration, /User specifies auth source 'foo', but the only valid auth source for X.509 is '\$external'/)
end
end
end
describe '#login' do
# When x509 auth is configured, the login would work and this test
# requires the login to fail.
- require_no_x509_auth
+ require_no_external_user
context 'when the user is not authorized for the database' do
before do
connection.connect!
end
let(:x509) do
- described_class.new(user)
+ described_class.new(user, connection)
end
let(:login) do
- x509.login(connection).documents[0]
+ x509.login.documents[0]
end
it 'attempts to log the user into the connection' do
- expect {
- x509.login(connection)
- }.to raise_error(Mongo::Auth::Unauthorized)
+ expect do
+ x509.login
+ end.to raise_error(Mongo::Auth::Unauthorized)
end
end
end
end