diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-03-06 19:00:27 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-03-11 15:37:29 +0300 |
commit | 7f0ec9d8cec37e73c8f17d3a70686da495e18ec5 (patch) | |
tree | d48b3943ee4587caf92f1a14ef354f89e0e33f04 /spec/lib/gitlab/danger | |
parent | 97357c5bb6594be793c1af332bed8f942f2d72d2 (diff) |
Support multiple roulette roles per project
Diffstat (limited to 'spec/lib/gitlab/danger')
-rw-r--r-- | spec/lib/gitlab/danger/teammate_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/lib/gitlab/danger/teammate_spec.rb b/spec/lib/gitlab/danger/teammate_spec.rb new file mode 100644 index 00000000000..4bc0a4c1398 --- /dev/null +++ b/spec/lib/gitlab/danger/teammate_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +describe Gitlab::Danger::Teammate do + subject { described_class.new({ 'projects' => projects }) } + let(:projects) { { project => capabilities } } + let(:project) { double } + + describe 'multiple roles project project' do + let(:capabilities) { ['reviewer backend', 'maintainer frontend', 'trainee_maintainer database'] } + + it '#reviewer? supports multiple roles per project' do + expect(subject.reviewer?(project, 'backend')).to be_truthy + end + + it '#traintainer? supports multiple roles per project' do + expect(subject.traintainer?(project, 'database')).to be_truthy + end + + it '#maintainer? supports multiple roles per project' do + expect(subject.maintainer?(project, 'frontend')).to be_truthy + end + end + + describe 'one role project project' do + let(:capabilities) { 'reviewer backend' } + + it '#reviewer? supports one role per project' do + expect(subject.reviewer?(project, 'backend')).to be_truthy + end + + it '#traintainer? supports one role per project' do + expect(subject.traintainer?(project, 'database')).to be_falsey + end + + it '#maintainer? supports one role per project' do + expect(subject.maintainer?(project, 'frontend')).to be_falsey + end + end +end |