aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorDavid Chelimsky <dchelimsky@gmail.com>2010-06-08 15:18:02 -0400
committerJosé Valim <jose.valim@gmail.com>2010-06-08 21:25:31 +0200
commitbdcf70cca89df906a3510464ef46a44646fd29a3 (patch)
treedf6f8312491ca8063e5917886811a512dcd45901 /actionpack/lib
parentab2877cbe89e266ee986fc12e603abd93ac017ad (diff)
downloadrails-bdcf70cca89df906a3510464ef46a44646fd29a3.tar.gz
rails-bdcf70cca89df906a3510464ef46a44646fd29a3.tar.bz2
rails-bdcf70cca89df906a3510464ef46a44646fd29a3.zip
Memoize the object returned by _view in ActionView::TestCase::Behavior
[#4799 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/test_case.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index 4dbbd2eb6a..15d424be74 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -131,12 +131,14 @@ module ActionView
end
def _view
- view = ActionView::Base.new(ActionController::Base.view_paths, _assigns, @controller)
- view.singleton_class.send :include, _helpers
- view.singleton_class.send :include, @controller._router.url_helpers
- view.singleton_class.send :delegate, :alert, :notice, :to => "request.flash"
- view.output_buffer = self.output_buffer
- view
+ @_view ||= begin
+ view = ActionView::Base.new(ActionController::Base.view_paths, _assigns, @controller)
+ view.singleton_class.send :include, _helpers
+ view.singleton_class.send :include, @controller._router.url_helpers
+ view.singleton_class.send :delegate, :alert, :notice, :to => "request.flash"
+ view.output_buffer = self.output_buffer
+ view
+ end
end
EXCLUDE_IVARS = %w{