Sha256: b40094bf103fad2933acddf8fc0048a93964becb61fe89ed720c9702558a48e8

Contents?: true

Size: 1.08 KB

Versions: 31

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

module Vedeu

  describe Log do

    let(:described) { Vedeu::Log }
    let(:_message)  { 'Some message...' }
    let(:force)     { false }
    let(:type)      { :info }

    describe '.log' do
      subject { described.log(message: _message, force: force, type: type) }

      it { subject.must_equal(
        ["\e[97m[info]   \e[39m", "\e[39mSome message...\e[39m"]
      ) }
    end

    describe '.log_stdout' do
      let(:type)     { :create }
      let(:_message) { 'Logging to stdout...' }

      subject { described.log_stdout(type: type, message: _message) }

      it {
        capture_io { subject }.must_equal(
          ["\e[92m[create] \e[39m\e[32mLogging to stdout...\e[39m\n", ""]
        )
      }
    end

    describe '.log_stdout' do
      let(:type)     { :debug }
      let(:_message) { 'Logging to stderr...' }

      subject { described.log_stderr(type: type, message: _message) }

      it {
        capture_io { subject }.must_equal(
          ["", "\e[91m[debug]  \e[39m\e[31mLogging to stderr...\e[39m\n"]
        )
      }
    end

  end # Log

end # Vedeu

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
vedeu-0.5.2 test/lib/vedeu/log/log_test.rb
vedeu-0.5.1 test/lib/vedeu/log/log_test.rb
vedeu-0.5.0 test/lib/vedeu/log/log_test.rb
vedeu-0.4.65 test/lib/vedeu/log_test.rb
vedeu-0.4.64 test/lib/vedeu/log_test.rb
vedeu-0.4.63 test/lib/vedeu/log_test.rb
vedeu-0.4.62 test/lib/vedeu/log_test.rb
vedeu-0.4.61 test/lib/vedeu/log_test.rb
vedeu-0.4.60 test/lib/vedeu/log_test.rb
vedeu-0.4.59 test/lib/vedeu/log_test.rb
vedeu-0.4.58 test/lib/vedeu/log_test.rb
vedeu-0.4.57 test/lib/vedeu/log_test.rb
vedeu-0.4.56 test/lib/vedeu/log_test.rb
vedeu-0.4.55 test/lib/vedeu/log_test.rb
vedeu-0.4.54 test/lib/vedeu/support/log_test.rb
vedeu-0.4.53 test/lib/vedeu/support/log_test.rb
vedeu-0.4.52 test/lib/vedeu/support/log_test.rb
vedeu-0.4.51 test/lib/vedeu/support/log_test.rb
vedeu-0.4.50 test/lib/vedeu/support/log_test.rb
vedeu-0.4.49 test/lib/vedeu/support/log_test.rb