diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/views/projects/tags/index.html.haml_spec.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/views/projects/tags/index.html.haml_spec.rb')
-rw-r--r-- | spec/views/projects/tags/index.html.haml_spec.rb | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb index ae59c1aa4b2..aff233b697f 100644 --- a/spec/views/projects/tags/index.html.haml_spec.rb +++ b/spec/views/projects/tags/index.html.haml_spec.rb @@ -4,7 +4,6 @@ require 'spec_helper' RSpec.describe 'projects/tags/index.html.haml' do let_it_be(:project) { create(:project, :repository) } - let_it_be(:tags) { project.repository.tags } let_it_be(:git_tag) { project.repository.tags.last } let_it_be(:release) do create(:release, project: project, @@ -25,9 +24,31 @@ RSpec.describe 'projects/tags/index.html.haml' do allow(view).to receive(:current_user).and_return(project.namespace.owner) end - it 'renders links to the Releases page for tags associated with a release' do - render - expect(rendered).to have_link(release.name, href: project_releases_path(project, anchor: release.tag)) + context 'when tag is associated with a release' do + context 'when name does not contain a backslash' do + it 'renders a link to the release page' do + render + expect(rendered).to have_link(release.name, href: project_release_path(project, release)) + end + end + + context 'when name contains backslash' do + let_it_be(:release) { create(:release, project: project, tag: 'test/v1') } + + before_all do + project.repository.add_tag(project.owner, 'test/v1', project.default_branch_or_main) + project.repository.expire_tags_cache + + project.releases.reload + + assign(:tags, Kaminari.paginate_array(tags).page(0)) + end + + it 'renders a link to the release page with backslash escaped' do + render + expect(rendered).to have_link(release.name, href: project_release_path(project, release)) + end + end end context 'when the most recent build for a tag has artifacts' do @@ -104,4 +125,8 @@ RSpec.describe 'projects/tags/index.html.haml' do ) end end + + def tags + project.repository.tags + end end |