summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 12:08:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 12:08:16 +0000
commit1fa79760ad2d4bd67f5c5a27f372a7533b9b7c69 (patch)
treeffdfbd9113743831ff4f1290959a62cf6567fde5 /spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb
parent82fa8a3d1e8466ef36b58604d20fcc145ea12118 (diff)
downloadgitlab-ce-1fa79760ad2d4bd67f5c5a27f372a7533b9b7c69.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb b/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb
new file mode 100644
index 00000000000..06deed11c15
--- /dev/null
+++ b/spec/lib/gitlab/ci/config/entry/inherit/variables_spec.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ::Gitlab::Ci::Config::Entry::Inherit::Variables do
+ using RSpec::Parameterized::TableSyntax
+
+ subject { described_class.new(config) }
+
+ context 'validations' do
+ where(:config, :valid) do
+ true | true
+ false | true
+ %w[A] | true
+ %w[A B] | true
+ %i[image] | true
+ [true] | false
+ "string" | false
+ end
+
+ with_them do
+ it do
+ expect(subject.valid?).to eq(valid)
+ end
+ end
+ end
+
+ describe '#inherit?' do
+ where(:config, :inherit) do
+ true | true
+ false | false
+ %w[A] | true
+ %w[B] | false
+ end
+
+ with_them do
+ it do
+ expect(subject.inherit?('A')).to eq(inherit)
+ end
+ end
+ end
+end