Sha256: 38ba3b10a21279a2a45e13f4689af8372a480804b703c2aa724bece8ad13ec27

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

require 'spec_helper'
require 'pathname'
require 'fileutils'

describe Evrone::CI::Worker::LocalScript do
  let(:command)     { "echo script" }
  let(:app)         { ->(_) { 0 } }
  let(:job)         { create :job, script: command }
  let(:work_dir)    { Pathname.new '/tmp/.ci' }
  let(:env)         { OpenStruct.new job: job, work_dir: work_dir }
  let(:mid)         { described_class.new app }

  subject { mid.call env }

  after do
    FileUtils.rm_rf work_dir
  end

  before do
    FileUtils.mkdir_p work_dir
  end

  it { should eq 0 }

  it "should capture output" do
    subject
    expect(job.output).to eq "script\n"
  end

  context "when script failed" do
    let(:command) { '/bin/false' }
    it { should satisfy { |n| [1,127].include?(n) } }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evrone-ci-worker-0.2.0.pre0 spec/lib/worker/middlewares/local_script_spec.rb