aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/test_case.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-09-29 11:18:31 +0200
committerJosé Valim <jose.valim@gmail.com>2010-09-29 11:18:31 +0200
commit14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5 (patch)
tree7bd869d61e99d58dbd374a5d2ce344139a784551 /actionpack/lib/action_view/test_case.rb
parent0bbf9029e8089356aed0e3be2f859d56951a89cf (diff)
downloadrails-14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5.tar.gz
rails-14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5.tar.bz2
rails-14f9904e0fc6d8a1e5627ac64c4b5b14e95177c5.zip
Avoid (@_var ||= nil) pattern by using initialize methods and ensuring everyone calls super as expected.
Diffstat (limited to 'actionpack/lib/action_view/test_case.rb')
-rw-r--r--actionpack/lib/action_view/test_case.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index de23a67cb6..915c2f90d7 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -20,12 +20,12 @@ module ActionView
end
def initialize
+ super
self.class.controller_path = ""
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@request.env.delete('PATH_INFO')
-
@params = {}
end
end
@@ -156,15 +156,15 @@ module ActionView
# The instance of ActionView::Base that is used by +render+.
def view
@view ||= begin
- view = ActionView::Base.new(ActionController::Base.view_paths, {}, @controller)
- view.singleton_class.send :include, _helpers
- view.singleton_class.send :include, @controller._routes.url_helpers
- view.singleton_class.send :delegate, :alert, :notice, :to => "request.flash"
- view.extend(Locals)
- view.locals = self.locals
- view.output_buffer = self.output_buffer
- view
- end
+ view = ActionView::Base.new(ActionController::Base.view_paths, {}, @controller)
+ view.singleton_class.send :include, _helpers
+ view.singleton_class.send :include, @controller._routes.url_helpers
+ view.singleton_class.send :delegate, :alert, :notice, :to => "request.flash"
+ view.extend(Locals)
+ view.locals = self.locals
+ view.output_buffer = self.output_buffer
+ view
+ end
end
alias_method :_view, :view
@@ -201,7 +201,7 @@ module ActionView
def method_missing(selector, *args)
if @controller.respond_to?(:_routes) &&
- @controller._routes.named_routes.helpers.include?(selector)
+ @controller._routes.named_routes.helpers.include?(selector)
@controller.__send__(selector, *args)
else
super