Class: TestUnintializedLogger

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/webconsole/logger/test/tc_logger.rb

Instance Method Summary collapse

Instance Method Details

#teardownObject



28
29
30
31
# File 'lib/webconsole/logger/test/tc_logger.rb', line 28

def teardown
  WebConsole::Tests::Helper::quit
  assert(!WebConsole::Tests::Helper::is_running, "The application should not be running.")
end

#test_uninitialized_loggerObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/webconsole/logger/test/tc_logger.rb', line 33

def test_uninitialized_logger
  logger = WebConsole::Logger.new

  # Test Message
  message = "Testing log message"
  logger.info(message)
  sleep WebConsole::Tests::TEST_PAUSE_TIME # Pause for output to be processed

  # Make sure the log messages before accessing the logger's `view_id` and `window_id` because those run the logger.
  # This test should test logging a message and running the logger itself simultaneously.
  # This is why the `TestViewHelper` is intialized after logging the message.
  test_view_helper = TestViewHelper.new(logger.window_id, logger.view_id)

  test_message = test_view_helper.last_log_message
  assert_equal(message, test_message, "The messages should match")
  test_class = test_view_helper.last_log_class
  assert_equal("message", test_class, "The classes should match")

end