Sha256: 30f1e2bbf586d35e031937bbbdbb80a34bfedbb779bc4eb3af3e935ecf52d9ab

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

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

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

  subject { described_class.new app }

  before { FileUtils.rm_rf path_prefix }
  after { FileUtils.rm_rf path_prefix }

  context "call" do
    subject{ described_class.new(app).call env }
    it { should eq 0 }

    it "should create and assign to env repo_dir" do
      subject
      expect(env.repo_dir.to_s).to eq '/tmp/.test/repo'
      expect(File.directory? env.repo_dir).to be
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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