Sha256: f11d27cbd7b11710e11371f6c680c47366e2af668f882272645e0a9ca9e8bccf

Contents?: true

Size: 1010 Bytes

Versions: 16

Compression:

Stored size: 1010 Bytes

Contents

require 'spec_helper'
require 'tmpdir'
require 'fileutils'

describe Vx::Builder::ScriptBuilder::Prepare do
  let(:app)    { ->(_) { 0 } }
  let(:script) { described_class.new app }
  let(:env)    { create :env }
  let(:run)    { script.call env }
  let(:path)   { Dir.tmpdir }
  subject { run }

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

  it { should eq 0 }

  context "run it", git: true do
    let(:command) { create :command_from_env, env: env }
    before { run }

    context "success" do
      it "should return zero code" do
        Dir.chdir(path) do
          system( command )
        end
        expect($?.to_i).to eq 0
      end
    end

    context "with github pull request" do
      let(:env) { create :env, task: create(:task, pull_request_id: 1) }
      context "success" do
        it "should return zero code" do
          Dir.chdir(path) do
            system( command )
          end
          expect($?.to_i).to eq 0
        end
      end
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
vx-builder-0.4.0 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.14 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.13 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.12 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.11 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.10 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.9 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.8 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.7 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.6 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.5 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.4 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.3 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.2 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.1 spec/lib/builder/script_builder/prepare_spec.rb
vx-builder-0.3.0 spec/lib/builder/script_builder/prepare_spec.rb