diff options
author | Joshua Peek <josh@joshpeek.com> | 2012-10-13 10:13:47 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2012-10-13 10:13:47 -0500 |
commit | 60a4fffd83e94ad4471570b16f9d954f04bc0300 (patch) | |
tree | 8652a0bc3d0fe388d9be1419c5fa1fedd2a228bb /actionpack/test/template | |
parent | 5dfeb1b852c6c4a7b9c4aa3fa8dc5f25b516f9f1 (diff) | |
download | rails-60a4fffd83e94ad4471570b16f9d954f04bc0300.tar.gz rails-60a4fffd83e94ad4471570b16f9d954f04bc0300.tar.bz2 rails-60a4fffd83e94ad4471570b16f9d954f04bc0300.zip |
Allow asset url config to be undefined
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 5dc854d561..8435db3166 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -733,3 +733,44 @@ class AssetUrlHelperControllerTest < ActionView::TestCase assert_equal "http://www.example.com/foo", @controller.asset_url("foo") end end + +class AssetUrlHelperEmptyModuleTest < ActionView::TestCase + tests ActionView::Helpers::AssetUrlHelper + + def setup + super + + @module = Module.new + @module.extend ActionView::Helpers::AssetUrlHelper + end + + def test_asset_path + assert_equal "/foo", @module.asset_path("foo") + end + + def test_asset_url + assert_equal "/foo", @module.asset_url("foo") + end + + def test_asset_url_with_request + @module.instance_eval do + def request + Struct.new(:base_url, :script_name).new("http://www.example.com", nil) + end + end + + assert @module.request + assert_equal "http://www.example.com/foo", @module.asset_url("foo") + end + + def test_asset_url_with_config_asset_host + @module.instance_eval do + def config + Struct.new(:asset_host).new("http://www.example.com") + end + end + + assert @module.config.asset_host + assert_equal "http://www.example.com/foo", @module.asset_url("foo") + end +end |