Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/issuables_helper_spec.rb')
-rw-r--r--spec/helpers/issuables_helper_spec.rb82
1 files changed, 58 insertions, 24 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb
index a2b8ee061bb..7b5537c54cc 100644
--- a/spec/helpers/issuables_helper_spec.rb
+++ b/spec/helpers/issuables_helper_spec.rb
@@ -524,6 +524,64 @@ RSpec.describe IssuablesHelper, feature_category: :team_planning do
end
end
end
+
+ describe '#duplicatedToIssueUrl' do
+ let(:issue) { create(:issue, author: user) }
+
+ before do
+ assign(:project, issue.project)
+ end
+
+ context 'when issue is duplicated' do
+ before do
+ allow(issue).to receive(:duplicated?).and_return(true)
+ allow(issue).to receive(:duplicated_to).and_return(issue)
+ end
+
+ it 'returns url' do
+ expect(helper.issuable_initial_data(issue)[:duplicatedToIssueUrl]).to be_truthy
+ end
+ end
+
+ context 'when issue is not duplicated' do
+ before do
+ allow(issue).to receive(:duplicated?).and_return(false)
+ end
+
+ it 'returns nil' do
+ expect(helper.issuable_initial_data(issue)[:duplicatedToIssueUrl]).to be_nil
+ end
+ end
+ end
+
+ describe '#movedToIssueUrl' do
+ let(:issue) { create(:issue, author: user) }
+
+ before do
+ assign(:project, issue.project)
+ end
+
+ context 'when issue is moved' do
+ before do
+ allow(issue).to receive(:moved?).and_return(true)
+ allow(issue).to receive(:moved_to).and_return(issue)
+ end
+
+ it 'returns url' do
+ expect(helper.issuable_initial_data(issue)[:movedToIssueUrl]).to be_truthy
+ end
+ end
+
+ context 'when issue is not moved' do
+ before do
+ allow(issue).to receive(:moved?).and_return(false)
+ end
+
+ it 'returns nil' do
+ expect(helper.issuable_initial_data(issue)[:movedToIssueUrl]).to be_nil
+ end
+ end
+ end
end
describe '#assignee_sidebar_data' do
@@ -674,30 +732,6 @@ RSpec.describe IssuablesHelper, feature_category: :team_planning do
end
end
- describe '#hidden_issuable_icon', feature_category: :insider_threat do
- let_it_be(:mock_svg) { '<svg></svg>'.html_safe }
-
- before do
- allow(helper).to receive(:sprite_icon).and_return(mock_svg)
- end
-
- context 'when issuable is an issue' do
- let_it_be(:issuable) { build(:issue) }
-
- it 'returns icon with tooltip' do
- expect(helper.hidden_issuable_icon(issuable)).to eq("<span class=\"has-tooltip\" title=\"This issue is hidden because its author has been banned\">#{mock_svg}</span>")
- end
- end
-
- context 'when issuable is a merge request' do
- let_it_be(:issuable) { build(:merge_request) }
-
- it 'returns icon with tooltip' do
- expect(helper.hidden_issuable_icon(issuable)).to eq("<span class=\"has-tooltip\" title=\"This merge request is hidden because its author has been banned\">#{mock_svg}</span>")
- end
- end
- end
-
describe '#issuable_type_selector_data' do
using RSpec::Parameterized::TableSyntax