Permalink
Browse files

Merge pull request #2987 from kennyj/master

fix #2947 (with testcase)
  • Loading branch information...
2 parents f65b221 + 21eaba4 commit 038e45a2b6a71175ffe368ae9d7c920f7d1230a6 @spastorino spastorino committed Sep 13, 2011
Showing with 19 additions and 0 deletions.
  1. +3 −0 actionpack/lib/sprockets/assets.rake
  2. +16 −0 railties/test/application/rake_test.rb
@@ -16,6 +16,9 @@ namespace :assets do
# Always compile files
Rails.application.config.assets.compile = true
+ # Always ignore asset host
+ Rails.application.config.action_controller.asset_host = nil
+
config = Rails.application.config
env = Rails.application.assets
target = Pathname.new(File.join(Rails.public_path, config.assets.prefix))
@@ -216,5 +216,21 @@ def test_assets_precompile_with_utf8_filename
end
end
+ def test_assets_precompile_ignore_asset_host
+ add_to_config <<-RUBY
+ config.action_controller.asset_host = Proc.new { |source, request| "http://www.example.com/" }
+ RUBY
+
+ app_file "app/assets/javascripts/test.js.erb", <<-RUBY
+ alert("<%= asset_path "rails.png" %>");
+ RUBY
+
+ Dir.chdir(app_path) do
+ `rake assets:precompile`
+ open("public/assets/application.js") do |f|
+ assert_match(/\"\/assets\/rails.png\"/, f.read)
+ end
+ end
+ end
end
end

0 comments on commit 038e45a

Please sign in to comment.