diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-01 17:15:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-01 17:15:38 +0300 |
commit | 28b374eea4e2890514067ac7875b4c1d252c5cdd (patch) | |
tree | 9fe30ae35df4b83cee000e1a0880b390d88d80f0 /spec/views | |
parent | c8fd9c521b89b98797cfd6e3a51cae6955129c20 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-ee
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/events/event/_common.html.haml_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/views/events/event/_common.html.haml_spec.rb b/spec/views/events/event/_common.html.haml_spec.rb new file mode 100644 index 00000000000..0de84e2fdb8 --- /dev/null +++ b/spec/views/events/event/_common.html.haml_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'events/event/_common.html.haml' do + let_it_be(:project) { create(:project) } + let_it_be(:issue) { create(:issue, project: project) } + let_it_be(:user) { create(:user) } + + context 'when it is a work item event' do + let(:work_item) { create(:work_item, project: project) } + + let(:event) do + create(:event, :created, project: project, target: work_item, target_type: 'WorkItem', author: user) + end + + it 'renders the correct url' do + render partial: 'events/event/common', locals: { event: event.present } + + expect(rendered).to have_link( + work_item.reference_link_text, href: "/#{project.full_path}/-/work_items/#{work_item.id}" + ) + end + end + + context 'when it is an isssue event' do + let(:issue) { create(:issue, project: project) } + + let(:event) do + create(:event, :created, project: project, target: issue, author: user) + end + + it 'renders the correct url' do + render partial: 'events/event/common', locals: { event: event.present } + + expect(rendered).to have_link(issue.reference_link_text, href: "/#{project.full_path}/-/issues/#{issue.iid}") + end + end +end |