blob: 702964a2610874f1d9355316310a1e833830d9db (
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
|
# frozen_string_literal: true
RSpec.shared_examples 'user views tag' do
context 'when user views with the tag' do
let(:project) { create(:project, :repository, :public) }
let(:user) { create(:user) }
let(:tag_name) { "stable" }
let(:release_name) { 'ReleaseName' }
let(:release_notes) { 'Release notes' }
let!(:release) do
create(:release, project: project, tag: tag_name, name: release_name, description: release_notes)
end
before do
project.repository.add_tag(user, tag_name, project.default_branch_or_main)
sign_in(user)
end
context 'and user is authorized to read release' do
before do
project.add_developer(user)
end
shared_examples 'shows tag' do
it do
visit tag_page
expect(page).to have_content tag_name
expect(page).to have_link(release_name, href: project_release_path(project, release))
end
end
it_behaves_like 'shows tag'
context 'when tag name contains a slash' do
let(:tag_name) { "stable/v0.1" }
it_behaves_like 'shows tag'
end
end
context 'and user is not authorized to read release' do
before do
project.project_feature.update!(releases_access_level: Featurable::PRIVATE)
end
it 'hides release link and notes', :aggregate_failures do
visit tag_page
expect(page).not_to have_link(release_name, href: project_release_path(project, release))
expect(page).not_to have_text(release_notes)
end
end
end
end
|