aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-01-03 17:49:11 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2012-01-03 17:50:24 -0200
commitcbe918093b6ad0994cae0fce014c0d987447d9ab (patch)
treea3e80be6f2acb1c91b16f9287a10be20a92eb114 /actionpack
parent180edc84f1bf848dcd25d194d24c3f8c28889603 (diff)
downloadrails-cbe918093b6ad0994cae0fce014c0d987447d9ab.tar.gz
rails-cbe918093b6ad0994cae0fce014c0d987447d9ab.tar.bz2
rails-cbe918093b6ad0994cae0fce014c0d987447d9ab.zip
Pass extensions to javascript_path and stylesheet_path helpers. Closes #3417
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb4
-rw-r--r--actionpack/test/template/sprockets_helper_test.rb6
2 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 177f7f6747..976ae5a76d 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -69,12 +69,12 @@ module Sprockets
alias_method :path_to_font, :font_path # aliased to avoid conflicts with an font_path named route
def javascript_path(source)
- path_to_asset(source)
+ path_to_asset(source, :ext => 'js')
end
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with an javascript_path named route
def stylesheet_path(source)
- path_to_asset(source)
+ path_to_asset(source, :ext => 'css')
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with an stylesheet_path named route
diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb
index fb472cfbe5..1c591bdcc2 100644
--- a/actionpack/test/template/sprockets_helper_test.rb
+++ b/actionpack/test/template/sprockets_helper_test.rb
@@ -158,6 +158,9 @@ class SprocketsHelperTest < ActionView::TestCase
test "javascript_path" do
assert_match %r{/assets/application-[0-9a-f]+.js},
+ javascript_path("application")
+
+ assert_match %r{/assets/application-[0-9a-f]+.js},
javascript_path("application.js")
assert_match %r{/assets/application-[0-9a-f]+.js},
@@ -166,6 +169,9 @@ class SprocketsHelperTest < ActionView::TestCase
test "stylesheet_path" do
assert_match %r{/assets/application-[0-9a-f]+.css},
+ stylesheet_path("application")
+
+ assert_match %r{/assets/application-[0-9a-f]+.css},
stylesheet_path("application.css")
assert_match %r{/assets/application-[0-9a-f]+.css},