Sha256: 56d60455af74af7e433868c37f491d6692d7db92222114e61e5921ffb7e8e5d8

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

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

describe Evrone::CI::Router::Middleware::FetchSource do
  let(:path_prefix) { '/tmp/.test' }
  let(:build)       { create :build, options }
  let(:options)     { {} }
  let(:repo_dir)    { Pathname.new '/tmp/.test' }
  let(:app)         { ->(_) { 0 } }
  let(:env)         { OpenStruct.new build: build, repo_dir: repo_dir }
  subject           { described_class.new(app).call env }

  before { FileUtils.rm_rf(repo_dir) }
  after { FileUtils.rm_rf(repo_dir) }

  it "should checkout repo" do
    expect(subject).to eq 0
    expect(File.directory? "/tmp/.test/.git").to be
  end

  context "when failed" do
    let(:options) { { src: "/not-exists.git" } }
    it { should eq(-1) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evrone-ci-router-0.2.0.pre0 spec/lib/middleware/fetch_source_spec.rb