aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/test_case.rb
diff options
context:
space:
mode:
authorDavid Chelimsky <dchelimsky@gmail.com>2010-05-25 23:46:00 -0500
committerMikel Lindsaar <raasdnil@gmail.com>2010-06-03 23:32:09 +1000
commitd6fec21d1affe069686d681964d208a4b0df7182 (patch)
treec58ac9162487bdca68342fb2d30730ccfd926378 /actionpack/lib/action_view/test_case.rb
parent70dca37cfd04bd029f9684eb41d6c8658200ff78 (diff)
downloadrails-d6fec21d1affe069686d681964d208a4b0df7182.tar.gz
rails-d6fec21d1affe069686d681964d208a4b0df7182.tar.bz2
rails-d6fec21d1affe069686d681964d208a4b0df7182.zip
In AV::TC, move protect_against_forgery? from the test_case to the
_helper module included in the view. - ensures that protect_against_forgery? is present when a helper included in a partial that is rendered by the template under test calls it (which happens in FormTagHelper#extra_tags_for_form, for example). [#4700 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_view/test_case.rb')
-rw-r--r--actionpack/lib/action_view/test_case.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index e71761db6d..4dbbd2eb6a 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -89,16 +89,13 @@ module ActionView
self.class.send(:include_helper_modules!)
make_test_case_available_to_view!
+ say_no_to_protect_against_forgery!
end
def config
@controller.config if @controller.respond_to?(:config)
end
- def protect_against_forgery?
- false
- end
-
def render(options = {}, local_assigns = {}, &block)
@rendered << output = _view.render(options, local_assigns, &block)
output
@@ -117,6 +114,14 @@ module ActionView
HTML::Document.new(@rendered.blank? ? @output_buffer : @rendered).root
end
+ def say_no_to_protect_against_forgery!
+ _helpers.module_eval do
+ def protect_against_forgery?
+ false
+ end
+ end
+ end
+
def make_test_case_available_to_view!
test_case_instance = self
_helpers.module_eval do