Sha256: a14f727ea689920978e8629ffe0d094d4066bc2ec6b6b692d9a82c7954bff4a3

Contents?: true

Size: 906 Bytes

Versions: 48

Compression:

Stored size: 906 Bytes

Contents

require 'test_helper'

class LogTest < ActiveSupport::TestCase

  def setup
    @io = StringIO.new
  end

  test 'output is always set' do
    assert Incline::Log::get_output
  end

  test 'output can be changed' do
    begin
      Incline::Log::set_output @io
      assert_equal @io, Incline::Log::get_output

      Incline::Log::debug   'This is a debug message.'
      Incline::Log::info    'This is an informative message.'
      Incline::Log::warn    'This is a warning message.'
      Incline::Log::error   'This is an error message.'

      assert @io.string =~ /DEBUG/
      assert @io.string =~ /INFO/
      assert @io.string =~ /WARN/
      assert @io.string =~ /ERROR/

    ensure
      Incline::Log::set_output false
    end
    assert_not_equal @io, Incline::Log::get_output
    Incline::Log::info 'If you see this, everything is OK.'
    assert_not @io.string =~ /everything is OK/
  end

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
incline-0.3.14 test/lib/log_test.rb
incline-0.3.13 test/lib/log_test.rb
incline-0.3.12 test/lib/log_test.rb
incline-0.3.11 test/lib/log_test.rb
incline-0.3.10 test/lib/log_test.rb
incline-0.3.9 test/lib/log_test.rb
incline-0.3.8 test/lib/log_test.rb
incline-0.3.7 test/lib/log_test.rb
incline-0.3.6 test/lib/log_test.rb
incline-0.3.5 test/lib/log_test.rb
incline-0.3.4 test/lib/log_test.rb
incline-0.3.3 test/lib/log_test.rb
incline-0.3.2 test/lib/log_test.rb
incline-0.3.1 test/lib/log_test.rb
incline-0.3.0 test/lib/log_test.rb
incline-0.2.36 test/lib/log_test.rb
incline-0.2.35 test/lib/log_test.rb
incline-0.2.34 test/lib/log_test.rb
incline-0.2.28 test/lib/log_test.rb
incline-0.2.27 test/lib/log_test.rb