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:
authorRayana Verissimo <rverissimo@gitlab.com>2019-08-29 21:02:19 +0300
committerRayana Verissimo <rverissimo@gitlab.com>2019-08-29 21:02:19 +0300
commitf3e778039b14e67a26104f1786f065b13126ee4a (patch)
treeae6b6886cfad17a6a325f00f2648d6a472fffed4
parent8ca06e5868c19890c9e967e3369f5247138529e1 (diff)
Update spec/lib/gitlab/danger/teammate_spec.rb, lib/gitlab/danger/teammate.rb filesrverissimo-master-patch-98451
-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' }