Sha256: e4c442d2a17043eb242e4550a74ff2885f0c18dec40d8b1262a7db5e8612983a

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 Bytes

Contents

require 'spec_helper'

describe Evrone::CI::Worker::DockerScript, run_docker: true do
  let(:exit_code)   { 0 }
  let(:app)         { ->(_) { exit_code } }
  let(:script)      { "echo script" }
  let(:job)         { create :job, 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("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_script_spec.rb