Sha256: e03bb4f1db53dff619c34b9f8f1bcd251296af01f786484ed11a78364fbb170b

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Travis::Deploy::Config do
  let(:shell)  { Mock::Shell.new }
  let(:config) { "staging:\n  foo: bar" }

  before :each do
    Travis::Deploy::Config.any_instance.stub(:clean? => true)
    Travis::Deploy::Config.any_instance.stub(:run)
    Travis::Keychain.any_instance.stub(:source => config)
    File.stub(:open)
  end

  describe 'sync' do
    it 'fetches the config from the keychain' do
      command = Travis::Deploy::Config.new(shell, 'staging', {})
      command.send(:keychain).should_receive(:source).and_return(config)
      command.invoke
    end

    it 'writes the config to the local config file' do
      command = Travis::Deploy::Config.new(shell, 'staging', {})
      File.should_receive(:open).with { |path, mode| path =~ %r(config/travis.yml) }
      command.invoke
    end

    it 'pushes the config to the given heroku remote' do
      command = Travis::Deploy::Config.new(shell, 'staging', {})
      command.should_receive(:run).with { |cmd, options| cmd =~ /heroku config:add travis_config=.* -r staging/m }
      command.invoke
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
travis-deploy-0.2.1 spec/travis/deploy/config_spec.rb
travis-deploy-0.2.0 spec/travis/deploy/config_spec.rb