aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-09-04 15:41:13 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2011-09-04 15:41:13 -0700
commit6521cf3316ac5378d2b6019c303a003f527b7646 (patch)
tree0b5920f655af338a25295f2044f37551714a6ddc /railties/test
parenta1fa756e17a2522d69a828ce59b801709483a34f (diff)
parent9bc0082f299436552aabd101f5bcb6bc2fbd6a43 (diff)
downloadrails-6521cf3316ac5378d2b6019c303a003f527b7646.tar.gz
rails-6521cf3316ac5378d2b6019c303a003f527b7646.tar.bz2
rails-6521cf3316ac5378d2b6019c303a003f527b7646.zip
Merge pull request #2860 from guilleiguaran/fix-assets-behavior
Fix AssetNotPrecompiledError behavior
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/assets_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index 1e0a26918b..3c7d178d37 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -180,6 +180,32 @@ module ApplicationTests
assert_match(/app.js isn't precompiled/, last_response.body)
end
+ test "assets raise AssetNotPrecompiledError when manifest file is present and requested file isn't precompiled if digest is disabled" do
+ app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'app' %>"
+ app_file "config/initializers/compile.rb", "Rails.application.config.assets.compile = false"
+
+ app_file "config/routes.rb", <<-RUBY
+ AppTemplate::Application.routes.draw do
+ match '/posts', :to => "posts#index"
+ end
+ RUBY
+
+ ENV["RAILS_ENV"] = "development"
+ capture(:stdout) do
+ Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
+ end
+
+ # Create file after of precompile
+ app_file "app/assets/javascripts/app.js", "alert();"
+
+ require "#{app_path}/config/environment"
+ class ::PostsController < ActionController::Base ; end
+
+ get '/posts'
+ assert_match(/AssetNotPrecompiledError/, last_response.body)
+ assert_match(/app.js isn't precompiled/, last_response.body)
+ end
+
test "precompile appends the md5 hash to files referenced with asset_path and run in the provided RAILS_ENV" do
app_file "app/assets/stylesheets/application.css.erb", "<%= asset_path('rails.png') %>"
# digest is default in false, we must enable it for test environment