Read about our upcoming Code of Conduct on this issue

Commit ac6992ba authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Fix specs

parent bb225ccbec23
......@@ -787,6 +787,8 @@
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 }
......
......@@ -50,6 +50,11 @@
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 @@
{ 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 @@
{ offline_token: true }
end
it_behaves_like 'a forbidden'
it_behaves_like 'an unauthorized'
end
context 'for invalid scope' do
......
......@@ -27,6 +27,7 @@ def stub_ci_builds_disabled
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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment