diff options
-rw-r--r-- | lib/gitlab/danger/teammate.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/danger/teammate_spec.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/danger/teammate.rb b/lib/gitlab/danger/teammate.rb index b44f134f2c1..74cbcc11255 100644 --- a/lib/gitlab/danger/teammate.rb +++ b/lib/gitlab/danger/teammate.rb @@ -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 diff --git a/spec/lib/gitlab/danger/teammate_spec.rb b/spec/lib/gitlab/danger/teammate_spec.rb index 6a6cf1429c8..171f2344e82 100644 --- a/spec/lib/gitlab/danger/teammate_spec.rb +++ b/spec/lib/gitlab/danger/teammate_spec.rb @@ -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 |