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
path: root/spec
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-03-20 11:29:15 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2018-03-23 12:04:44 +0300
commit204ab7c9f88e19eea96ff64e39ae81cdcb83bada (patch)
treee2e96e3d0d2dc933d6e32529eea9306e841303f4 /spec
parent453b5c1c12ecc34f2aca7df021bfc451fefab095 (diff)
Fix issuable state indicator
Now the issuable reference check works only in project scope, if we reference an issuable from a non-project resource (e.g. epics), then project is not set, and there is mismatch in generated issue references. This patch enables issuable reference state check also from group scope. Closes gitlab-ee#4683 Related to #30916
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/banzai/filter/issuable_state_filter_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/issuable_state_filter_spec.rb b/spec/lib/banzai/filter/issuable_state_filter_spec.rb
index 17347768a49..a5373517ac8 100644
--- a/spec/lib/banzai/filter/issuable_state_filter_spec.rb
+++ b/spec/lib/banzai/filter/issuable_state_filter_spec.rb
@@ -8,6 +8,7 @@ describe Banzai::Filter::IssuableStateFilter do
let(:context) { { current_user: user, issuable_state_filter_enabled: true } }
let(:closed_issue) { create_issue(:closed) }
let(:project) { create(:project, :public) }
+ let(:group) { create(:group) }
let(:other_project) { create(:project, :public) }
def create_link(text, data)
@@ -77,6 +78,13 @@ describe Banzai::Filter::IssuableStateFilter do
expect(doc.css('a').last.text).to eq("#{closed_issue.to_reference(other_project)} (closed)")
end
+ it 'handles references from group scopes' do
+ link = create_link(closed_issue.to_reference(other_project), issue: closed_issue.id, reference_type: 'issue')
+ doc = filter(link, context.merge(project: nil, group: group))
+
+ expect(doc.css('a').last.text).to eq("#{closed_issue.to_reference(other_project)} (closed)")
+ end
+
it 'skips cross project references if the user cannot read cross project' do
expect(Ability).to receive(:allowed?).with(user, :read_cross_project) { false }
link = create_link(closed_issue.to_reference(other_project), issue: closed_issue.id, reference_type: 'issue')