Sha256: e9b3d0e72240fa825cc25107da1d887cf939d69c1834c92ec5deca7f65cecc56

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Evrone::CI::Worker::DockerWebdavCache, run_docker: true, webdav: true do
  let(:exit_code)     { 0 }
  let(:app)           {
    ->(env) {
      file = "$HOME/cached/foo.txt"
      cmd = %{
        if [ -f #{file} ] ; then
          echo "!exists" ;
          cat #{file} ;
        else
          echo "!touch" ;
          echo 1 > #{file} ;
        fi
      }.compact
      env.ssh.spawn cmd, &job.method(:add_to_output)
    }
  }
  let(:job)           { create :job }
  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
    Evrone::CI::Worker.config.webdav_cache_url = 'http://192.168.44.1:8080/'
  end

  context "first run" do
    it "should be" do
      expect(subject).to eq 0
    end
  end

  context "next run" do
    before do
      expect(docker_mid.call env).to eq 0
      job.output.clear
    end
    it "should be" do
      expect(subject).to eq 0
      expect(job.output).to match(/\!exists/)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
evrone-ci-worker-0.2.0.pre4 spec/lib/worker/middlewares/docker_webdav_cache_spec.rb
evrone-ci-worker-0.2.0.pre3 spec/lib/worker/middlewares/docker_webdav_cache_spec.rb