blob: 7fcc8200b1c3552ad1651c4b6d1ef54c97ddf723 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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(:npm_package) { create(:npm_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) { [npm_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) { npm_package }
end
end
it_behaves_like 'when there are no packages'
end
def visit_project_packages
visit project_packages_path(project)
end
end
|