aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-02-27 11:47:24 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-02-27 11:47:24 -0300
commit02037c3ea0614103793137aab932060d2123537c (patch)
tree66805a4a71367992e30265fc62a0b21faf069f0b /actionpack
parentab876893cfb77dcd760b34628a1a1152c9a448d8 (diff)
parentdd0bbd2ccb9c813902ae263dd4cc21f85af0bdc4 (diff)
downloadrails-02037c3ea0614103793137aab932060d2123537c.tar.gz
rails-02037c3ea0614103793137aab932060d2123537c.tar.bz2
rails-02037c3ea0614103793137aab932060d2123537c.zip
Merge pull request #9218 from Fivell/master
Fix calculation of db_runtime property in ActiveRecord::Railties::ControllerRuntime#cleanup_view_runtime. Previously, after raising ActionView::MissingTemplate, db_runtime was not populated. Closes #9218, Fixes #9215. Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/activerecord/controller_runtime_test.rb14
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