aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/test_case.rb
diff options
context:
space:
mode:
authorDavid Chelimsky <dchelimsky@gmail.com>2010-06-23 10:19:13 -0500
committerJosé Valim <jose.valim@gmail.com>2010-06-23 17:45:48 +0200
commit32b8be95331928990a61a43023a343a0583b53c7 (patch)
treec91f79873ea73ce7aeb59da7cd86ace089abbfee /actionpack/lib/action_view/test_case.rb
parent0e0df4b0c5df7fdd1daa5653c255c4737f5526fc (diff)
downloadrails-32b8be95331928990a61a43023a343a0583b53c7.tar.gz
rails-32b8be95331928990a61a43023a343a0583b53c7.tar.bz2
rails-32b8be95331928990a61a43023a343a0583b53c7.zip
Expose view via the view() method in AV::TestCase::Behavior
- was exposed as _view, which suggested it was private - left _view as an alias of view as not to break any extensions that are relying on _view [#4932 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_view/test_case.rb')
-rw-r--r--actionpack/lib/action_view/test_case.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index 5abc59507f..757e4cf77c 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -99,8 +99,8 @@ module ActionView
end
def render(options = {}, local_assigns = {}, &block)
- _view.assign(_assigns)
- @rendered << output = _view.render(options, local_assigns, &block)
+ view.assign(_assigns)
+ @rendered << output = view.render(options, local_assigns, &block)
output
end
@@ -146,8 +146,9 @@ module ActionView
end
end
- def _view
- @_view ||= begin
+ # 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._router.url_helpers
@@ -159,10 +160,11 @@ module ActionView
end
end
+ alias_method :_view, :view
+
EXCLUDE_IVARS = %w{
@_assertion_wrapped
@_result
- @_view
@controller
@layouts
@locals
@@ -174,6 +176,7 @@ module ActionView
@routes
@templates
@test_passed
+ @view
@view_context_class
}