Sha256: 563add5ccf3bcc2bdd8754cd147b0bdea8b9d4255c0c234a053a1911acaeed33

Contents?: true

Size: 1.32 KB

Versions: 21

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Shuttle::Helpers do
  class Klass ; include Shuttle::Helpers ; end
  let(:subject) { Klass.new }

  it { should respond_to :log }
  it { should respond_to :error }
  it { should respond_to :git_installed? }
  it { should respond_to :svn_installed? }
  it { should respond_to :release_exists? }
  it { should respond_to :stream_output }

  describe '#log' do
    it 'prints a formatted message' do
      STDOUT.should_receive(:puts).with("\e[1m\e[32m----->\e[0m message")
      subject.log('message')
    end
  end

  describe '#error' do
    before { subject.stub(:version).and_return(1) }

    it 'prints an error message' do
      STDOUT.should_receive(:puts).with("\e[1m\e[31m----->\e[0m ERROR: message")
      STDOUT.should_receive(:puts).with("\e[1m\e[31m----->\e[0m Release v1 aborted")

      expect { subject.error('message') }.to raise_error Shuttle::DeployError
    end

    it 'raises a deploy error' do
      STDOUT.stub(:puts)
      expect { subject.error('message') }.to raise_error Shuttle::DeployError, 'message'
    end
  end

  describe '#stream_output' do
    let(:string) { "line1\nline2\nline3\n\n" }

    it 'prints a formatted string' do
      result = "       line1\n       line2\n       line3"
      STDOUT.should_receive(:puts).with(result)
      subject.stream_output(string)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
shuttle-deploy-0.2.0.beta5 spec/helpers_spec.rb