Sha256: d64915f141b633b64246d603ece6e666a32240981d6f8d2056fe0b56638bd59c

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

require 'spec_helper'

describe Evrone::CI::Worker::DockerBeforeScript, run_docker: true do
  let(:exit_code)   { 0 }
  let(:app)         { ->(_) { exit_code } }
  let(:script)      { "echo before_script" }
  let(:job)         { create :job, before_script: script }
  let(:env)         { OpenStruct.new job: job }
  let(:mid)         { described_class.new app }
  let(:docker_mid)  { Evrone::CI::Worker::DockerStartContainer.new(mid) }

  subject { docker_mid.call env }

  before do
    stub(env).docker_repo_dir { '/tmp' }
  end

  it "should be" do
    expect(subject).to eq 0
    expect(job.output).to match("before_script")
  end

  context "when fail to execute" do
    let(:script) { "/bin/false" }
    it "should be" do
      expect(subject).to eq(-1)
    end
  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/docker_before_script_spec.rb