diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 18:09:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 18:09:36 +0300 |
commit | 074d013e1eb3f6e0c27f96a3be8b9361254c8a98 (patch) | |
tree | f185c474ddc8624a4793c84b0b1f4cc07349694b /spec/lib/gitlab/danger | |
parent | 8f9beefac3774b30e911fb00a68f4c7a5244cf27 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/danger')
-rw-r--r-- | spec/lib/gitlab/danger/changelog_spec.rb | 50 | ||||
-rw-r--r-- | spec/lib/gitlab/danger/helper_spec.rb | 10 |
2 files changed, 23 insertions, 37 deletions
diff --git a/spec/lib/gitlab/danger/changelog_spec.rb b/spec/lib/gitlab/danger/changelog_spec.rb index 64f87ec8cd3..c61e47f80d9 100644 --- a/spec/lib/gitlab/danger/changelog_spec.rb +++ b/spec/lib/gitlab/danger/changelog_spec.rb @@ -76,10 +76,10 @@ describe Gitlab::Danger::Changelog do context 'added files contain a changelog' do [ - 'changelogs/unreleased/entry.md', - 'ee/changelogs/unreleased/entry.md', - 'changelogs/unreleased-ee/entry.md', - 'ee/changelogs/unreleased-ee/entry.md' + 'changelogs/unreleased/entry.yml', + 'ee/changelogs/unreleased/entry.yml', + 'changelogs/unreleased-ee/entry.yml', + 'ee/changelogs/unreleased-ee/entry.yml' ].each do |file_path| let(:added_files) { [file_path] } @@ -107,46 +107,22 @@ describe Gitlab::Danger::Changelog do end describe '#ee_changelog?' do - context 'is ee changelog' do - [ - 'changelogs/unreleased-ee/entry.md', - 'ee/changelogs/unreleased-ee/entry.md' - ].each do |file_path| - subject { changelog.ee_changelog?(file_path) } + subject { changelog.ee_changelog? } - it { is_expected.to be_truthy } - end + before do + allow(changelog).to receive(:found).and_return(file_path) end - context 'is not ee changelog' do - [ - 'changelogs/unreleased/entry.md', - 'ee/changelogs/unreleased/entry.md' - ].each do |file_path| - subject { changelog.ee_changelog?(file_path) } - - it { is_expected.to be_falsy } - end - end - end + context 'is ee changelog' do + let(:file_path) { 'ee/changelogs/unreleased/entry.yml' } - describe '#ce_port_changelog?' do - where(:helper_ee?, :file_path, :expected) do - true | 'changelogs/unreleased-ee/entry.md' | false - true | 'ee/changelogs/unreleased-ee/entry.md' | false - false | 'changelogs/unreleased-ee/entry.md' | false - false | 'ee/changelogs/unreleased-ee/entry.md' | false - true | 'changelogs/unreleased/entry.md' | true - true | 'ee/changelogs/unreleased/entry.md' | true - false | 'changelogs/unreleased/entry.md' | false - false | 'ee/changelogs/unreleased/entry.md' | false + it { is_expected.to be_truthy } end - with_them do - let(:ee?) { helper_ee? } - subject { changelog.ce_port_changelog?(file_path) } + context 'is not ee changelog' do + let(:file_path) { 'changelogs/unreleased/entry.yml' } - it { is_expected.to eq(expected) } + it { is_expected.to be_falsy } end end end diff --git a/spec/lib/gitlab/danger/helper_spec.rb b/spec/lib/gitlab/danger/helper_spec.rb index 4cb957f378c..d5d582d7d6c 100644 --- a/spec/lib/gitlab/danger/helper_spec.rb +++ b/spec/lib/gitlab/danger/helper_spec.rb @@ -76,6 +76,16 @@ describe Gitlab::Danger::Helper do end end + describe '#all_ee_changes' do + subject { helper.all_ee_changes } + + it 'returns all changed files starting with ee/' do + expect(helper).to receive(:all_changed_files).and_return(%w[fr/ee/beer.rb ee/wine.rb ee/lib/ido.rb ee.k]) + + is_expected.to match_array(%w[ee/wine.rb ee/lib/ido.rb]) + end + end + describe '#ee?' do subject { helper.ee? } |