Skip to content

Commit

Permalink
Allow view helper's #initialize method to be called. [#5061 state:res…
Browse files Browse the repository at this point in the history
…olved]
  • Loading branch information
Carl Lerche committed Sep 13, 2010
1 parent 4eb8987 commit 84d0c30
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion actionpack/lib/action_view/test_case.rb
Expand Up @@ -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!
Expand All @@ -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
Expand Down
13 changes: 13 additions & 0 deletions actionpack/test/template/test_case_test.rb
Expand Up @@ -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.