Sha256: a241d2b3f528a8ec092a752e35a926fbba727f2e0bc8456754ba2ce9da10b0ac

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Travis::Keychain do
  let(:shell)    { stub('shell', :say => nil, :error => nil) }
  let(:keychain) { Travis::Keychain.new('hub', shell) }

  before :each do
    keychain.stub(:system => true)
    keychain.stub(:`)
    keychain.stub(:clean? => true)
    File.stub(:read)
  end

  def fetch
    capture_stdout do
      keychain.fetch
    end
  end

  describe 'fetch' do
    it 'changes to the keychain directory' do
      Dir.should_receive(:chdir).with { |path| path =~ %r(/travis-keychain$) }
      fetch
    end

    it 'errors if the working directory is dirty' do
      keychain.stub(:clean? => false)
      keychain.should_receive(:error).with('There are unstaged changes in your travis-keychain working directory.')
      fetch
    end

    it 'pulls changes from origin' do
      keychain.should_receive(:run).with('git pull')
      fetch
    end

    it 'reads the configuration' do
      File.should_receive(:read).with { |path| path =~ %r(config/travis.hub.yml$) }
      fetch
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
travis-deploy-0.2.1 spec/travis/keychain_spec.rb
travis-deploy-0.2.0 spec/travis/keychain_spec.rb
travis-deploy-0.1.0 spec/travis/keychain_spec.rb