diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-13 15:04:12 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-13 15:04:12 +0200 |
commit | 036e297ca3c39f90aebc76d5acb2e01f32364d0d (patch) | |
tree | e1d6c96804c28e7fe6693759d8124ae080557865 /spec/lib | |
parent | 6920390aad683dcc73109be5a23b647c918f9309 (diff) | |
download | gitlab-ce-036e297ca3c39f90aebc76d5acb2e01f32364d0d.tar.gz |
Expose CI job commands and use in legacy processor
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ci/config/node/global_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/node/job_spec.rb | 3 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/node/jobs_spec.rb | 11 |
3 files changed, 19 insertions, 7 deletions
diff --git a/spec/lib/gitlab/ci/config/node/global_spec.rb b/spec/lib/gitlab/ci/config/node/global_spec.rb index 3ffbe9c2e97..f46359f7ee6 100644 --- a/spec/lib/gitlab/ci/config/node/global_spec.rb +++ b/spec/lib/gitlab/ci/config/node/global_spec.rb @@ -23,7 +23,7 @@ describe Gitlab::Ci::Config::Node::Global do after_script: ['make clean'], stages: ['build', 'pages'], cache: { key: 'k', untracked: true, paths: ['public/'] }, - rspec: { script: 'rspec' }, + rspec: { script: %w[rspec ls] }, spinach: { script: 'spinach' } } end @@ -129,8 +129,14 @@ describe Gitlab::Ci::Config::Node::Global do describe '#jobs' do it 'returns jobs configuration' do expect(global.jobs) - .to eq(rspec: { script: %w[rspec], stage: 'test' }, - spinach: { script: %w[spinach], stage: 'test' }) + .to eq(rspec: { before_script: %w[ls pwd], + script: %w[rspec ls], + commands: "ls\npwd\nrspec\nls", + stage: 'test' }, + spinach: { before_script: %w[ls pwd], + script: %w[spinach], + commands: "ls\npwd\nspinach", + stage: 'test' }) end end end diff --git a/spec/lib/gitlab/ci/config/node/job_spec.rb b/spec/lib/gitlab/ci/config/node/job_spec.rb index 635362611a0..816c0f275d6 100644 --- a/spec/lib/gitlab/ci/config/node/job_spec.rb +++ b/spec/lib/gitlab/ci/config/node/job_spec.rb @@ -56,6 +56,7 @@ describe Gitlab::Ci::Config::Node::Job do expect(entry.value) .to eq(before_script: %w[ls pwd], script: %w[rspec], + commands: "ls\npwd\nrspec", stage: 'test', after_script: %w[cleanup]) end @@ -114,7 +115,7 @@ describe Gitlab::Ci::Config::Node::Job do end it 'returns correct script' do - expect(entry.before_script).to eq [] + expect(entry.before_script).to be_nil end end end diff --git a/spec/lib/gitlab/ci/config/node/jobs_spec.rb b/spec/lib/gitlab/ci/config/node/jobs_spec.rb index 255646a001a..60ab1d2150d 100644 --- a/spec/lib/gitlab/ci/config/node/jobs_spec.rb +++ b/spec/lib/gitlab/ci/config/node/jobs_spec.rb @@ -1,7 +1,8 @@ require 'spec_helper' describe Gitlab::Ci::Config::Node::Jobs do - let(:entry) { described_class.new(config, global: spy) } + let(:entry) { described_class.new(config, global: global) } + let(:global) { double('global', before_script: nil, stages: %w[test]) } describe 'validations' do before do @@ -62,8 +63,12 @@ describe Gitlab::Ci::Config::Node::Jobs do describe '#value' do it 'returns key value' do expect(entry.value) - .to eq(rspec: { script: %w[rspec], stage: 'test' }, - spinach: { script: %w[spinach], stage: 'test' }) + .to eq(rspec: { script: %w[rspec], + commands: 'rspec', + stage: 'test' }, + spinach: { script: %w[spinach], + commands: 'spinach', + stage: 'test' }) end end |