Sha256: c57d130afa4ce01d8bd61dad7dff4e707d061ee71a05af45986a4dd19cef64eb
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' require 'pathname' require 'fileutils' describe Evrone::CI::Worker::LocalFetchRepo do let(:exit_code) { 0 } let(:app) { ->(_) { exit_code } } let(:job) { create :job } let(:path_prefix) { Pathname.new("/tmp/.ci") } let(:repo_dir) { path_prefix.join("repo") } let(:work_dir) { path_prefix.join("work") } let(:env) { OpenStruct.new job: job, repo_dir: repo_dir, work_dir: work_dir } let(:mid) { described_class.new app } subject { mid.call env } after do FileUtils.rm_rf path_prefix end it { should eq 0 } it "should create repo inside repo_dir" do subject expect(File.directory? "/tmp/.ci/repo/.git" ).to be end it "should create copy of repo inside work_dir" do subject expect(File.readable? "/tmp/.ci/work/Gemfile").to be end context "when fetch failed" do before do any_instance_of(Evrone::CI::SCM::Git) do |git| mock(git).fetch { 1 } end end it { should eq(-1) } end context "when export failed" do before do any_instance_of(Evrone::CI::SCM::Git) do |git| mock(git).fetch { 0 } end any_instance_of(described_class) do |m| mock(m).export(anything, anything) { 1 } end end it { should eq(-1) } end end
Version data entries
4 entries across 4 versions & 1 rubygems