Sha256: 178a773382a24ac71433d1e17a2477e1a0fe3f3554ec59f1a8eef9ba57d89adb

Contents?: true

Size: 1006 Bytes

Versions: 5

Compression:

Stored size: 1006 Bytes

Contents

require 'test_helper'
require 'role_based_authorization'

class AuthorizationLoggerTest < ActiveSupport::TestCase
  def setup
    @logger = AuthorizationLogger.new(nil)
  end
  
  
  test "Should include the log prefix string to each log entry" do
    assert_match /#{AuthorizationLogger::AUTHORIZATION_SYSTEM_LOG_MSG_PREFIX}/, @logger.format_message(:info, Time.now, "progname", "msg")
  end

  test "Should include the current time in the db format" do
    time = Time.now
    assert_match /#{time.to_s(:db)}/, @logger.format_message(:info, time, "progname", "msg")
  end
  
  test "Should include the log level" do
    assert_match /INFO/, @logger.format_message('INFO', Time.now, "progname", "msg")    
  end


  test "Should include the output msg" do
    assert_match /msg/, @logger.format_message('INFO', Time.now, "progname", "msg")    
  end
  
  test "Should not include the program name" do
    assert ! /progname/.match(@logger.format_message('INFO', Time.now, "progname", "msg"))
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
role_based_authorization-0.2.1 test/authorization_logger_test.rb
role_based_authorization-0.2.0 test/authorization_logger_test.rb
role_based_authorization-0.1.16 test/authorization_logger_test.rb
role_based_authorization-0.1.15 test/authorization_logger_test.rb
role_based_authorization-0.1.14 test/authorization_logger_test.rb