aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorJessica Lynn Suttles <jlsuttles@gmail.com>2013-04-02 14:25:30 -0700
committerSteve Klabnik <steve@steveklabnik.com>2013-04-02 14:27:38 -0700
commitc959798571b4060b19712e022f4236d75b2b7cfd (patch)
treefe5749be448d8dff1f11db0272c30d3103a29b1c /railties/test/application
parent50fd48e26148b6b29e865d4297986e020f8cf4dc (diff)
downloadrails-c959798571b4060b19712e022f4236d75b2b7cfd.tar.gz
rails-c959798571b4060b19712e022f4236d75b2b7cfd.tar.bz2
rails-c959798571b4060b19712e022f4236d75b2b7cfd.zip
Fix tests from rails.png removal.
I'm giving @jlsuttles credit on this commit because she gave me the idea and the actual converted image in 952289aabfb.
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/assets_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index e5503b1eff..34432eac3a 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -41,6 +41,7 @@ module ApplicationTests
end
test "assets routes have higher priority" do
+ app_file "app/assets/images/rails.png", "notactuallyapng"
app_file "app/assets/javascripts/demo.js.erb", "a = <%= image_path('rails.png').inspect %>;"
app_file 'config/routes.rb', <<-RUBY
@@ -222,6 +223,7 @@ module ApplicationTests
end
test "precompile properly refers files referenced with asset_path and runs in the provided RAILS_ENV" do
+ app_file "app/assets/images/rails.png", "notactuallyapng"
app_file "app/assets/stylesheets/application.css.erb", "<%= asset_path('rails.png') %>"
# digest is default in false, we must enable it for test environment
add_to_env_config "test", "config.assets.digest = true"
@@ -233,6 +235,8 @@ module ApplicationTests
end
test "precompile shouldn't use the digests present in manifest.json" do
+ app_file "app/assets/images/rails.png", "notactuallyapng"
+
app_file "app/assets/stylesheets/application.css.erb", "//= depend_on rails.png\np { url: <%= asset_path('rails.png') %> }"
ENV["RAILS_ENV"] = "production"
@@ -251,6 +255,7 @@ module ApplicationTests
end
test "precompile appends the md5 hash to files referenced with asset_path and run in production with digest true" do
+ app_file "app/assets/images/rails.png", "notactuallyapng"
app_file "app/assets/stylesheets/application.css.erb", "<%= asset_path('rails.png') %>"
add_to_config "config.assets.compile = true"
add_to_config "config.assets.digest = true"
@@ -272,7 +277,7 @@ module ApplicationTests
manifest = Dir["#{app_path}/public/assets/manifest-*.json"].first
assets = ActiveSupport::JSON.decode(File.read(manifest))
- assert asset_path = assets["assets"].find { |(k, _)| k !~ /rails.png/ && k =~ /.png/ }[1]
+ assert asset_path = assets["assets"].find { |(k, _)| k && k =~ /.png/ }[1]
require "#{app_path}/config/environment"
@@ -431,6 +436,7 @@ module ApplicationTests
end
test "asset urls should be protocol-relative if no request is in scope" do
+ app_file "app/assets/images/rails.png", "notreallyapng"
app_file "app/assets/javascripts/image_loader.js.erb", 'var src="<%= image_path("rails.png") %>";'
add_to_config "config.assets.precompile = %w{image_loader.js}"
add_to_config "config.asset_host = 'example.com'"
@@ -441,6 +447,7 @@ module ApplicationTests
test "asset paths should use RAILS_RELATIVE_URL_ROOT by default" do
ENV["RAILS_RELATIVE_URL_ROOT"] = "/sub/uri"
+ app_file "app/assets/images/rails.png", "notreallyapng"
app_file "app/assets/javascripts/app.js.erb", 'var src="<%= image_path("rails.png") %>";'
add_to_config "config.assets.precompile = %w{app.js}"