diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 09:06:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-26 09:06:27 +0300 |
commit | 9735395f94088df7e6470e3e8a2638385ede36b6 (patch) | |
tree | fbd42e043d05dbc78872b0458baac3a216ea232e /spec/lib/gitlab/ci | |
parent | 33586a7aa128171b1bbc9380648b6945b09f5e2d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r-- | spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb b/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb index c016216304a..3605bac7dfc 100644 --- a/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb +++ b/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb @@ -4,11 +4,24 @@ require 'spec_helper' describe Gitlab::Ci::Build::Rules::Rule::Clause::Exists do describe '#satisfied_by?' do + let(:pipeline) { build(:ci_pipeline, project: project, sha: project.repository.head_commit.sha) } + + subject { described_class.new(globs).satisfied_by?(pipeline, nil) } + it_behaves_like 'a glob matching rule' do let(:project) { create(:project, :custom_repo, files: files) } - let(:pipeline) { build(:ci_pipeline, project: project, sha: project.repository.head_commit.sha) } + end + + context 'after pattern comparision limit is reached' do + let(:globs) { ['*definitely_not_a_matching_glob*'] } + let(:project) { create(:project, :repository) } + + before do + stub_const('Gitlab::Ci::Build::Rules::Rule::Clause::Exists::MAX_PATTERN_COMPARISONS', 2) + expect(File).to receive(:fnmatch?).exactly(2).times.and_call_original + end - subject { described_class.new(globs).satisfied_by?(pipeline, nil) } + it { is_expected.to be_truthy } end end end |