Skip to content

Commit

Permalink
Pass extensions to javascript_path and stylesheet_path helpers. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jan 3, 2012
1 parent 6d5a27a commit b7c7f08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/sprockets/helpers/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions actionpack/test/template/sprockets_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def config
end

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")

Expand All @@ -151,6 +154,9 @@ def config
end

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")

Expand Down

0 comments on commit b7c7f08

Please sign in to comment.