diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 15:18:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 15:18:56 +0300 |
commit | d2d913b606702ecefa01f03362602fde256e3f75 (patch) | |
tree | 07643306ee63f789188a9133823aac3c92c94dfb /spec/views | |
parent | af69e63b6655a450849a8fa2640ae6ce5a8db681 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/issues/_related_issues.html.haml_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/views/projects/issues/_related_issues.html.haml_spec.rb b/spec/views/projects/issues/_related_issues.html.haml_spec.rb new file mode 100644 index 00000000000..0dbca032c4b --- /dev/null +++ b/spec/views/projects/issues/_related_issues.html.haml_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'projects/issues/_related_issues.html.haml', feature_category: :team_planning do + let_it_be(:project) { build_stubbed(:project) } + let_it_be(:issue) { build_stubbed(:issue, project: project) } + + context 'when current user cannot read issue link for the project' do + before do + allow(view).to receive(:can?).and_return(false) + end + + it 'does not render the related issues root node' do + render + + expect(rendered).not_to have_selector(".js-related-issues-root") + end + end + + context 'when current user can read issue link for the project' do + before do + allow(view).to receive(:can?).and_return(true) + + assign(:project, project) + assign(:issue, issue) + end + + it 'adds the report abuse path as a data attribute' do + render + + expect(rendered).to have_selector( + ".js-related-issues-root[data-report-abuse-path=\"#{add_category_abuse_reports_path}\"]" + ) + end + end +end |