Permalink
Browse files

Allow view helper's #initialize method to be called. [#5061 state:res…

…olved]
  • Loading branch information...
1 parent 4eb8987 commit 84d0c30cea243f020aa7437a2f0313a9b3f13ec4 Carl Lerche committed Sep 13, 2010
Showing with 18 additions and 1 deletion.
  1. +5 −1 actionpack/lib/action_view/test_case.rb
  2. +13 −0 actionpack/test/template/test_case_test.rb
@@ -74,6 +74,11 @@ def helper_class
@helper_class ||= determine_default_helper_class(name)
end
+ def new(*)
+ include_helper_modules!
+ super
+ end
+
private
def include_helper_modules!
@@ -89,7 +94,6 @@ def setup_with_controller
@output_buffer = ActiveSupport::SafeBuffer.new
@rendered = ''
- self.class.send(:include_helper_modules!)
make_test_case_available_to_view!
say_no_to_protect_against_forgery!
end
@@ -253,4 +253,17 @@ class RenderTemplateTest < ActionView::TestCase
end
end
end
+
+ module AHelperWithInitialize
+ def initialize(*)
+ super
+ @called_initialize = true
+ end
+ end
+
+ class AHelperWithInitializeTest < ActionView::TestCase
+ test "the helper's initialize was actually called" do
+ assert @called_initialize
+ end
+ end
end

0 comments on commit 84d0c30

Please sign in to comment.