Sha256: 6547f6a51badc62b37203135b60b2530d9e9dc0f3f947c985a9bb15a9ef06c3b
Contents?: true
Size: 897 Bytes
Versions: 1
Compression:
Stored size: 897 Bytes
Contents
require File.expand_path('../../test_helper', __FILE__) module Filum class Worker def self.process Filum.logger.info "Processing" end end class LoggerTest < IntegrationTest def test_one_logline test_thread = Thread.new do Filum.logger.context_id = " [12345]" Worker.process end test_thread.join assert_logged(/\[12345\]/) end def test_multiple_threads test_thread1 = Thread.new do Filum.logger.context_id = " [23456]" Worker.process end test_thread2 = Thread.new do Filum.logger.context_id = " [34567]" Worker.process end test_thread1.join test_thread2.join assert_logged(/\[23456\]/) assert_logged(/\[34567\]/) end def assert_logged(regex) assert File.readlines(Filum.config.logfile).grep(regex).size == 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
filum-0.0.2 | test/integration/logger_test.rb |