diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 17:36:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 17:36:54 +0300 |
commit | f61bb2a16a514b71bf33aabbbb999d6732016a24 (patch) | |
tree | 9548caa89e60b4f40b99bbd1dac030420b812aa8 /spec/finders/repositories | |
parent | 35fc54e5d261f8898e390aea7c2f5ec5fdf0539d (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc42
Diffstat (limited to 'spec/finders/repositories')
-rw-r--r-- | spec/finders/repositories/branch_names_finder_spec.rb | 25 | ||||
-rw-r--r-- | spec/finders/repositories/changelog_tag_finder_spec.rb (renamed from spec/finders/repositories/previous_tag_finder_spec.rb) | 13 |
2 files changed, 36 insertions, 2 deletions
diff --git a/spec/finders/repositories/branch_names_finder_spec.rb b/spec/finders/repositories/branch_names_finder_spec.rb new file mode 100644 index 00000000000..4d8bfcc0f20 --- /dev/null +++ b/spec/finders/repositories/branch_names_finder_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Repositories::BranchNamesFinder do + let(:project) { create(:project, :repository) } + + let(:branch_names_finder) { described_class.new(project.repository, search: 'conflict-*') } + + describe '#execute' do + subject(:execute) { branch_names_finder.execute } + + it 'filters branch names' do + expect(execute).to contain_exactly( + 'conflict-binary-file', + 'conflict-resolvable', + 'conflict-contains-conflict-markers', + 'conflict-missing-side', + 'conflict-start', + 'conflict-non-utf8', + 'conflict-too-large' + ) + end + end +end diff --git a/spec/finders/repositories/previous_tag_finder_spec.rb b/spec/finders/repositories/changelog_tag_finder_spec.rb index b332dd158d1..cd79beb3e9e 100644 --- a/spec/finders/repositories/previous_tag_finder_spec.rb +++ b/spec/finders/repositories/changelog_tag_finder_spec.rb @@ -2,11 +2,18 @@ require 'spec_helper' -RSpec.describe Repositories::PreviousTagFinder do +RSpec.describe Repositories::ChangelogTagFinder do let(:project) { build_stubbed(:project) } let(:finder) { described_class.new(project) } describe '#execute' do + context 'when the regular expression is invalid' do + it 'raises Gitlab::Changelog::Error' do + expect { described_class.new(project, regex: 'foo+*').execute('1.2.3') } + .to raise_error(Gitlab::Changelog::Error) + end + end + context 'when there is a previous tag' do it 'returns the previous tag' do tag1 = double(:tag1, name: 'v1.0.0') @@ -15,10 +22,11 @@ RSpec.describe Repositories::PreviousTagFinder do tag4 = double(:tag4, name: '0.9.0') tag5 = double(:tag5, name: 'v0.8.0-pre1') tag6 = double(:tag6, name: 'v0.7.0') + tag7 = double(:tag7, name: '0.5.0+42.ee.0') allow(project.repository) .to receive(:tags) - .and_return([tag1, tag3, tag2, tag4, tag5, tag6]) + .and_return([tag1, tag3, tag2, tag4, tag5, tag6, tag7]) expect(finder.execute('2.1.0')).to eq(tag3) expect(finder.execute('2.0.0')).to eq(tag2) @@ -26,6 +34,7 @@ RSpec.describe Repositories::PreviousTagFinder do expect(finder.execute('1.0.1')).to eq(tag1) expect(finder.execute('1.0.0')).to eq(tag4) expect(finder.execute('0.9.0')).to eq(tag6) + expect(finder.execute('0.6.0')).to eq(tag7) end end |