Read about our upcoming Code of Conduct on this issue

Commit 04933fd5 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Use container registry config stub

parent f5068bffdff6
......@@ -5,17 +5,12 @@
let(:repository) { project.container_registry_repository }
let(:tag_name) { 'latest' }
let(:tags) { [tag_name] }
let(:registry_settings) do
{
enabled: true
}
end
before do
login_as(:user)
project.team << [@user, :developer]
stub_container_registry_tags(*tags)
allow(Gitlab.config.registry).to receive_messages(registry_settings)
stub_container_registry_config(enabled: true)
allow(Auth::ContainerRegistryAuthenticationService).to receive(:full_access_token).and_return('token')
end
......
......@@ -797,7 +797,7 @@
subject { project.container_registry_repository_url }
before { allow(Gitlab.config.registry).to receive_messages(registry_settings) }
before { stub_container_registry_config(**registry_settings) }
context 'for enabled registry' do
let(:registry_settings) do
......@@ -826,14 +826,8 @@
subject { project.has_container_registry_tags? }
before { allow(Gitlab.config.registry).to receive_messages(registry_settings) }
context 'for enabled registry' do
let(:registry_settings) do
{
enabled: true
}
end
before { stub_container_registry_config(enabled: true) }
context 'with tags' do
before { stub_container_registry_tags('test', 'test2') }
......@@ -849,11 +843,7 @@
end
context 'for disabled registry' do
let(:registry_settings) do
{
enabled: false
}
end
before { stub_container_registry_config(enabled: false) }
it { is_expected.to be_falsey }
end
......
......@@ -5,19 +5,12 @@
let(:current_user) { nil }
let(:current_params) { {} }
let(:rsa_key) { OpenSSL::PKey::RSA.generate(512) }
let(:registry_settings) do
{
enabled: true,
issuer: 'rspec',
key: nil
}
end
let(:payload) { JWT.decode(subject[:token], rsa_key).first }
subject { described_class.new(current_project, current_user, current_params).execute }
before do
allow(Gitlab.config.registry).to receive_messages(registry_settings)
stub_container_registry_config(enabled: true, issuer: 'rspec', key: nil)
allow_any_instance_of(JSONWebToken::RSAToken).to receive(:key).and_return(rsa_key)
end
......
......@@ -29,14 +29,8 @@
end
context 'container registry' do
let(:registry_settings) do
{
enabled: true
}
end
before do
allow(Gitlab.config.registry).to receive_messages(registry_settings)
stub_container_registry_config(enabled: true)
stub_container_registry_tags('tag')
end
......
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