diff options
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 |