Sha256: 0fc95ced5ed265e5e8972b58846b24a86000244eae6ec8dd272d7bb2ff335ce1
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
require File.expand_path("../spec_helper", __FILE__) module Danger describe Danger::DangerGitlabReviewbot do it "should be a plugin" do expect(Danger::DangerGitlabReviewbot.new(nil)).to be_a Danger::Plugin end # # You should test your custom attributes and methods here # describe "with Dangerfile" do before do testing_env.each { |k,v| ENV[k] = "#{v}" } @dangerfile = testing_dangerfile @plugin = @dangerfile.gitlab_reviewbot @plugin.strategy = Danger::AssignStrategies::RandomStrategy @strategy_mock = instance_double(Danger::AssignStrategies::Strategy) allow(Danger::AssignStrategies::RandomStrategy).to receive(:new).and_return(@strategy_mock) end it "Assign one reviewer" do @plugin.gitlab_group = 'tech/ios' expect(@strategy_mock).to receive(:assign!).with(1).and_return(['Sam']) @plugin.assign! end it "Assign one reviewer" do @plugin.gitlab_group = 'tech/ios' expect(@strategy_mock).to receive(:assign!).with(1).and_return(['Sam']) @plugin.assign! end it "Assign multiple reviewers" do @plugin.gitlab_group = 'tech/ios' @plugin.assignees_amount = 2 expect(@strategy_mock).to receive(:assign!).with(2).and_return(['Sam, Nic']) @plugin.assign! end ['CI_PROJECT_ID', 'CI_MERGE_REQUEST_IID'].each do |var| it "Fails when required #{var} variables are not available" do ENV[var] = nil expect{@plugin.assign!}.to raise_error(RuntimeError) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danger-gitlab_reviewbot-1.1.0 | spec/gitlab_reviewbot_spec.rb |
danger-gitlab_reviewbot-1.0.2 | spec/gitlab_reviewbot_spec.rb |