aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/assets_test.rb
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2011-09-13 03:19:02 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2011-09-13 03:19:02 -0500
commite767cda6ea171cf888c8e46b0c62e3c7df801a38 (patch)
tree4669cb106686b44931a861ecee68544d9a2111ca /railties/test/application/assets_test.rb
parentf1c3903f5c5ad7014355d92fb8572e324aac5296 (diff)
downloadrails-e767cda6ea171cf888c8e46b0c62e3c7df801a38.tar.gz
rails-e767cda6ea171cf888c8e46b0c62e3c7df801a38.tar.bz2
rails-e767cda6ea171cf888c8e46b0c62e3c7df801a38.zip
Move asset tests to assets_test file
Diffstat (limited to 'railties/test/application/assets_test.rb')
-rw-r--r--railties/test/application/assets_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index b8a8665b3e..95fcb4a3dd 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
require 'isolation/abstract_unit'
require 'active_support/core_ext/kernel/reporting'
require 'rack/test'
@@ -268,6 +269,36 @@ module ApplicationTests
assert_match(/\/assets\/rails-([0-z]+)\.png/, File.read(file))
end
+ test "precompile ignore asset_host" do
+ app_file "app/assets/javascripts/application.css.erb", "<%= asset_path 'rails.png' %>"
+ add_to_config "config.action_controller.asset_host = Proc.new { |source, request| 'http://www.example.com/' }"
+
+ capture(:stdout) do
+ Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
+ end
+
+ file = Dir["#{app_path}/public/assets/application.css"].first
+ content = File.read(file)
+ assert_match(/\/assets\/rails-([0-z]+)\.png/, content)
+ assert_no_match(/www\.example\.com/, content)
+ end
+
+ test "precompile should handle utf8 filenames" do
+ app_file "app/assets/images/レイルズ.png", "not a image really"
+ add_to_config "config.assets.precompile = [ /\.png$$/, /application.(css|js)$/ ]"
+
+ capture(:stdout) do
+ Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
+ end
+
+ assert File.exists?("#{app_path}/public/assets/レイルズ.png")
+
+ manifest = "#{app_path}/public/assets/manifest.yml"
+
+ assets = YAML.load_file(manifest)
+ assert_equal "レイルズ.png", assets["レイルズ.png"]
+ end
+
test "assets are cleaned up properly" do
app_file "public/assets/application.js", "alert();"
app_file "public/assets/application.css", "a { color: green; }"