提交 9da48a99 编写于 作者: P Paul Nikitochkin

#10428: Added tests for config.assets.precompile

Tests for bug in sprocket-rails:
  do not use value of configuration options
  which changed after environment loaded
上级 7c69a829
......@@ -165,6 +165,29 @@ class User < ActiveRecord::Base; end
assert_file_exists("#{app_path}/public/assets/something-*.js")
end
test 'precompile use assets defined in app env config' do
add_to_env_config 'production', 'config.assets.precompile = [ "something.js" ]'
app_file 'app/assets/javascripts/something.js.erb', 'alert();'
precompile! 'RAILS_ENV=production'
assert_file_exists("#{app_path}/public/assets/something-*.js")
end
test 'precompile use assets defined in app config and reassigned in app env config' do
add_to_config 'config.assets.precompile = [ "something.js" ]'
add_to_env_config 'production', 'config.assets.precompile += [ "another.js" ]'
app_file 'app/assets/javascripts/something.js.erb', 'alert();'
app_file 'app/assets/javascripts/another.js.erb', 'alert();'
precompile! 'RAILS_ENV=production'
assert_file_exists("#{app_path}/public/assets/something-*.js")
assert_file_exists("#{app_path}/public/assets/another-*.js")
end
test "asset pipeline should use a Sprockets::Index when config.assets.digest is true" do
add_to_config "config.assets.digest = true"
add_to_config "config.action_controller.perform_caching = false"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册