Browse files

Pass extensions to javascript_path and stylesheet_path helpers. Closes

  • Loading branch information...
1 parent 6d5a27a commit b7c7f08c87a848d28a2d0b515a6d51b0e141deed @spastorino spastorino committed Jan 3, 2012
View
4 actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -64,12 +64,12 @@ def image_path(source)
alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_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
View
6 actionpack/test/template/sprockets_helper_test.rb
@@ -144,6 +144,9 @@ def config
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},
@@ -152,6 +155,9 @@ def config
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},

0 comments on commit b7c7f08

Please sign in to comment.