mirror of https://github.com/rails/rails
Add test to make sure the sprockets cache is not shared per environment
This commit is contained in:
parent
671e61d867
commit
e2f08a1c0a
|
@ -116,7 +116,7 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.10.0)
|
coffee-script-source (1.10.0)
|
||||||
concurrent-ruby (1.0.0)
|
concurrent-ruby (1.0.1)
|
||||||
connection_pool (2.2.0)
|
connection_pool (2.2.0)
|
||||||
dalli (2.7.6)
|
dalli (2.7.6)
|
||||||
dante (0.2.0)
|
dante (0.2.0)
|
||||||
|
@ -239,7 +239,7 @@ GEM
|
||||||
sprockets (3.5.2)
|
sprockets (3.5.2)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
sprockets-rails (3.0.2)
|
sprockets-rails (3.0.4)
|
||||||
actionpack (>= 4.0)
|
actionpack (>= 4.0)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
|
|
|
@ -186,6 +186,26 @@ module ApplicationTests
|
||||||
assert_file_exists("#{app_path}/public/assets/something-*.js")
|
assert_file_exists("#{app_path}/public/assets/something-*.js")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'sprockets cache is not shared between environments' do
|
||||||
|
app_file "app/assets/images/rails.png", "notactuallyapng"
|
||||||
|
app_file "app/assets/stylesheets/application.css.erb", "<%= asset_path('rails.png') %>"
|
||||||
|
add_to_env_config 'production', 'config.assets.prefix = "production_assets"'
|
||||||
|
|
||||||
|
precompile!
|
||||||
|
|
||||||
|
assert_file_exists("#{app_path}/public/assets/application-*.css")
|
||||||
|
|
||||||
|
file = Dir["#{app_path}/public/assets/application-*.css"].first
|
||||||
|
assert_match(/assets\/rails-([0-z]+)\.png/, File.read(file))
|
||||||
|
|
||||||
|
precompile! RAILS_ENV: 'production'
|
||||||
|
|
||||||
|
assert_file_exists("#{app_path}/public/production_assets/application-*.css")
|
||||||
|
|
||||||
|
file = Dir["#{app_path}/public/production_assets/application-*.css"].first
|
||||||
|
assert_match(/production_assets\/rails-([0-z]+)\.png/, File.read(file))
|
||||||
|
end
|
||||||
|
|
||||||
test 'precompile use assets defined in app config and reassigned in app env config' do
|
test 'precompile use assets defined in app config and reassigned in app env config' do
|
||||||
add_to_config 'config.assets.precompile = [ "something_manifest.js" ]'
|
add_to_config 'config.assets.precompile = [ "something_manifest.js" ]'
|
||||||
add_to_env_config 'production', 'config.assets.precompile += [ "another_manifest.js" ]'
|
add_to_env_config 'production', 'config.assets.precompile += [ "another_manifest.js" ]'
|
||||||
|
|
Loading…
Reference in New Issue