From a7b3560714b4d9cc4ab32dffcd1f74a284b93580 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 18 Feb 2022 09:45:46 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-8-stable-ee --- .../gitlab/ci/build/rules/rule/clause/changes_spec.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'spec/lib/gitlab/ci/build/rules/rule/clause/changes_spec.rb') diff --git a/spec/lib/gitlab/ci/build/rules/rule/clause/changes_spec.rb b/spec/lib/gitlab/ci/build/rules/rule/clause/changes_spec.rb index 532c83f6768..4ac8bf61738 100644 --- a/spec/lib/gitlab/ci/build/rules/rule/clause/changes_spec.rb +++ b/spec/lib/gitlab/ci/build/rules/rule/clause/changes_spec.rb @@ -4,14 +4,23 @@ require 'spec_helper' RSpec.describe Gitlab::Ci::Build::Rules::Rule::Clause::Changes do describe '#satisfied_by?' do + subject { described_class.new(globs).satisfied_by?(pipeline, context) } + it_behaves_like 'a glob matching rule' do let(:pipeline) { build(:ci_pipeline) } + let(:context) {} before do allow(pipeline).to receive(:modified_paths).and_return(files.keys) end + end - subject { described_class.new(globs).satisfied_by?(pipeline, nil) } + context 'when pipeline is nil' do + let(:pipeline) {} + let(:context) {} + let(:globs) { [] } + + it { is_expected.to be_truthy } end context 'when using variable expansion' do @@ -20,8 +29,6 @@ RSpec.describe Gitlab::Ci::Build::Rules::Rule::Clause::Changes do let(:globs) { ['$HELM_DIR/**/*'] } let(:context) { double('context') } - subject { described_class.new(globs).satisfied_by?(pipeline, context) } - before do allow(pipeline).to receive(:modified_paths).and_return(modified_paths) end @@ -32,6 +39,12 @@ RSpec.describe Gitlab::Ci::Build::Rules::Rule::Clause::Changes do it { is_expected.to be_falsey } end + context 'when modified paths are nil' do + let(:modified_paths) {} + + it { is_expected.to be_truthy } + end + context 'when context has the specified variables' do let(:variables_hash) do { 'HELM_DIR' => 'helm' } -- cgit v1.2.1