diff options
author | wycats <wycats@gmail.com> | 2010-04-03 02:30:06 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-04-03 02:44:02 -0700 |
commit | 3eb97531b8650db5cc7b9558cc3828c56a526b6a (patch) | |
tree | 70f28e707c552b3be295fff52ab387e901698825 /actionpack/lib/action_view/test_case.rb | |
parent | 13004d4f849682772060371273fda3312dd3b884 (diff) | |
download | rails-3eb97531b8650db5cc7b9558cc3828c56a526b6a.tar.gz rails-3eb97531b8650db5cc7b9558cc3828c56a526b6a.tar.bz2 rails-3eb97531b8650db5cc7b9558cc3828c56a526b6a.zip |
Refactored url_for in AV to have its own instances of the helpers instead of proxying back to the controller. This potentially allows for more standalone usage of AV. It also kicked up a lot of dust in the tests, which were mocking out controllers to get this behavior. By moving it to the view, it made a lot of the tests more standalone (a win)
Diffstat (limited to 'actionpack/lib/action_view/test_case.rb')
-rw-r--r-- | actionpack/lib/action_view/test_case.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index 23b0c6e121..ddea9cfd92 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -142,8 +142,13 @@ module ActionView end end + def _router + @controller._router if @controller.respond_to?(:_router) + end + def method_missing(selector, *args) - if @controller._router.named_routes.helpers.include?(selector) + if @controller.respond_to?(:_router) && + @controller._router.named_routes.helpers.include?(selector) @controller.__send__(selector, *args) else super |