diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb b/spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb new file mode 100644 index 00000000000..dc5a022eb7b --- /dev/null +++ b/spec/controllers/projects/packages/infrastructure_registry_controller_spec.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Projects::Packages::InfrastructureRegistryController do + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project, :private) } + + let(:params) { { namespace_id: project.namespace, project_id: project } } + + before do + sign_in(user) + project.add_maintainer(user) + end + + describe 'GET #index' do + subject { get :index, params: params, format: :html } + + it_behaves_like 'returning response status', :ok + + context 'when the feature is disabled' do + before do + stub_feature_flags(infrastructure_registry_page: false) + end + + it_behaves_like 'returning response status', :not_found + end + end + + describe 'GET #show' do + let_it_be(:terraform_module) { create(:terraform_module_package, project: project) } + + subject { get :show, params: params.merge(id: terraform_module.id), format: :html } + + it_behaves_like 'returning response status', :ok + + context 'when the feature is disabled' do + before do + stub_feature_flags(infrastructure_registry_page: false) + end + + it_behaves_like 'returning response status', :not_found + end + end +end |