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.2.26 test/lib/log_test.rb
incline-0.2.25 test/lib/log_test.rb
incline-0.2.24 test/lib/log_test.rb
incline-0.2.23 test/lib/log_test.rb
incline-0.2.22 test/lib/log_test.rb
incline-0.2.21 test/lib/log_test.rb
incline-0.2.20 test/lib/log_test.rb
incline-0.2.19 test/lib/log_test.rb
incline-0.2.18 test/lib/log_test.rb
incline-0.2.17 test/lib/log_test.rb
incline-0.2.16 test/lib/log_test.rb
incline-0.2.15 test/lib/log_test.rb
incline-0.2.14 test/lib/log_test.rb
incline-0.2.13 test/lib/log_test.rb
incline-0.2.12 test/lib/log_test.rb
incline-0.2.11 test/lib/log_test.rb
incline-0.2.10 test/lib/log_test.rb
incline-0.2.9 test/lib/log_test.rb
incline-0.2.8 test/lib/log_test.rb
incline-0.2.7 test/lib/log_test.rb