diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-03 17:03:45 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-01-03 17:05:43 -0200 |
commit | 0d7d3a6e77c7f2f34236459bd1170951ded91bd5 (patch) | |
tree | 08f3614306f583afc37a50407c6fda9d4e3a09ea /actionpack/test | |
parent | eafdf6c9bd22706941456a6bacb9f2fff8d14104 (diff) | |
download | rails-0d7d3a6e77c7f2f34236459bd1170951ded91bd5.tar.gz rails-0d7d3a6e77c7f2f34236459bd1170951ded91bd5.tar.bz2 rails-0d7d3a6e77c7f2f34236459bd1170951ded91bd5.zip |
Add font_path helper method
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf | 0 | ||||
-rw-r--r-- | actionpack/test/fixtures/sprockets/app/fonts/font.ttf | 0 | ||||
-rw-r--r-- | actionpack/test/template/sprockets_helper_test.rb | 20 |
3 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf b/actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf diff --git a/actionpack/test/fixtures/sprockets/app/fonts/font.ttf b/actionpack/test/fixtures/sprockets/app/fonts/font.ttf new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/actionpack/test/fixtures/sprockets/app/fonts/font.ttf diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb index 64fdd53e73..fb472cfbe5 100644 --- a/actionpack/test/template/sprockets_helper_test.rb +++ b/actionpack/test/template/sprockets_helper_test.rb @@ -24,6 +24,7 @@ class SprocketsHelperTest < ActionView::TestCase @assets.append_path(FIXTURES.join("sprockets/app/javascripts")) @assets.append_path(FIXTURES.join("sprockets/app/stylesheets")) @assets.append_path(FIXTURES.join("sprockets/app/images")) + @assets.append_path(FIXTURES.join("sprockets/app/fonts")) application = Struct.new(:config, :assets).new(config, @assets) Rails.stubs(:application).returns(application) @@ -147,6 +148,14 @@ class SprocketsHelperTest < ActionView::TestCase path_to_image("logo.png") end + test "font_path" do + assert_match %r{/assets/font-[0-9a-f]+.ttf}, + font_path("font.ttf") + + assert_match %r{/assets/font-[0-9a-f]+.ttf}, + path_to_font("font.ttf") + end + test "javascript_path" do assert_match %r{/assets/application-[0-9a-f]+.js}, javascript_path("application.js") @@ -186,6 +195,17 @@ class SprocketsHelperTest < ActionView::TestCase asset_path("/images/logo.gif") end + test "font path through asset_path" do + assert_match %r{/assets/font-[0-9a-f]+.ttf}, + asset_path('font.ttf') + + assert_match %r{/assets/dir/font-[0-9a-f]+.ttf}, + asset_path("dir/font.ttf") + + assert_equal "http://www.example.com/fonts/font.ttf", + asset_path("http://www.example.com/fonts/font.ttf") + end + test "javascript path through asset_path" do assert_match %r{/assets/application-[0-9a-f]+.js}, asset_path(:application, :ext => "js") |