Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/ci/build/rules/rule/clause/changes_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/build/rules/rule/clause/changes_spec.rb19
1 files changed, 16 insertions, 3 deletions
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' }