blob: 6f30bec8eefd6452d2b4e95bcf29bc17dda2bb1e (
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
|
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
get :show
wait
assert_match /ActiveRecord runtime/, @controller.logger.logged[3]
end
private
def set_logger
@controller.logger = MockLogger.new
end
end
|