Update regular expression to extract stage name

Since now the role name can be:

"<a href=\"/job-families/engineering/test-automation-engineer/\">Senior Test Automation Engineer</a>, Create:Source Code"

We need to cope with </a> in the middle.
上级 ab509c78
......@@ -39,7 +39,7 @@ module Gitlab
def has_capability?(project, category, kind, labels)
case category
when :test
area = role[/Test Automation Engineer, (\w+)/, 1]
area = role[/Test Automation Engineer(?:.*?, (\w+))/, 1]
area && labels.any?(area) if kind == :reviewer
else
......
......@@ -40,6 +40,14 @@ describe Gitlab::Danger::Teammate do
it '#maintainer? returns false' do
expect(subject.maintainer?(project, :test, labels)).to be_falsey
end
context 'when hyperlink is mangled in the role' do
let(:role) { '<a href="#">Test Automation Engineer</a>, Create' }
it '#reviewer? returns true' do
expect(subject.reviewer?(project, :test, labels)).to be_truthy
end
end
end
context 'when role is Test Automation Engineer, Manage' do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册