Sha256: 0eba5382d68374ca493a8e02cd7c503feebfd1115b4557e96d538243e38dc6e5

Contents?: true

Size: 1.08 KB

Versions: 19

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

19 entries across 19 versions & 1 rubygems

Version Path
vedeu-0.6.7 test/lib/vedeu/log/log_test.rb
vedeu-0.6.6 test/lib/vedeu/log/log_test.rb
vedeu-0.6.5 test/lib/vedeu/log/log_test.rb
vedeu-0.6.4 test/lib/vedeu/log/log_test.rb
vedeu-0.6.3 test/lib/vedeu/log/log_test.rb
vedeu-0.6.2 test/lib/vedeu/log/log_test.rb
vedeu-0.6.1 test/lib/vedeu/log/log_test.rb
vedeu-0.6.0 test/lib/vedeu/log/log_test.rb
vedeu-0.5.13 test/lib/vedeu/log/log_test.rb
vedeu-0.5.12 test/lib/vedeu/log/log_test.rb
vedeu-0.5.11 test/lib/vedeu/log/log_test.rb
vedeu-0.5.10 test/lib/vedeu/log/log_test.rb
vedeu-0.5.9 test/lib/vedeu/log/log_test.rb
vedeu-0.5.8 test/lib/vedeu/log/log_test.rb
vedeu-0.5.7 test/lib/vedeu/log/log_test.rb
vedeu-0.5.6 test/lib/vedeu/log/log_test.rb
vedeu-0.5.5 test/lib/vedeu/log/log_test.rb
vedeu-0.5.4 test/lib/vedeu/log/log_test.rb
vedeu-0.5.3 test/lib/vedeu/log/log_test.rb