diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-15 18:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-15 18:10:04 +0300 |
commit | 68d7192881c41305da9c6aa1e3f7dd8b47f286a7 (patch) | |
tree | 015aae6f32b30437718e76c663e8383a4a4d8a22 /spec/controllers/projects | |
parent | 96acc69fae1ee7d559ba7eaa4e8304c8261525e3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects')
-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 |