aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb2
-rw-r--r--actionpack/test/template/sprockets_helper_test.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 51f0cbb2da..243c2e5e50 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -163,7 +163,7 @@ module Sprockets
source
elsif source_ext.blank?
"#{source}.#{ext}"
- elsif exact_match_present?(source)
+ elsif File.exists?(source) || exact_match_present?(source)
source
else
"#{source}.#{ext}"
diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb
index 93832c7bd9..7d5ac39d15 100644
--- a/actionpack/test/template/sprockets_helper_test.rb
+++ b/actionpack/test/template/sprockets_helper_test.rb
@@ -277,6 +277,15 @@ class SprocketsHelperTest < ActionView::TestCase
assert_nothing_raised { javascript_include_tag('foo.min') }
end
+ test "assets that exist on filesystem don't need to go through Sprockets" do
+ @config.assets.digest = false
+ @config.assets.debug = true
+
+ Rails.application.assets.expects(:resolve).never
+
+ asset_paths.asset_for(FIXTURES.join("sprockets/app/javascripts/foo.min.js").to_path, 'min')
+ end
+
test "stylesheet path through asset_path" do
assert_match %r{/assets/application-[0-9a-f]+.css}, asset_path(:application, :ext => "css")