diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/lib/gitlab/danger/helper_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/danger/helper_spec.rb')
-rw-r--r-- | spec/lib/gitlab/danger/helper_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/gitlab/danger/helper_spec.rb b/spec/lib/gitlab/danger/helper_spec.rb index f400641706d..a8f113a8cd1 100644 --- a/spec/lib/gitlab/danger/helper_spec.rb +++ b/spec/lib/gitlab/danger/helper_spec.rb @@ -33,6 +33,16 @@ RSpec.describe Gitlab::Danger::Helper do expect(helper.gitlab_helper).to eq(fake_gitlab) end end + + context 'when danger gitlab plugin is not available' do + it 'returns nil' do + invalid_danger = Class.new do + include Gitlab::Danger::Helper + end.new + + expect(invalid_danger.gitlab_helper).to be_nil + end + end end describe '#release_automation?' do @@ -591,4 +601,30 @@ RSpec.describe Gitlab::Danger::Helper do expect(helper.prepare_labels_for_mr([])).to eq('') end end + + describe '#has_ci_changes?' do + context 'when .gitlab/ci is changed' do + it 'returns true' do + expect(helper).to receive(:all_changed_files).and_return(%w[migration.rb .gitlab/ci/test.yml]) + + expect(helper.has_ci_changes?).to be_truthy + end + end + + context 'when .gitlab-ci.yml is changed' do + it 'returns true' do + expect(helper).to receive(:all_changed_files).and_return(%w[migration.rb .gitlab-ci.yml]) + + expect(helper.has_ci_changes?).to be_truthy + end + end + + context 'when neither .gitlab/ci/ or .gitlab-ci.yml is changed' do + it 'returns false' do + expect(helper).to receive(:all_changed_files).and_return(%w[migration.rb nested/.gitlab-ci.yml]) + + expect(helper.has_ci_changes?).to be_falsey + end + end + end end |