diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /spec/helpers/issuables_helper_spec.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'spec/helpers/issuables_helper_spec.rb')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 82 |
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 |