summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-16 18:46:18 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-16 19:22:48 +0200
commitb340b59743e8cd47fc1f4fa2020b400d82bfd86e (patch)
treeb5944d4dc7fc09b2c158d3853f05b1c12d119a02 /spec/lib
parent8c9cc6d26c2936b6f759979fa959fdca88e282a7 (diff)
downloadgitlab-ce-b340b59743e8cd47fc1f4fa2020b400d82bfd86e.tar.gz
Implement finally_script which allows to do cleanups as part of the build process
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/ci/gitlab_ci_yaml_processor_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
index dcb8a3451bd..8e373ae55b0 100644
--- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
@@ -286,6 +286,28 @@ module Ci
end
end
+
+ describe "Scripts handling" do
+ let(:config_data) { YAML.dump(config) }
+ let(:config_processor) { GitlabCiYamlProcessor.new(config_data, path) }
+
+ subject { config_processor.builds_for_stage_and_ref("test", "master").first }
+
+ describe "finally_script" do
+ context "in global context" do
+ let(:config) {
+ {
+ finally_script: ["finally_script"],
+ test: { script: ["script"] }
+ }
+ }
+
+ it "return finally_script in options" do
+ expect(subject[:options][:finally_script]).to eq(["finally_script"])
+ end
+ end
+ end
+ end
describe "Image and service handling" do
it "returns image and service when defined" do
@@ -607,6 +629,13 @@ EOT
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "before_script should be an array of strings")
end
+ it "returns errors if finally_script parameter is invalid" do
+ config = YAML.dump({ finally_script: "bundle update", rspec: { script: "test" } })
+ expect do
+ GitlabCiYamlProcessor.new(config, path)
+ end.to raise_error(GitlabCiYamlProcessor::ValidationError, "finally_script should be an array of strings")
+ end
+
it "returns errors if image parameter is invalid" do
config = YAML.dump({ image: ["test"], rspec: { script: "test" } })
expect do