diff options
| author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-08 11:02:26 +0200 |
|---|---|---|
| committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-18 13:17:47 +0200 |
| commit | a1363d39c6fe79d830dbce468c02880d2a5d7996 (patch) | |
| tree | 62dff2b35c5032f896ab8414f21982e200fa49ca /spec/lib | |
| parent | e32fc7567be2ff2cc995648e675de18133f8a066 (diff) | |
| download | gitlab-ce-a1363d39c6fe79d830dbce468c02880d2a5d7996.tar.gz | |
Add `variables` keyword to job in CI config YAML
Diffstat (limited to 'spec/lib')
| -rw-r--r-- | spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 44 |
1 files changed, 32 insertions, 12 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..a3a0d06e149 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -346,19 +346,39 @@ module Ci end describe "Variables" do - it "returns variables when defined" do - variables = { - var1: "value1", - var2: "value2", - } - config = YAML.dump({ - variables: variables, - before_script: ["pwd"], - rspec: { script: "rspec" } - }) + context 'when global variables are defined' do + it 'returns variables' do + variables = { + var1: "value1", + var2: "value2", + } + config = YAML.dump({ + variables: variables, + before_script: ["pwd"], + rspec: { script: "rspec" } + }) - config_processor = GitlabCiYamlProcessor.new(config, path) - expect(config_processor.variables).to eq(variables) + config_processor = GitlabCiYamlProcessor.new(config, path) + expect(config_processor.variables).to eq(variables) + end + end + + context 'when job variables are defined' do + let(:job_variables) { { KEY1: 'value1', SOME_KEY_2: 'value2'} } + let(:yaml_config) do + YAML.dump( + { before_script: ['pwd'], + rspec: { + variables: job_variables, + script: 'rspec' } + }) + end + + it 'appends job variable to job attributes' do + config = GitlabCiYamlProcessor.new(yaml_config, path) + + expect(config.builds.first[:options][:variables]).to eq job_variables + end end end |
