Sha256: ea4d293929deca45be40c496621a33fec86419d2019c98311e9c98cac5d3e6e0

Contents?: true

Size: 1.41 KB

Versions: 91

Compression:

Stored size: 1.41 KB

Contents

describe KnapsackPro::Config::CI::Codeship 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 environment exists' do
      let(:env) { { 'CI_BUILD_NUMBER' => 2013 } }
      it { should eql 2013 }
    end

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

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

    context 'when environment exists' do
      let(:env) { { 'CI_COMMIT_ID' => 'a22aec3ee5d334fd658da35646b42bc5' } }
      it { should eql 'a22aec3ee5d334fd658da35646b42bc5' }
    end

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

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

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

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

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

    it { should be nil }
  end
end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
knapsack_pro-4.0.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.11.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.10.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.9.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.8.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.7.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.6.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.5.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.4.2 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.4.1 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.4.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.3.1 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.3.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.2.1 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.2.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.1.3 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.1.2 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.1.1 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.1.0 spec/knapsack_pro/config/ci/codeship_spec.rb
knapsack_pro-3.0.0 spec/knapsack_pro/config/ci/codeship_spec.rb