diff options
author | Faruk AYDIN <omerfaruk26@gmail.com> | 2015-05-07 20:17:45 +0300 |
---|---|---|
committer | Faruk AYDIN <omerfaruk26@gmail.com> | 2015-05-07 20:17:45 +0300 |
commit | 5b196452a59cfc7476668786e027963ac7271639 (patch) | |
tree | a2ef13766139f70796242976fb0880008dc98583 /actionview | |
parent | 64ed04ee78bd8d08bd91e997a0b93172be9d9f35 (diff) | |
download | rails-5b196452a59cfc7476668786e027963ac7271639.tar.gz rails-5b196452a59cfc7476668786e027963ac7271639.tar.bz2 rails-5b196452a59cfc7476668786e027963ac7271639.zip |
add error log that notify 'file not found' when using cache_digests:dependency and cache_digests:nested_dependency tasks
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/digestor.rb | 3 | ||||
-rw-r--r-- | actionview/test/template/digestor_test.rb | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index 1f103786cb..b29eb48425 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -70,7 +70,8 @@ module ActionView def dependencies DependencyTracker.find_dependencies(name, template) rescue ActionView::MissingTemplate - [] # File doesn't exist, so no dependencies + logger.try :error, " '#{name}' file doesn't exist, so no dependencies" + [] end def nested_dependencies diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index c2b8439df3..f0afcdb5ae 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -111,6 +111,18 @@ class TemplateDigestorTest < ActionView::TestCase end end + def test_logging_of_missing_template_for_dependencies + assert_logged "'messages/something_missing' file doesn't exist, so no dependencies" do + dependencies("messages/something_missing") + end + end + + def test_logging_of_missing_template_for_nested_dependencies + assert_logged "'messages/something_missing' file doesn't exist, so no dependencies" do + nested_dependencies("messages/something_missing") + end + end + def test_nested_template_directory assert_digest_difference("messages/show") do change_template("messages/actions/_move") @@ -298,6 +310,14 @@ class TemplateDigestorTest < ActionView::TestCase ActionView::Digestor.digest({ name: template_name, finder: finder }.merge(options)) end + def dependencies(template_name) + ActionView::Digestor.new({ name: template_name, finder: finder }).dependencies + end + + def nested_dependencies(template_name) + ActionView::Digestor.new({ name: template_name, finder: finder }).nested_dependencies + end + def finder @finder ||= FixtureFinder.new end |