Sha256: ae880ab405f12b17ab1fe6107c86d90ecd323d29c88c6018b5610448d5da1874

Contents?: true

Size: 992 Bytes

Versions: 8

Compression:

Stored size: 992 Bytes

Contents

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

describe Vx::Builder::Script::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" 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

8 entries across 8 versions & 1 rubygems

Version Path
vx-builder-0.2.2 spec/lib/builder/script/prepare_spec.rb
vx-builder-0.2.1 spec/lib/builder/script/prepare_spec.rb
vx-builder-0.2.0 spec/lib/builder/script/prepare_spec.rb
vx-builder-0.1.8 spec/lib/builder/script/prepare_spec.rb
vx-builder-0.1.7 spec/lib/builder/script/prepare_spec.rb
vx-builder-0.1.6 spec/lib/builder/script/prepare_spec.rb
vx-builder-0.1.5 spec/lib/builder/script/prepare_spec.rb
vx-builder-0.1.4 spec/lib/builder/script/prepare_spec.rb