Commit e17ba8d9 authored by Rémy Coutable's avatar Rémy Coutable

Fix a nil error in Gitlab::Danger::Teammate

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent ca5724be
...@@ -39,9 +39,9 @@ module Gitlab ...@@ -39,9 +39,9 @@ module Gitlab
def has_capability?(project, category, kind, labels) def has_capability?(project, category, kind, labels)
case category case category
when :test when :test
area = role[/Test Automation Engineer(?:.*?, (\w+))/, 1].downcase area = role[/Test Automation Engineer(?:.*?, (\w+))/, 1]
area && labels.any?("devops::#{area}") if kind == :reviewer area && labels.any?("devops::#{area.downcase}") if kind == :reviewer
else else
capabilities(project).include?("#{kind} #{category}") capabilities(project).include?("#{kind} #{category}")
end end
......
...@@ -50,6 +50,14 @@ describe Gitlab::Danger::Teammate do ...@@ -50,6 +50,14 @@ describe Gitlab::Danger::Teammate do
end end
end end
context 'when role is Test Automation Engineer' do
let(:role) { 'Test Automation Engineer' }
it '#reviewer? returns false' do
expect(subject.reviewer?(project, :test, labels)).to be_falsey
end
end
context 'when role is Test Automation Engineer, Manage' do context 'when role is Test Automation Engineer, Manage' do
let(:role) { 'Test Automation Engineer, Manage' } let(:role) { 'Test Automation Engineer, Manage' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment