Sha256: f34fc1dad07dd02882b91ebb59ccdb28004ed5603016d175f8ebbf81314b7574

Contents?: true

Size: 1.15 KB

Versions: 36

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe SimpleDeploy do

  before do
    @logger_mock = mock 'logger'
  end

  context "with new logger" do
    before do
      @logger_mock.should_receive(:datetime_format=).with '%Y-%m-%dT%H:%M:%S%z'
      @logger_mock.should_receive(:formatter=)
      @logger_mock.should_receive(:level=).with 1
      Logger.should_receive(:new).with(STDOUT).and_return @logger_mock
    end

    it "should create a new logger object when one is not passed" do
      @logger = SimpleDeploy::SimpleDeployLogger.new
      @logger_mock.should_receive(:info).with 'a message'
      @logger.info 'a message'
    end

    it "accept puts with msg and pass it to debug" do
      @logger = SimpleDeploy::SimpleDeployLogger.new
      @logger_mock.should_receive(:debug).with 'a message'
      @logger.puts 'a message'
    end

    it "tty? return false" do
      @logger = SimpleDeploy::SimpleDeployLogger.new
      @logger.tty?.should be_false
    end
  end

  it "should create a new logger object from the hash passed as :logger" do
    Logger.should_receive(:new).exactly(0).times
    @logger = SimpleDeploy::SimpleDeployLogger.new :logger => @logger_mock
  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
simple_deploy-0.7.6.beta.1 spec/logger_spec.rb
simple_deploy-0.7.5 spec/logger_spec.rb
simple_deploy-0.7.4 spec/logger_spec.rb
simple_deploy-0.7.3 spec/logger_spec.rb
simple_deploy-0.7.2 spec/logger_spec.rb
simple_deploy-0.7.2.beta.1 spec/logger_spec.rb
simple_deploy-0.7.1 spec/logger_spec.rb
simple_deploy-0.7.0 spec/logger_spec.rb
simple_deploy-0.6.7 spec/logger_spec.rb
simple_deploy-0.6.6 spec/logger_spec.rb
simple_deploy-0.6.5 spec/logger_spec.rb
simple_deploy-0.6.4 spec/logger_spec.rb
simple_deploy-0.6.3 spec/logger_spec.rb
simple_deploy-0.6.2 spec/logger_spec.rb
simple_deploy-0.6.1 spec/logger_spec.rb
simple_deploy-0.6.0 spec/logger_spec.rb