Sha256: 98f6b42bbaf4bf99e40b1542a0fff8dd16ce4a18b8c021b16ba977081d0ce4ce

Contents?: true

Size: 1.73 KB

Versions: 39

Compression:

Stored size: 1.73 KB

Contents

describe KnapsackPro::Config::CI::Travis 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) { { 'TRAVIS_BUILD_NUMBER' => 4 } }
      it { should eql 4 }
    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) { { 'TRAVIS_COMMIT' => '3fa64859337f6e56409d49f865d13fd7' } }
      it { should eql '3fa64859337f6e56409d49f865d13fd7' }
    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) { { 'TRAVIS_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) { { 'TRAVIS_BUILD_DIR' => '/home/travis/build/KnapsackPro/rails-app-with-knapsack_pro' } }
      it { should eql '/home/travis/build/KnapsackPro/rails-app-with-knapsack_pro' }
    end

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

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
knapsack_pro-7.13.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.12.1 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.12.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.11.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.10.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.9.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.8.2 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.8.1 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.8.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.7.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.6.2 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.6.1 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.6.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.1.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.0.1 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-7.0.0 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-6.0.4 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-6.0.3 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-6.0.2 spec/knapsack_pro/config/ci/travis_spec.rb
knapsack_pro-6.0.1 spec/knapsack_pro/config/ci/travis_spec.rb