diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-30 13:07:48 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-12-30 13:07:48 +0100 |
commit | 4ecdf24bdedfdd1cca1f079259ff2490e2074067 (patch) | |
tree | b31c55a662121d9da270cc47b001b2296f90eedf /actionpack/test | |
parent | 97204fc0bc52af8fb6714e6f9fcd414567e0fc1a (diff) | |
download | rails-4ecdf24bdedfdd1cca1f079259ff2490e2074067.tar.gz rails-4ecdf24bdedfdd1cca1f079259ff2490e2074067.tar.bz2 rails-4ecdf24bdedfdd1cca1f079259ff2490e2074067.zip |
Kick AR logging back to life and move ControllerRuntime inside ActiveRecord::Rails.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/activerecord/controller_runtime_test.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/actionpack/test/activerecord/controller_runtime_test.rb b/actionpack/test/activerecord/controller_runtime_test.rb new file mode 100644 index 0000000000..dd31add4b4 --- /dev/null +++ b/actionpack/test/activerecord/controller_runtime_test.rb @@ -0,0 +1,39 @@ +require 'active_record_unit' +require 'active_record/rails/controller_runtime' +require 'fixtures/project' + +ActionController::Base.send :include, ActiveRecord::Rails::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/, logs[3] + end + + private + def set_logger + @controller.logger = MockLogger.new + end + + def logs + @logs ||= @controller.logger.logged.compact.map {|l| l.to_s.strip} + end +end |