aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-07-22 22:19:17 +0200
committerYves Senn <yves.senn@gmail.com>2014-07-22 22:19:17 +0200
commit74a157ac5f0955ce3472ddeca578a9f2d69b0a98 (patch)
treefa2e26b1c51507d10689bb986725ad496eb7b547 /actionpack/lib
parent1db00698da05558f3ed48a9d1dce6ca0996c056e (diff)
parentd14f64699715d24a7ceb33e6ef8fa14127716c24 (diff)
downloadrails-74a157ac5f0955ce3472ddeca578a9f2d69b0a98.tar.gz
rails-74a157ac5f0955ce3472ddeca578a9f2d69b0a98.tar.bz2
rails-74a157ac5f0955ce3472ddeca578a9f2d69b0a98.zip
Merge pull request #16234 from tgxworld/fix_template_assertion_for_integration_test
Fix AC::TemplateAssertions instance variables not resetting.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/test_case.rb12
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb1
2 files changed, 8 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index a18c35e3e9..657924a16c 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -13,10 +13,7 @@ module ActionController
end
def setup_subscriptions
- @_partials = Hash.new(0)
- @_templates = Hash.new(0)
- @_layouts = Hash.new(0)
- @_files = Hash.new(0)
+ reset_template_assertion
@_subscribers = []
@_subscribers << ActiveSupport::Notifications.subscribe("render_template.action_view") do |_name, _start, _finish, _id, payload|
@@ -56,10 +53,15 @@ module ActionController
end
def process(*args)
+ reset_template_assertion
+ super
+ end
+
+ def reset_template_assertion
@_partials = Hash.new(0)
@_templates = Hash.new(0)
@_layouts = Hash.new(0)
- super
+ @_files = Hash.new(0)
end
# Asserts that the request was rendered with the appropriate template file or partials.
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index cb2cb10870..12b796b95f 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -329,6 +329,7 @@ module ActionDispatch
xml_http_request xhr get_via_redirect post_via_redirect).each do |method|
define_method(method) do |*args|
reset! unless integration_session
+ reset_template_assertion
# reset the html_document variable, but only for new get/post calls
@html_document = nil unless method == 'cookies' || method == 'assigns'
integration_session.__send__(method, *args).tap do