diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-18 18:09:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-18 18:09:22 +0000 |
commit | e4220eeccaf1d53444fdd9102a4061336f91784e (patch) | |
tree | 541d4f0b9fb1273c722973633051795308c46dee /spec/views | |
parent | b556d0fab74a7ef460d868e508ea5ca72d0e5eed (diff) | |
download | gitlab-ce-e4220eeccaf1d53444fdd9102a4061336f91784e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/events/event/_common.html.haml_spec.rb | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/spec/views/events/event/_common.html.haml_spec.rb b/spec/views/events/event/_common.html.haml_spec.rb index 0de84e2fdb8..ad8e5c2ef77 100644 --- a/spec/views/events/event/_common.html.haml_spec.rb +++ b/spec/views/events/event/_common.html.haml_spec.rb @@ -7,33 +7,41 @@ RSpec.describe 'events/event/_common.html.haml' do let_it_be(:issue) { create(:issue, project: project) } let_it_be(:user) { create(:user) } + before do + render partial: 'events/event/common', locals: { event: event.present } + end + context 'when it is a work item event' do - let(:work_item) { create(:work_item, project: project) } + let_it_be(:work_item) { create(:work_item, :task, project: project) } - let(:event) do + let_it_be(: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 + + it 'uses issue_type for the target_name' do + expect(rendered).to have_content("#{s_('Event|opened')} task #{work_item.to_reference}") + end end - context 'when it is an isssue event' do - let(:issue) { create(:issue, project: project) } + context 'when it is an issue event' do + let_it_be(:issue) { create(:issue, project: project) } - let(:event) do + let_it_be(: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 + + it 'uses issue_type for the target_name' do + expect(rendered).to have_content("#{s_('Event|opened')} issue #{issue.to_reference}") + end end end |