Sha256: bcc6dcd4ff5fbdd7d9d5c82c8a5e8b452c2778ca26ed48b508ca428d795b5b40

Contents?: true

Size: 747 Bytes

Versions: 22

Compression:

Stored size: 747 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "The Logger" do
  before(:each) do
    @stdout_orig  = $stdout
    $stdout       = StringIO.new

    @stderr_orig  = $stderr
    $stderr       = StringIO.new
  end

  context "Reporting an error" do
    it "should output a formatted message with a red color" do
      Pullentity::Client::Logger.error("This is failing.")
      $stderr.string.should == "\e[1m\e[31mThis is failing.\e[0m\e[0m\n"
    end
  end

  context "Reporting back a success" do
    it "should output a formatted message with a green color" do
      Pullentity::Client::Logger.report("This is a success.")
      $stdout.string.should == "\e[1m\e[32mThis is a success.\e[0m\e[0m\n"
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pullentity-client-0.0.2 spec/pullentity-client/logger_spec.rb
pullentity-client-0.0.1 spec/pullentity-client/logger_spec.rb