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/test/template/asset_tag_helper_test.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/test/template/asset_tag_helper_test.rb')
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index fbd504ae7d..223a430f92 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -34,9 +34,7 @@ class AssetTagHelperTest < ActionView::TestCase ) end - @controller = Class.new(BasicController) do - def url_for(*args) "http://www.example.com" end - end.new + @controller = BasicController.new @request = Class.new do def protocol() 'http://' end @@ -49,6 +47,10 @@ class AssetTagHelperTest < ActionView::TestCase ActionView::Helpers::AssetTagHelper::reset_javascript_include_default end + def url_for(*args) + "http://www.example.com" + end + def teardown config.perform_caching = false ENV.delete('RAILS_ASSET_ID') @@ -893,25 +895,19 @@ class AssetTagHelperNonVhostTest < ActionView::TestCase def setup super - @controller = Class.new(BasicController) do - def url_for(options) - "http://www.example.com/collaboration/hieraki" - end - end.new - + @controller = BasicController.new @controller.config.relative_url_root = "/collaboration/hieraki" - @request = Class.new do - def protocol - 'gopher://' - end - end.new - + @request = Struct.new(:protocol).new("gopher://") @controller.request = @request ActionView::Helpers::AssetTagHelper::reset_javascript_include_default end + def url_for(options) + "http://www.example.com/collaboration/hieraki" + end + def test_should_compute_proper_path assert_dom_equal(%(<link href="http://www.example.com/collaboration/hieraki" rel="alternate" title="RSS" type="application/rss+xml" />), auto_discovery_link_tag) assert_dom_equal(%(/collaboration/hieraki/javascripts/xmlhr.js), javascript_path("xmlhr")) |