diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2014-07-25 16:35:16 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2014-07-25 16:37:18 -0700 |
commit | da1b8a786cad277c1e4dc1a9f03acec4268dda1f (patch) | |
tree | 0228b746dd5508fe48348fb0be2adbc71f3b5a37 /actionview/test | |
parent | a851f13d305705521d4e661805f673a156b7765f (diff) | |
download | rails-da1b8a786cad277c1e4dc1a9f03acec4268dda1f.tar.gz rails-da1b8a786cad277c1e4dc1a9f03acec4268dda1f.tar.bz2 rails-da1b8a786cad277c1e4dc1a9f03acec4268dda1f.zip |
Fix that render layout should also be picked up by the template dependency tracker, but only half-ways. You can add that layout option on the same render call, and both templates should be added to the dependency tree. But thats going to require a more serious rework of the tracker. Please do help fix this part of it too. For now, render layout needs to be on its own line.
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/dependency_tracker_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/actionview/test/template/dependency_tracker_test.rb b/actionview/test/template/dependency_tracker_test.rb index 6c780f2297..bb375076c6 100644 --- a/actionview/test/template/dependency_tracker_test.rb +++ b/actionview/test/template/dependency_tracker_test.rb @@ -60,6 +60,21 @@ class ERBTrackerTest < Minitest::Test assert_equal ["messages/message123"], tracker.dependencies end + def test_dependency_of_template_partial_with_layout + skip # FIXME: Needs to be fixed properly, right now we can only match one dependency per line. Need multiple! + template = FakeTemplate.new("<%# render partial: 'messages/show', layout: 'messages/layout' %>", :erb) + tracker = make_tracker("multiple/_dependencies", template) + + assert_equal ["messages/layout", "messages/show"], tracker.dependencies + end + + def test_dependency_of_template_layout_standalone + template = FakeTemplate.new("<%# render layout: 'messages/layout' do %>", :erb) + tracker = make_tracker("messages/layout", template) + + assert_equal ["messages/layout"], tracker.dependencies + end + def test_finds_dependency_in_correct_directory template = FakeTemplate.new("<%# render(message.topic) %>", :erb) tracker = make_tracker("messages/_message", template) |