Sha256: 119e77952a9d037e7f7184a9dd96e100a00308b1f2c5c3d51f43829d21691db7

Contents?: true

Size: 1.68 KB

Versions: 15

Compression:

Stored size: 1.68 KB

Contents

describe KnapsackPro::Config::CI::AppVeyor do
  let(:env) { {} }

  before do
    stub_const('ENV', env)
  end

  it { should be_kind_of KnapsackPro::Config::CI::Base }

  describe '#node_total' do
    subject { described_class.new.node_total }

    it { should be nil }
  end

  describe '#node_index' do
    subject { described_class.new.node_index }

    it { should be nil }
  end

  describe '#node_build_id' do
    subject { described_class.new.node_build_id }

    context 'when the environment exists' do
      let(:env) { { 'APPVEYOR_BUILD_ID' => 123 } }
      it { should eql 123 }
    end

    context "when the environment doesn't exist" do
      it { should be nil }
    end
  end

  describe '#commit_hash' do
    subject { described_class.new.commit_hash }

    context 'when the environment exists' do
      let(:env) { { 'APPVEYOR_REPO_COMMIT' => '2e13512fc230d6f9ebf4923352718e4d' } }
      it { should eql '2e13512fc230d6f9ebf4923352718e4d' }
    end

    context "when the environment doesn't exist" do
      it { should be nil }
    end
  end

  describe '#branch' do
    subject { described_class.new.branch }

    context 'when the environment exists' do
      let(:env) { { 'APPVEYOR_REPO_BRANCH' => 'master' } }
      it { should eql 'master' }
    end

    context "when the environment doesn't exist" do
      it { should be nil }
    end
  end

  describe '#project_dir' do
    subject { described_class.new.project_dir }

    context 'when the environment exists' do
      let(:env) { { 'APPVEYOR_BUILD_FOLDER' => '/path/to/clone/repo' } }
      it { should eql '/path/to/clone/repo' }
    end

    context "when the environment doesn't exist" do
      it { should be nil }
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
knapsack_pro-5.4.1 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.4.0 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.3.5 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.3.4 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.3.3 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.3.2 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.3.1 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.3.0 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.2.1 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.2.0 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.1.2 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.1.1 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.1.0 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-5.0.0 spec/knapsack_pro/config/ci/app_veyor_spec.rb
knapsack_pro-4.1.0 spec/knapsack_pro/config/ci/app_veyor_spec.rb