diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/features/projects/packages_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/features/projects/packages_spec.rb')
-rw-r--r-- | spec/features/projects/packages_spec.rb | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/spec/features/projects/packages_spec.rb b/spec/features/projects/packages_spec.rb new file mode 100644 index 00000000000..e5c684bdff5 --- /dev/null +++ b/spec/features/projects/packages_spec.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Packages' 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 + context 'packages feature is disabled by config' do + before do + allow(Gitlab.config.packages).to receive(:enabled).and_return(false) + end + + it 'gives 404' do + visit_project_packages + + expect(status_code).to eq(404) + end + end + end + + context 'when feature is available', :js do + before do + visit_project_packages + end + + context 'when there are packages' do + let_it_be(:conan_package) { create(:conan_package, project: project, name: 'zzz', created_at: 1.day.ago, version: '1.0.0') } + let_it_be(:maven_package) { create(:maven_package, project: project, name: 'aaa', created_at: 2.days.ago, version: '2.0.0') } + let_it_be(:packages) { [conan_package, maven_package] } + + it_behaves_like 'packages list' + + it_behaves_like 'package details link' + + context 'deleting a package' do + let_it_be(:project) { create(:project) } + let_it_be(:package) { create(:package, project: project) } + + it 'allows you to delete a package' do + first('[title="Remove package"]').click + click_button('Delete package') + + expect(page).to have_content 'Package deleted successfully' + expect(page).not_to have_content(package.name) + end + end + + it_behaves_like 'shared package sorting' do + let_it_be(:package_one) { maven_package } + let_it_be(:package_two) { conan_package } + end + end + + it_behaves_like 'when there are no packages' + end + + def visit_project_packages + visit project_packages_path(project) + end +end |