summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/yaml_processor_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-25 15:09:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-25 15:09:28 +0000
commit35e5a7c8455f916bc969ec814c74cefd98d24f19 (patch)
tree4207bc732ad87cc5666c8ce446502f2d68860c4e /spec/lib/gitlab/ci/yaml_processor_spec.rb
parent89474d2468f108c909e440efcbe2ce9f7090d19a (diff)
downloadgitlab-ce-35e5a7c8455f916bc969ec814c74cefd98d24f19.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci/yaml_processor_spec.rb')
-rw-r--r--spec/lib/gitlab/ci/yaml_processor_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb
index 5de813f7739..fee3731c662 100644
--- a/spec/lib/gitlab/ci/yaml_processor_spec.rb
+++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb
@@ -870,6 +870,38 @@ module Gitlab
end
end
end
+
+ describe "hooks" do
+ context 'when it is a simple script' do
+ let(:config) do
+ {
+ test: { script: ["script"],
+ hooks: { pre_get_sources_script: ["echo 1", "echo 2", "pwd"] } }
+ }
+ end
+
+ it "returns hooks in options" do
+ expect(subject[:options][:hooks]).to eq(
+ { pre_get_sources_script: ["echo 1", "echo 2", "pwd"] }
+ )
+ end
+ end
+
+ context 'when it is nested arrays of strings' do
+ let(:config) do
+ {
+ test: { script: ["script"],
+ hooks: { pre_get_sources_script: [[["global script"], "echo 1"], "echo 2", ["ls"], "pwd"] } }
+ }
+ end
+
+ it "returns hooks in options" do
+ expect(subject[:options][:hooks]).to eq(
+ { pre_get_sources_script: ["global script", "echo 1", "echo 2", "ls", "pwd"] }
+ )
+ end
+ end
+ end
end
describe "Image and service handling" do