blob: fa9430436da76ffa89d35e0e978d08b4db5fdaf7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
require 'helper'
require "active_support/log_subscriber/test_helper"
class AdapterTest < ActiveSupport::TestCase
include ActiveSupport::LogSubscriber::TestHelper
include ActiveSupport::Logger::Severity
def setup
super
$BUFFER = []
@old_logger = ActiveJob::Base.logger
ActiveJob::Base.logger = @logger
ActiveJob::Logging::LogSubscriber.attach_to :active_job
end
def teardown
super
ActiveJob::Logging::LogSubscriber.log_subscribers.pop
ActiveJob::Base.logger = @old_logger
end
def set_logger(logger)
ActiveJob::Base.logger = logger
end
def test_enqueue_job_logging
HelloJob.enqueue "Cristian"
assert_match(/Enqueued HelloJob to .*?:.*Cristian/, @logger.logged(:info).join)
end
def test_perform_job_logging
HelloJob.enqueue "Cristian"
assert_match(/Performed HelloJob from .*?:.*Cristian/, @logger.logged(:info).join)
end
def test_enqueue_at_job_logging
HelloJob.enqueue_at 1, "Cristian"
assert_match(/Enqueued HelloJob to .*? at.*Cristian/, @logger.logged(:info).join)
rescue NotImplementedError
skip
end
def test_enqueue_in_job_logging
HelloJob.enqueue_in 2, "Cristian"
assert_match(/Enqueued HelloJob to .*? at.*Cristian/, @logger.logged(:info).join)
rescue NotImplementedError
skip
end
end
|