File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'cache_digests/test_helper'
2
+ require 'fileutils'
3
+
4
+ class RenderDependencyMatcherTest < MiniTest ::Unit ::TestCase
5
+ def test_matches_render_partial
6
+ assert_matched "render partial: \" comments/comment\" , collection: commentable.comments"
7
+ end
8
+
9
+ def test_matches_render_no_partial_double_quote
10
+ assert_matched "render \" comments/comments\" "
11
+ end
12
+
13
+ def test_matches_render_no_partial_single_quote
14
+ assert_matched "render 'comments/comments'"
15
+ end
16
+
17
+ def test_matches_render_no_partial_single_quote_in_parens
18
+ assert_matched "render('comments/comments')"
19
+ end
20
+
21
+ def test_matches_render_with_instance_var
22
+ assert_matched "render(@topic)"
23
+ end
24
+
25
+ def test_matches_render_with_local_var
26
+ assert_matched "render(topics)"
27
+ end
28
+
29
+ def test_misses_string_rendered
30
+ assert_misses "rendered"
31
+ end
32
+
33
+ private
34
+ def matcher
35
+ CacheDigests ::TemplateDigestor ::RENDER_DEPENDENCY
36
+ end
37
+
38
+ def assert_matched ( str )
39
+ assert str =~ matcher , "Should have matched #{ str } but didn't."
40
+ end
41
+
42
+ def assert_misses ( str )
43
+ assert str !~ matcher , "Matched #{ str } but should not have."
44
+ end
45
+ end
You can’t perform that action at this time.
0 commit comments