1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reuse the view_context from the controller, this make the test environment more similar to the code applications uses

This commit is contained in:
Santiago Pastorino 2011-01-12 16:44:56 -02:00
parent 6ddabaa90c
commit daada51d10

View file

@ -156,11 +156,8 @@ 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, @controller._helpers
view = @controller.view_context
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