diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-16 23:40:40 -0500 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-05-16 23:40:40 -0500 |
commit | ac6992ba682de08b79e5ddde08dbf566827e2f07 (patch) | |
tree | 8309357202f41c928b13b2d649cb50cd38011d04 | |
parent | 0a6c3494b0326de4cdc35d6369f48810d8403f5a (diff) | |
download | gitlab-ce-ac6992ba682de08b79e5ddde08dbf566827e2f07.tar.gz |
Fix specs
-rw-r--r-- | spec/models/project_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/auth/container_registry_authentication_service_spec.rb | 9 | ||||
-rw-r--r-- | spec/support/stub_gitlab_calls.rb | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index e434d267896..60e1ec43f2b 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -787,6 +787,8 @@ describe Project, models: true do describe '#container_registry_repository' do let(:project) { create(:empty_project) } + before { stub_container_registry_config(enabled: true) } + subject { project.container_registry_repository } it { is_expected.to_not be_nil } diff --git a/spec/services/auth/container_registry_authentication_service_spec.rb b/spec/services/auth/container_registry_authentication_service_spec.rb index d90e2982c4f..6c9f56a4fba 100644 --- a/spec/services/auth/container_registry_authentication_service_spec.rb +++ b/spec/services/auth/container_registry_authentication_service_spec.rb @@ -50,6 +50,11 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do end end + shared_examples 'an unauthorized' do + it { is_expected.to include(http_status: 401) } + it { is_expected.to_not include(:token) } + end + shared_examples 'a forbidden' do it { is_expected.to include(http_status: 403) } it { is_expected.to_not include(:token) } @@ -116,7 +121,7 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do { offline_token: true } end - it_behaves_like 'a forbidden' + it_behaves_like 'an unauthorized' end context 'allow to pull and push images' do @@ -179,7 +184,7 @@ describe Auth::ContainerRegistryAuthenticationService, services: true do { offline_token: true } end - it_behaves_like 'a forbidden' + it_behaves_like 'an unauthorized' end context 'for invalid scope' do diff --git a/spec/support/stub_gitlab_calls.rb b/spec/support/stub_gitlab_calls.rb index 36e234c2e9c..f73416a3d0f 100644 --- a/spec/support/stub_gitlab_calls.rb +++ b/spec/support/stub_gitlab_calls.rb @@ -27,6 +27,7 @@ module StubGitlabCalls def stub_container_registry_config(registry_settings) allow(Gitlab.config.registry).to receive_messages(registry_settings) + allow(Auth::ContainerRegistryAuthenticationService).to receive(:full_access_token).and_return('token') end def stub_container_registry_tags(*tags) |