Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Reuse the view_context from the controller, this make the test enviro…

…nment more similar to the code applications uses
  • Loading branch information...
commit daada51d1051948c3e6de963a90c4b5bb5bf142b 1 parent 6ddabaa
Santiago Pastorino spastorino authored
Showing with 1 addition and 4 deletions.
  1. +1 −4 actionpack/lib/action_view/test_case.rb
5 actionpack/lib/action_view/test_case.rb
@@ -156,11 +156,8 @@ def _render_partial(options)
# The instance of ActionView::Base that is used by +render+.
def view
@view ||= begin
- view =, {}, @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.locals = self.locals
view.output_buffer = self.output_buffer

1 comment on commit daada51

Dmytrii Nagirniak

Pretty sure that this commit breaks tests.

Especially the RSpec ones.
This is happening because of @controller is nil before running the view specs.

See more at rspec/rspec-rails#833 (comment)

Would that be rails' problem or RSpec's and what would be the best way to workaround it?

Please sign in to comment.
Something went wrong with that request. Please try again.