blob: 9525dd830724eead87a8d7a49c756fda45ed895d (
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
|
require 'active_record_unit'
require 'active_record/railties/controller_runtime'
require 'fixtures/project'
ActionController::Base.send :include, ActiveRecord::Railties::ControllerRuntime
class ARLoggingController < ActionController::Base
def show
render :inline => "<%= Project.all %>"
end
end
class ARLoggingTest < ActionController::TestCase
tests ARLoggingController
def setup
super
set_logger
end
def wait
ActiveSupport::Notifications.notifier.wait
end
def test_log_with_active_record
# Wait pending notifications to be published
wait
get :show
wait
assert_match /ActiveRecord runtime/, @controller.logger.logged[3]
end
private
def set_logger
@controller.logger = MockLogger.new
end
end
|