diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/activerecord/controller_runtime_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/activerecord/controller_runtime_test.rb b/actionpack/test/activerecord/controller_runtime_test.rb index 1df826fe2b..368bec1c70 100644 --- a/actionpack/test/activerecord/controller_runtime_test.rb +++ b/actionpack/test/activerecord/controller_runtime_test.rb @@ -8,6 +8,8 @@ ActionController::Base.send :include, ActiveRecord::Railties::ControllerRuntime class ControllerRuntimeLogSubscriberTest < ActionController::TestCase class LogSubscriberController < ActionController::Base + respond_to :html + def show render :inline => "<%= Project.all %>" end @@ -16,6 +18,12 @@ class ControllerRuntimeLogSubscriberTest < ActionController::TestCase render :inline => "Zero DB runtime" end + def create + ActiveRecord::LogSubscriber.runtime += 100 + project = Project.last + respond_with(project, location: url_for(action: :show)) + end + def redirect Project.all redirect_to :action => 'show' @@ -64,6 +72,12 @@ class ControllerRuntimeLogSubscriberTest < ActionController::TestCase assert_match(/\(Views: [\d.]+ms \| ActiveRecord: 0.0ms\)/, @logger.logged(:info)[1]) end + def test_log_with_active_record_when_post + post :create + wait + assert_match(/ActiveRecord: ([1-9][\d.]+)ms\)/, @logger.logged(:info)[2]) + end + def test_log_with_active_record_when_redirecting get :redirect wait |