Sha256: 81c83b4a581747e2c5937946a1f8c43d1cc18eecb4aebe1b7b30c9cc67bf680f

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

module Vedeu

  describe 'Bindings' do
    it { Vedeu.bound?(:_log_).must_equal(true) }
  end

  module Logging

    describe Log do

      let(:described) { Vedeu::Logging::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[37mSome 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[96m[create] \e[39m\e[36mLogging 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[97m[debug]  \e[39m\e[37mLogging to stderr...\e[39m\n"]
          )
        }
      end

    end # Log

  end # Logging

end # Vedeu

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vedeu-0.6.61 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.60 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.59 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.58 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.57 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.56 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.54 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.53 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.52 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.51 test/lib/vedeu/logging/log_test.rb
vedeu-0.6.50 test/lib/vedeu/logging/log_test.rb