diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-03-07 16:53:26 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-03-07 16:53:26 +0300 |
commit | fb4a486605e10692b5577f0700fbce38bebcc311 (patch) | |
tree | 975d06a93f4904ae55f4ebc8350b2cb70b7b2b1f /spec/lib/gitlab/ci/build/step_spec.rb | |
parent | 7a774d1a59d7b24b8247e4d67a453388a41c648a (diff) | |
parent | 32b09b8847955052765895063297181835c45b8c (diff) |
Merge branch 'feature/runner-jobs-v4-api' into 'master'
Feature/runner jobs v4 api
Closes #28513
See merge request !9273
Diffstat (limited to 'spec/lib/gitlab/ci/build/step_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/build/step_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/build/step_spec.rb b/spec/lib/gitlab/ci/build/step_spec.rb new file mode 100644 index 00000000000..2a314a744ca --- /dev/null +++ b/spec/lib/gitlab/ci/build/step_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +describe Gitlab::Ci::Build::Step do + let(:job) { create(:ci_build, :no_options, commands: "ls -la\ndate") } + + describe '#from_commands' do + subject { described_class.from_commands(job) } + + it 'fabricates an object' do + expect(subject.name).to eq(:script) + expect(subject.script).to eq(['ls -la', 'date']) + expect(subject.timeout).to eq(job.timeout) + expect(subject.when).to eq('on_success') + expect(subject.allow_failure).to be_falsey + end + end + + describe '#from_after_script' do + subject { described_class.from_after_script(job) } + + context 'when after_script is empty' do + it 'doesn not fabricate an object' do + is_expected.to be_nil + end + end + + context 'when after_script is not empty' do + let(:job) { create(:ci_build, options: { after_script: "ls -la\ndate" }) } + + it 'fabricates an object' do + expect(subject.name).to eq(:after_script) + expect(subject.script).to eq(['ls -la', 'date']) + expect(subject.timeout).to eq(job.timeout) + expect(subject.when).to eq('always') + expect(subject.allow_failure).to be_truthy + end + end + end +end |