Sha256: 967846cf3e7ca1d5f82c1b4958dbfc66a745282bd45427278eb26c68df3430fd

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

class Travis::Deploy::Config
  describe Builder do
    let(:env) { 'staging' }
    let(:config) { "staging:\n  foo: bar" }
    let(:keychain) { stub(:keychain, source: @config || config) }
    let(:builder) { Builder.new(keychain, env) }

    it 'loads config for given env' do
      builder.build.should == { 'foo' => 'bar' }
    end

    it 'includes files specified at a top level' do
      @config = YAML.dump 'includes' => ['pusher'], 'staging' => { 'foo' => 'bar' }
      pusher_config = {
        'all' => { 'bar' => 'baz', 'baz' => 'should be overwritten' },
        'staging' => { 'baz' => 'qux' },
        'development' => { 'no' => 'no' }
      }
      keychain.should_receive(:includes).with('pusher').and_return(pusher_config)

      builder.build.should == { 'foo' => 'bar', 'bar' => 'baz', 'baz' => 'qux' }
    end

    it 'includes files specified for an env' do
      @config = YAML.dump 'staging' => { 'foo' => 'bar', 'includes' => ['pusher'] },
                          'production' => { 'includes' => ['encryption'] }

      pusher_config = {
        'all' => { 'bar' => 'baz', 'baz' => 'should be overwritten' },
        'staging' => { 'baz' => 'qux' },
        'development' => { 'no' => 'no' }
      }
      keychain.should_receive(:includes).with('pusher').and_return(pusher_config)

      builder.build.should == { 'foo' => 'bar', 'bar' => 'baz', 'baz' => 'qux' }

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
travis-deploy-0.2.1 spec/travis/deploy/config/builder_spec.rb
travis-deploy-0.2.0 spec/travis/deploy/config/builder_spec.rb