From d6fec21d1affe069686d681964d208a4b0df7182 Mon Sep 17 00:00:00 2001 From: David Chelimsky Date: Tue, 25 May 2010 23:46:00 -0500 Subject: In AV::TC, move protect_against_forgery? from the test_case to the _helper module included in the view. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- actionpack/test/template/test_case_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index a34bca8145..16e5ee4f72 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -122,6 +122,21 @@ module ActionView helper_method :from_test_case end + class IgnoreProtectAgainstForgeryTest < ActionView::TestCase + module HelperThatInvokesProtectAgainstForgery + def help_me + protect_against_forgery? + end + end + + helper HelperThatInvokesProtectAgainstForgery + + test "protect_from_forgery? in any helpers returns false" do + assert !_view.help_me + end + + end + class ATestHelperTest < ActionView::TestCase include SharedTests test_case = self -- cgit v1.2.3