diff options
author | Daniel Schierbeck <dasch@zendesk.com> | 2012-12-17 21:26:55 +0100 |
---|---|---|
committer | Daniel Schierbeck <dasch@zendesk.com> | 2013-02-20 16:17:55 +0100 |
commit | 445284906476f03acf37cab2b7dc265a985531c3 (patch) | |
tree | a014d1a4ec46735332a2ac17256f261faac05755 /actionpack/test | |
parent | 9ca8c635f679ff7956496fd8e56a07f162f97fa2 (diff) | |
download | rails-445284906476f03acf37cab2b7dc265a985531c3.tar.gz rails-445284906476f03acf37cab2b7dc265a985531c3.tar.bz2 rails-445284906476f03acf37cab2b7dc265a985531c3.zip |
Return an empty array if no tracker is found
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/dependency_tracker_test.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/test/template/dependency_tracker_test.rb b/actionpack/test/template/dependency_tracker_test.rb index 5b2ec0eb2d..714e2d6b29 100644 --- a/actionpack/test/template/dependency_tracker_test.rb +++ b/actionpack/test/template/dependency_tracker_test.rb @@ -3,6 +3,7 @@ require 'action_view/dependency_tracker' class DependencyTrackerTest < ActionView::TestCase Neckbeard = Class.new + Bowtie = Class.new class NeckbeardTracker def self.call(name, template) @@ -13,8 +14,8 @@ class DependencyTrackerTest < ActionView::TestCase class FakeTemplate attr_reader :source, :handler - def initialize(source) - @source, @handler = source, Neckbeard + def initialize(source, handler = Neckbeard) + @source, @handler = source, handler end end @@ -35,4 +36,10 @@ class DependencyTrackerTest < ActionView::TestCase dependencies = tracker.find_dependencies("boo/hoo", template) assert_equal ["foo/boo/hoo"], dependencies end + + def test_returns_empty_array_if_no_tracker_is_found + template = FakeTemplate.new("boo/hoo", Bowtie) + dependencies = tracker.find_dependencies("boo/hoo", template) + assert_equal [], dependencies + end end |