Commit 4eecb0ad authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'fix-nil-error-in-gitlab-danger-teammate' into 'master'

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

See merge request gitlab-org/gitlab-ce!32284
parents de385eee e17ba8d9
......@@ -39,9 +39,9 @@ module Gitlab
def has_capability?(project, category, kind, labels)
case category
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
capabilities(project).include?("#{kind} #{category}")
end
......
......@@ -50,6 +50,14 @@ describe Gitlab::Danger::Teammate do
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
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