debian-mirror-gitlab/spec/features/projects/packages_spec.rb

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

72 lines
2 KiB
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# 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
2021-09-30 23:02:18 +05:30
let_it_be(:npm_package) { create(:npm_package, project: project, name: 'zzz', created_at: 1.day.ago, version: '1.0.0') }
2020-10-24 23:57:45 +05:30
let_it_be(:maven_package) { create(:maven_package, project: project, name: 'aaa', created_at: 2.days.ago, version: '2.0.0') }
2021-09-30 23:02:18 +05:30
let_it_be(:packages) { [npm_package, maven_package] }
2020-10-24 23:57:45 +05:30
2022-03-02 08:16:31 +05:30
let(:package) { packages.first }
let(:package_details_path) { project_package_path(project, package) }
2020-10-24 23:57:45 +05:30
it_behaves_like 'packages list'
2021-10-27 15:23:28 +05:30
it_behaves_like 'package details link'
2020-10-24 23:57:45 +05:30
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
2022-07-16 23:28:13 +05:30
find('[data-testid="delete-dropdown"]').click
find('[data-testid="action-delete"]').click
2022-11-25 23:54:43 +05:30
click_button('Permanently delete')
2020-10-24 23:57:45 +05:30
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 }
2021-09-30 23:02:18 +05:30
let_it_be(:package_two) { npm_package }
2020-10-24 23:57:45 +05:30
end
end
it_behaves_like 'when there are no packages'
end
def visit_project_packages
visit project_packages_path(project)
end
end