summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 13:26:31 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 13:26:31 +0000
commitb7dfe2ae4054aa40e15182fd3c6cb7dd39f131db (patch)
tree5ab080ca9cadeb6cd9578bf301e4e9e8810bed9e /spec/views
parent25cb337cf12438169f1b14bc5dace8a06a7356e3 (diff)
downloadgitlab-ce-b7dfe2ae4054aa40e15182fd3c6cb7dd39f131db.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/projects/issues/show.html.haml_spec.rb36
-rw-r--r--spec/views/shared/_label_row.html.haml_spec.rb1
2 files changed, 36 insertions, 1 deletions
diff --git a/spec/views/projects/issues/show.html.haml_spec.rb b/spec/views/projects/issues/show.html.haml_spec.rb
index 1ca9eaf8fdb..d734d0b4a20 100644
--- a/spec/views/projects/issues/show.html.haml_spec.rb
+++ b/spec/views/projects/issues/show.html.haml_spec.rb
@@ -56,7 +56,41 @@ describe 'projects/issues/show' do
end
end
- it 'shows "Closed" if an issue has not been moved' do
+ context 'when the issue was duplicated' do
+ let(:new_issue) { create(:issue, project: project, author: user) }
+
+ before do
+ issue.duplicated_to = new_issue
+ end
+
+ context 'when user can see the duplicated issue' do
+ before do
+ project.add_developer(user)
+ end
+
+ it 'shows "Closed (duplicated)" if an issue has been duplicated' do
+ render
+
+ expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (duplicated)')
+ end
+
+ it 'links "duplicated" to the new issue the original issue was duplicated to' do
+ render
+
+ expect(rendered).to have_selector("a[href=\"#{issue_path(new_issue)}\"]", text: 'duplicated')
+ end
+ end
+
+ context 'when user cannot see duplicated issue' do
+ it 'does not show duplicated issue link' do
+ render
+
+ expect(rendered).not_to have_selector("a[href=\"#{issue_path(new_issue)}\"]", text: 'duplicated')
+ end
+ end
+ end
+
+ it 'shows "Closed" if an issue has not been moved or duplicated' do
render
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed')
diff --git a/spec/views/shared/_label_row.html.haml_spec.rb b/spec/views/shared/_label_row.html.haml_spec.rb
index 4cce13aa37c..0764f8480c8 100644
--- a/spec/views/shared/_label_row.html.haml_spec.rb
+++ b/spec/views/shared/_label_row.html.haml_spec.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
require 'spec_helper'
describe 'shared/_label_row.html.haml' do