Sha256: 5ce5c3dc1176f3e32e3f6f065bacc4bc16a1bf11a97627ef74c23d28cdaa83f5
Contents?: true
Size: 1.17 KB
Versions: 22
Compression:
Stored size: 1.17 KB
Contents
require 'spec_helper' require 'pathname' require 'fileutils' describe Evrone::CI::Worker::LocalScript do let(:before_script) { "echo before_script" } let(:script) { "echo script" } let(:app) { ->(_) { 0 } } let(:job) { create :job, script: script, before_script: before_script } let(:path_prefix) { Pathname.new "/tmp/.ci" } let(:work_dir) { path_prefix.join("work") } let(:tmp_dir) { path_prefix.join("tmp") } let(:env) { OpenStruct.new job: job, work_dir: work_dir, tmp_dir: tmp_dir } let(:mid) { described_class.new app } subject { mid.call env } after do FileUtils.rm_rf path_prefix end before do FileUtils.mkdir_p work_dir FileUtils.mkdir_p tmp_dir end it { should eq 0 } it "should capture output" do subject job.release expect(last_job_log_message.log).to be_include("before_script\nscript\n") end context "when script failed" do let(:script) { 'false' } it { should satisfy { |n| [1,127].include?(n) } } end context "when before_script failed" do let(:before_script) { 'false' } it { should satisfy { |n| [-1,-127].include?(n) } } end end
Version data entries
22 entries across 22 versions & 1 rubygems