Sha256: d5de30330a9bed202751ec94a1e22f485b380a13bd33c1866ee1f2ff4380e421

Contents?: true

Size: 768 Bytes

Versions: 1

Compression:

Stored size: 768 Bytes

Contents

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

describe Evrone::CI::Worker::LocalBeforeScript do
  let(:command)     { "echo before_script" }
  let(:app)         { ->(_) { 0 } }
  let(:job)         { create :job, before_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 "before_script\n"
  end

  context "when script failed" do
    let(:command) { '/bin/false' }
    it { should eq(-1) }
  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_before_script_spec.rb