debian-mirror-gitlab/spec/controllers/groups/dependency_proxies_controller_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.3 KiB
Ruby
Raw Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::DependencyProxiesController do
2022-01-26 12:08:38 +05:30
let_it_be(:group) { create(:group) }
let_it_be_with_reload(:dependency_proxy_group_setting) { create(:dependency_proxy_group_setting, group: group) }
let_it_be(:user) { create(:user) }
2021-01-29 00:20:46 +05:30
before do
group.add_owner(user)
sign_in(user)
end
describe 'GET #show' do
2022-01-26 12:08:38 +05:30
subject { get :show, params: { group_id: group.to_param } }
2021-01-29 00:20:46 +05:30
2022-01-26 12:08:38 +05:30
before do
stub_config(dependency_proxy: { enabled: config_enabled })
2021-01-29 00:20:46 +05:30
end
2022-01-26 12:08:38 +05:30
context 'with global config enabled' do
let(:config_enabled) { true }
2021-01-29 00:20:46 +05:30
2022-01-26 12:08:38 +05:30
context 'with the setting enabled' do
it 'returns 200 and renders the view' do
subject
2021-01-29 00:20:46 +05:30
2022-01-26 12:08:38 +05:30
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('groups/dependency_proxies/show')
end
2021-01-29 00:20:46 +05:30
end
2022-01-26 12:08:38 +05:30
context 'with the setting disabled' do
before do
dependency_proxy_group_setting.update!(enabled: false)
end
2021-01-29 00:20:46 +05:30
2022-01-26 12:08:38 +05:30
it_behaves_like 'returning response status', :not_found
2021-01-29 00:20:46 +05:30
end
end
2022-01-26 12:08:38 +05:30
context 'with global config disabled' do
let(:config_enabled) { false }
2021-01-29 00:20:46 +05:30
2022-01-26 12:08:38 +05:30
it_behaves_like 'returning response status', :not_found
2021-01-29 00:20:46 +05:30
end
end
end