diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-01 15:09:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-01 15:09:52 +0000 |
commit | 41aebff8ec728c167298aa44e037d8e324e00e8d (patch) | |
tree | f51c379dd4b78f9ecb57175e9dc073d6debe74e5 /spec/features | |
parent | 8c438dd7a6063d7f59bce4d79cc7ca49a31a8346 (diff) | |
download | gitlab-ce-41aebff8ec728c167298aa44e037d8e324e00e8d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/infrastructure_registry_spec.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/features/projects/infrastructure_registry_spec.rb b/spec/features/projects/infrastructure_registry_spec.rb new file mode 100644 index 00000000000..9cab4ebeb3a --- /dev/null +++ b/spec/features/projects/infrastructure_registry_spec.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Infrastructure Registry' do + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project) } + + before do + sign_in(user) + project.add_maintainer(user) + end + + context 'when feature is not available' do + before do + stub_feature_flags(infrastructure_registry_page: false) + end + + it 'gives 404' do + visit_project_infrastructure_registry + + expect(status_code).to eq(404) + end + end + + context 'when feature is available', :js do + before do + visit_project_infrastructure_registry + end + + context 'when there are packages' do + let_it_be(:terraform_module) { create(:terraform_module_package, project: project, created_at: 1.day.ago, version: '1.0.0') } + let_it_be(:terraform_module2) { create(:terraform_module_package, project: project, created_at: 2.days.ago, version: '2.0.0') } + let_it_be(:packages) { [terraform_module, terraform_module2] } + + it_behaves_like 'packages list' + + context 'deleting a package' do + let_it_be(:project) { create(:project) } + let_it_be(:terraform_module) { create(:terraform_module_package, project: project) } + + it 'allows you to delete a module', :aggregate_failures do + # this is still using the package copy in the UI too + click_button('Remove package') + click_button('Delete package') + + expect(page).to have_content 'Package deleted successfully' + expect(page).not_to have_content(terraform_module.name) + end + end + end + + it 'displays the empty message' do + expect(page).to have_content('You have no Terraform modules in your project') + end + end + + def visit_project_infrastructure_registry + visit project_infrastructure_registry_index_path(project) + end +end |