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:
-rw-r--r--lib/gitlab/danger/teammate.rb5
-rw-r--r--spec/lib/gitlab/danger/teammate_spec.rb38
2 files changed, 42 insertions, 1 deletions
diff --git a/lib/gitlab/danger/teammate.rb b/lib/gitlab/danger/teammate.rb
index 2789706aa3b..ba729cd08ab 100644
--- a/lib/gitlab/danger/teammate.rb
+++ b/lib/gitlab/danger/teammate.rb
@@ -43,6 +43,11 @@ module Gitlab
area && labels.any?("devops::#{area.downcase}") if kind == :reviewer
else
+ when :ux
+ area = role[/Product Designer(?:.*?, (\w+))/, 1]
+
+ area && labels.any?("devops::#{area.downcase}") if kind == :reviewer
+ else
capabilities(project).include?("#{kind} #{category}")
end
end
diff --git a/spec/lib/gitlab/danger/teammate_spec.rb b/spec/lib/gitlab/danger/teammate_spec.rb
index afbc3896a70..62e254b50cf 100644
--- a/spec/lib/gitlab/danger/teammate_spec.rb
+++ b/spec/lib/gitlab/danger/teammate_spec.rb
@@ -64,10 +64,46 @@ describe Gitlab::Danger::Teammate do
it '#reviewer? returns false' do
expect(subject.reviewer?(project, :test, labels)).to be_falsey
end
- end
+ end
end
end
+ context 'when labels contain Release and the category is UX' do
+ let(:labels) { ['devops::release'] }
+
+ context 'when role is Product Designer, Release' do
+ let(:role) { 'Product Designer, Release' }
+
+ it '#reviewer? returns true' do
+ expect(subject.reviewer?(project, :ux, labels)).to be_truthy
+ end
+
+ context 'when hyperlink is mangled in the role' do
+ let(:role) { '<a href="#">Product Designer</a>, Release' }
+
+ it '#reviewer? returns true' do
+ expect(subject.reviewer?(project, :ux, labels)).to be_truthy
+ end
+ end
+ end
+
+ context 'when role is Product Designer' do
+ let(:role) { 'Product Designer' }
+
+ it '#reviewer? returns false' do
+ expect(subject.reviewer?(project, :ux, labels)).to be_falsey
+ end
+ end
+
+ context 'when role is Product Designer, Release' do
+ let(:role) { 'Product Designer, Release' }
+
+ it '#reviewer? returns false' do
+ expect(subject.reviewer?(project, :ux, labels)).to be_falsey
+ end
+ end
+ end
+
context 'when having single capability' do
let(:capabilities) { 'reviewer backend' }