Sha256: 8cb3b243cc442f761e65873c59f6322bcf1af244e40513484d799371825b4dd7
Contents?: true
Size: 1.68 KB
Versions: 69
Compression:
Stored size: 1.68 KB
Contents
require 'spec_helper' describe Dockly::Docker::Registry do subject { described_class.new(:name => :dockly_registry) } describe '#authenticate!' do context 'when authentication is not required' do before { subject.authentication_required false } it 'does nothing' do ::Docker.should_not_receive(:authenticate!) subject.authenticate! end end context 'when the password has not been supplied via the DSL' do subject { described_class.new( :name => 'no-password', :email => 'fake@email.com', :username => 'fakeuser' ) } before { ::Docker.stub(:authenticate!) } it 'prompts the user for the password' do ENV.should_receive(:[]).and_return('password') expect { subject.authenticate! }.to_not raise_error end end context 'when the password has been supplied via the DSL' do subject { described_class.new( :name => 'no-password', :email => 'fake@email.com', :password => 'fakepassword', :username => 'fakeuser' ) } context 'when authentication succeeds' do before { ::Docker.stub(:authenticate!) } it 'does nothing' do ENV.should_not_receive(:[]) expect { subject.authenticate! }.to_not raise_error end end context 'when authentication fails' do before do ::Docker.stub(:authenticate!).and_raise(::Docker::Error::AuthenticationError) end it 'raieses an error' do ENV.should_not_receive(:[]) expect { subject.authenticate! }.to raise_error end end end end end
Version data entries
69 entries across 69 versions & 1 rubygems