breezy_template 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
23
23
  end
24
24
 
25
25
  test 'jbuilder direct partial! feature are not allowed' do
26
- dependencies = track_dependencies <<-RUBY
26
+ dependencies = track_dependencies <<~RUBY
27
27
  json.partial! 'path/to/partial', foo: bar
28
28
  json.partial! 'path/to/another/partial', :fizz => buzz
29
29
  RUBY
@@ -32,7 +32,7 @@ class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
32
32
  end
33
33
 
34
34
  test 'detects partial with no options (1.9 style)' do
35
- dependencies = track_dependencies <<-RUBY
35
+ dependencies = track_dependencies <<~RUBY
36
36
  json.content hello: 'world', partial: 'path/to/partial'
37
37
  RUBY
38
38
 
@@ -40,7 +40,7 @@ class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
40
40
  end
41
41
 
42
42
  test 'detects partial with no options (1.8 style)' do
43
- dependencies = track_dependencies <<-RUBY
43
+ dependencies = track_dependencies <<~RUBY
44
44
  json.content :hello => 'world', :partial => 'path/to/partial'
45
45
  RUBY
46
46
 
@@ -48,7 +48,7 @@ class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
48
48
  end
49
49
 
50
50
  test 'detects partial with options (1.9 style)' do
51
- dependencies = track_dependencies <<-RUBY
51
+ dependencies = track_dependencies <<~RUBY
52
52
  json.content hello: 'world', partial: ['path/to/partial', foo: :bar]
53
53
  RUBY
54
54
 
@@ -56,7 +56,7 @@ class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
56
56
  end
57
57
 
58
58
  test 'detects partial with options (1.8 style)' do
59
- dependencies = track_dependencies <<-RUBY
59
+ dependencies = track_dependencies <<~RUBY
60
60
  json.content :hello => 'world', :partial => ['path/to/partial', :foo => :bar]
61
61
  RUBY
62
62
 
@@ -64,7 +64,7 @@ class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
64
64
  end
65
65
 
66
66
  test 'detects partial in indirect collecton calls' do
67
- dependencies = track_dependencies <<-RUBY
67
+ dependencies = track_dependencies <<~RUBY
68
68
  json.comments @post.comments, partial: ['comments/comment', as: :comment]
69
69
  RUBY
70
70
 
@@ -72,7 +72,7 @@ class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
72
72
  end
73
73
 
74
74
  test 'detects explicit depedency' do
75
- dependencies = track_dependencies <<-RUBY
75
+ dependencies = track_dependencies <<~RUBY
76
76
  # Template Dependency: path/to/partial
77
77
  json.foo 'bar'
78
78
  RUBY
@@ -2,11 +2,11 @@ require "test_helper"
2
2
 
3
3
  class ExtensionsTest < BreezyTemplateTestCase
4
4
  test "rendering" do
5
- result = jbuild(<<-JBUILDER)
5
+ result = jbuild(<<~JBUILDER)
6
6
  json.content "hello"
7
7
  JBUILDER
8
8
 
9
- expected = strip_format(<<-JS)
9
+ expected = strip_format(<<~JS)
10
10
  (function(){
11
11
  var fragments={};
12
12
  var lastFragmentName;
@@ -21,7 +21,7 @@ class ExtensionsTest < BreezyTemplateTestCase
21
21
  end
22
22
 
23
23
  test "when rendering with duplicate keys, the last one wins" do
24
- result = jbuild(<<-JBUILDER)
24
+ result = jbuild(<<~JBUILDER)
25
25
  json.content do
26
26
  json.miss 123
27
27
  end
@@ -32,7 +32,7 @@ class ExtensionsTest < BreezyTemplateTestCase
32
32
  JBUILDER
33
33
 
34
34
 
35
- expected = strip_format(<<-JS)
35
+ expected = strip_format(<<~JS)
36
36
  (function(){
37
37
  var fragments={};
38
38
  var lastFragmentName;
@@ -47,14 +47,14 @@ class ExtensionsTest < BreezyTemplateTestCase
47
47
  end
48
48
 
49
49
  test "when rendering with duplicate array values, the last one wins" do
50
- result = jbuild(<<-JBUILDER)
50
+ result = jbuild(<<~JBUILDER)
51
51
  json.content do
52
52
  json.array! [1,2]
53
53
  json.array! [3,4]
54
54
  end
55
55
  JBUILDER
56
56
 
57
- expected = strip_format(<<-JS)
57
+ expected = strip_format(<<~JS)
58
58
  (function(){
59
59
  var fragments={};
60
60
  var lastFragmentName;
@@ -72,11 +72,11 @@ class ExtensionsTest < BreezyTemplateTestCase
72
72
  BreezyTemplate.configuration.track_sprockets_assets = ['test.js', 'test.css']
73
73
  BreezyTemplate.configuration.track_pack_assets = ['test_pack.js', 'test_pack.css']
74
74
 
75
- result = jbuild(<<-TEMPLATE)
75
+ result = jbuild(<<~TEMPLATE)
76
76
  json.content "hello"
77
77
  TEMPLATE
78
78
 
79
- expected = strip_format(<<-JS)
79
+ expected = strip_format(<<~JS)
80
80
  (function(){
81
81
  var fragments={};
82
82
  var lastFragmentName;
@@ -91,16 +91,16 @@ class ExtensionsTest < BreezyTemplateTestCase
91
91
  end
92
92
 
93
93
  test "render with csrf token when request forgery is on" do
94
- self.stubs(:protect_against_forgery?).returns(true)
94
+ @view.stubs(:protect_against_forgery?).returns(true)
95
95
 
96
96
  # csrf_meta_tags also delegate authenticity tokens to the controller
97
97
  # here we provide a simple mock to the context
98
98
 
99
- result = jbuild(<<-TEMPLATE)
99
+ result = jbuild(<<~TEMPLATE)
100
100
  json.content "hello"
101
101
  TEMPLATE
102
102
 
103
- expected = strip_format(<<-JS)
103
+ expected = strip_format(<<~JS)
104
104
  (function(){
105
105
  var fragments={};
106
106
  var lastFragmentName;
@@ -116,13 +116,13 @@ class ExtensionsTest < BreezyTemplateTestCase
116
116
 
117
117
  test "wrapping jbuilder contents inside Breezy with additional options" do
118
118
  BreezyTemplate.configuration.track_sprockets_assets = ['test.js', 'test.css']
119
- self.breezy = { title: 'this is fun' }
119
+ @view.stubs(:breezy).returns({ title: 'this is fun'})
120
120
 
121
- result = jbuild(<<-TEMPLATE)
121
+ result = jbuild(<<~TEMPLATE)
122
122
  json.content "hello"
123
123
  TEMPLATE
124
124
 
125
- expected = strip_format(<<-JS)
125
+ expected = strip_format(<<~JS)
126
126
  (function(){
127
127
  var fragments={};
128
128
  var lastFragmentName;
@@ -2,14 +2,14 @@ require "test_helper"
2
2
 
3
3
  class PartialExtensionTest < BreezyTemplateTestCase
4
4
  test "renders partial via the option through set!" do
5
- @post = BLOG_POST_COLLECTION.first
5
+ post = BLOG_POST_COLLECTION.first
6
6
  Rails.cache.clear
7
7
 
8
- result = jbuild(<<-JBUILDER)
8
+ result = jbuild(<<~JBUILDER, assigns: {post: post})
9
9
  json.post @post, partial: ["blog_post", as: :blog_post, fragment_name: :header]
10
10
  JBUILDER
11
11
 
12
- expected = strip_format(<<-JS)
12
+ expected = strip_format(<<~JS)
13
13
  (function(){
14
14
  var fragments={};
15
15
  var lastFragmentName;
@@ -29,11 +29,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
29
29
  end
30
30
 
31
31
  test "renders a partial with explicit fragment" do
32
- result = jbuild(<<-JBUILDER)
32
+ result = jbuild(<<~JBUILDER)
33
33
  json.footer nil, partial: ["footer", fragment_name: 'hello']
34
34
  JBUILDER
35
35
 
36
- expected = strip_format(<<-JS)
36
+ expected = strip_format(<<~JS)
37
37
  (function(){
38
38
  var fragments={};
39
39
  var lastFragmentName;
@@ -48,11 +48,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
48
48
  end
49
49
 
50
50
  test "render array of partials with unique fragments" do
51
- result = jbuild(<<-JBUILDER)
51
+ result = jbuild(<<~JBUILDER)
52
52
  json.array! [1,2], partial: ["footer", fragment_name: ->(x){"somefoo"+x.to_s}]
53
53
  JBUILDER
54
54
 
55
- expected = strip_format(<<-JS)
55
+ expected = strip_format(<<~JS)
56
56
  (function(){
57
57
  var fragments={};
58
58
  var lastFragmentName;
@@ -68,11 +68,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
68
68
  end
69
69
 
70
70
  test "renders a partial with no locals" do
71
- result = jbuild(<<-JBUILDER)
71
+ result = jbuild(<<~JBUILDER)
72
72
  json.footer nil, partial: "footer"
73
73
  JBUILDER
74
74
 
75
- expected = strip_format(<<-JS)
75
+ expected = strip_format(<<~JS)
76
76
  (function(){
77
77
  var fragments={};
78
78
  var lastFragmentName;
@@ -86,11 +86,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
86
86
  end
87
87
 
88
88
  test "renders a partial with locals" do
89
- result = jbuild(<<-JBUILDER)
89
+ result = jbuild(<<~JBUILDER)
90
90
  json.profile nil, partial: ["profile", locals: {email: "test@test.com"}]
91
91
  JBUILDER
92
92
 
93
- expected = strip_format(<<-JS)
93
+ expected = strip_format(<<~JS)
94
94
  (function(){
95
95
  var fragments={};
96
96
  var lastFragmentName;
@@ -104,7 +104,7 @@ class PartialExtensionTest < BreezyTemplateTestCase
104
104
  end
105
105
 
106
106
  test "renders a partial with locals and caches" do
107
- result = jbuild(<<-JBUILDER)
107
+ result = jbuild(<<~JBUILDER)
108
108
  opts = {
109
109
  cache: 'cachekey',
110
110
  partial: ["profile", locals: {email: "test@test.com"}]
@@ -112,7 +112,7 @@ class PartialExtensionTest < BreezyTemplateTestCase
112
112
  json.profile 32, opts
113
113
  JBUILDER
114
114
 
115
- expected = strip_format(<<-JS)
115
+ expected = strip_format(<<~JS)
116
116
  (function(){
117
117
  var fragments={};
118
118
  var lastFragmentName;
@@ -128,11 +128,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
128
128
  end
129
129
 
130
130
  test "renders a partial even without a :as to the value, this usage is rare" do
131
- result = jbuild(<<-JBUILDER)
131
+ result = jbuild(<<~JBUILDER)
132
132
  json.profile 32, partial: ["profile", locals: {email: "test@test.com"}]
133
133
  JBUILDER
134
134
 
135
- expected = strip_format(<<-JS)
135
+ expected = strip_format(<<~JS)
136
136
  (function(){
137
137
  var fragments={};
138
138
  var lastFragmentName;
@@ -147,11 +147,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
147
147
  end
148
148
 
149
149
  test "render array of partials without an :as to a member, this usage is very rare" do
150
- result = jbuild(<<-JBUILDER)
150
+ result = jbuild(<<~JBUILDER)
151
151
  json.array! [1,2], partial: "footer"
152
152
  JBUILDER
153
153
 
154
- expected = strip_format(<<-JS)
154
+ expected = strip_format(<<~JS)
155
155
  (function(){
156
156
  var fragments={};
157
157
  var lastFragmentName;
@@ -166,11 +166,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
166
166
  end
167
167
 
168
168
  test "render array of partials without an :as to a member and cache" do
169
- result = jbuild(<<-JBUILDER)
169
+ result = jbuild(<<~JBUILDER)
170
170
  json.array! [1,2], partial: "footer", cache: ->(i){ ['a', i] }
171
171
  JBUILDER
172
172
 
173
- expected = strip_format(<<-JS)
173
+ expected = strip_format(<<~JS)
174
174
  (function(){
175
175
  var fragments={};
176
176
  var lastFragmentName;
@@ -187,11 +187,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
187
187
  end
188
188
 
189
189
  test "render array of partials" do
190
- result = jbuild(<<-JBUILDER)
190
+ result = jbuild(<<~JBUILDER)
191
191
  json.array! BLOG_POST_COLLECTION, partial: ["blog_post", as: :blog_post]
192
192
  JBUILDER
193
193
 
194
- expected = strip_format(<<-JS)
194
+ expected = strip_format(<<~JS)
195
195
  (function(){
196
196
  var fragments={};
197
197
  var lastFragmentName;
@@ -217,11 +217,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
217
217
  end
218
218
 
219
219
  test "renders array of partials as empty array with an empty collection" do
220
- result = jbuild(<<-JBUILDER)
220
+ result = jbuild(<<~JBUILDER)
221
221
  json.array! [], partial: ["blog_post", as: :blog_post]
222
222
  JBUILDER
223
223
 
224
- expected = strip_format(<<-JS)
224
+ expected = strip_format(<<~JS)
225
225
  (function(){
226
226
  var fragments={};
227
227
  var lastFragmentName;
@@ -236,11 +236,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
236
236
  end
237
237
 
238
238
  test "renders the partial and ignores the value" do
239
- result = jbuild <<-JBUILDER
239
+ result = jbuild <<~JBUILDER
240
240
  json.posts nil, partial: "footer"
241
241
  JBUILDER
242
242
 
243
- expected = strip_format(<<-JS)
243
+ expected = strip_format(<<~JS)
244
244
  (function(){
245
245
  var fragments={};
246
246
  var lastFragmentName;
@@ -254,11 +254,11 @@ class PartialExtensionTest < BreezyTemplateTestCase
254
254
  end
255
255
 
256
256
  test "renders the partial as an array and ignores the value" do
257
- result = jbuild <<-JBUILDER
257
+ result = jbuild <<~JBUILDER
258
258
  json.posts nil, partial: "flattened"
259
259
  JBUILDER
260
260
 
261
- expected = strip_format(<<-JS)
261
+ expected = strip_format(<<~JS)
262
262
  (function(){
263
263
  var fragments={};
264
264
  var lastFragmentName;
@@ -2,7 +2,9 @@ require "test_helper"
2
2
 
3
3
  class SearchExtensionTest < BreezyTemplateTestCase
4
4
  test "filtering for a node in the tree" do
5
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2')
5
+ @view.stubs(:breezy_filter).returns('hit.hit2')
6
+
7
+ result = jbuild(<<~JBUILDER)
6
8
  json.hit do
7
9
  json.hit2 do
8
10
  json.greeting 'hello world'
@@ -18,7 +20,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
18
20
  JBUILDER
19
21
  Rails.cache.clear
20
22
 
21
- expected = strip_format(<<-JS)
23
+ expected = strip_format(<<~JS)
22
24
  (function(){
23
25
  var fragments={};
24
26
  var lastFragmentName;
@@ -35,7 +37,9 @@ class SearchExtensionTest < BreezyTemplateTestCase
35
37
  end
36
38
 
37
39
  test "filtering for a node in the tree with camelized keys" do
38
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit_one.hit_two')
40
+ @view.stubs(:breezy_filter).returns('hit_one.hit_two')
41
+
42
+ result = jbuild(<<~JBUILDER)
39
43
  json.hit_one do
40
44
  json.hit_two do
41
45
  json.greeting 'hello world'
@@ -44,7 +48,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
44
48
  JBUILDER
45
49
  Rails.cache.clear
46
50
 
47
- expected = strip_format(<<-JS)
51
+ expected = strip_format(<<~JS)
48
52
  (function(){
49
53
  var fragments={};
50
54
  var lastFragmentName;
@@ -62,7 +66,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
62
66
 
63
67
  test "filtering for a nonexistant node in the tree" do
64
68
  begin
65
- jbuild(<<-JBUILDER)
69
+ jbuild(<<~JBUILDER)
66
70
  json._set_search_path_once('miss.miss.miss.miss')
67
71
  json.hit do
68
72
  json.hit2 do
@@ -72,29 +76,30 @@ class SearchExtensionTest < BreezyTemplateTestCase
72
76
  JBUILDER
73
77
  rescue => e
74
78
  assert_equal e.cause.class, BreezyTemplate::NotFoundError
75
- assert_equal e.message, 'Could not find node at ["miss", "miss", "miss", "miss"]'
79
+ assert_equal e.cause.message, 'Could not find node at ["miss", "miss", "miss", "miss"]'
76
80
  end
77
81
 
78
82
  Rails.cache.clear
79
83
  end
80
84
 
81
85
  test "filtering for a node but forgetting to use nil as the first param" do
82
- undef_context_methods :fragment_name_with_digest, :cache_fragment_name
86
+ @view.stubs(:breezy_filter).returns('hit.hit2.terms')
83
87
 
84
88
  begin
85
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2.terms')
89
+ result = jbuild(<<~JBUILDER)
86
90
  json.hit do
87
91
  json.hit2 cache: 'a', partial: 'footer'
88
92
  end
89
93
  JBUILDER
90
94
  rescue => e
91
95
  assert_equal e.cause.class, BreezyTemplate::LeafTraversalError
92
- assert_equal e.message, "Attempted to traverse into node named hit2 but got a value. This may happen if you forgot to use nil as a first value if you're using a partial, e.g, json.foo nil, partial: 'footer'. Key: hit2 Value: {:cache=>\"a\", :partial=>\"footer\"} Options: {} Remaining search path: [\"terms\"]."
96
+ assert_equal e.cause.message, "Attempted to traverse into node named hit2 but got a value. This may happen if you forgot to use nil as a first value if you're using a partial, e.g, json.foo nil, partial: 'footer'. Key: hit2 Value: {:cache=>\"a\", :partial=>\"footer\"} Options: {} Remaining search path: [\"terms\"]."
93
97
  end
94
98
  end
95
99
 
96
100
  test "filtering for a raw value is also possble" do
97
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2')
101
+ @view.stubs(:breezy_filter).returns('hit.hit2')
102
+ result = jbuild(<<~JBUILDER)
98
103
  json.hit do
99
104
  json.hit2 23
100
105
  end
@@ -108,7 +113,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
108
113
  JBUILDER
109
114
  Rails.cache.clear
110
115
 
111
- expected = strip_format(<<-JS)
116
+ expected = strip_format(<<~JS)
112
117
  (function(){
113
118
  var fragments={};
114
119
  var lastFragmentName;
@@ -125,13 +130,14 @@ class SearchExtensionTest < BreezyTemplateTestCase
125
130
  end
126
131
 
127
132
  test "filter with partials" do
128
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2.nested.terms')
133
+ @view.stubs(:breezy_filter).returns('hit.hit2.nested.terms')
134
+ result = jbuild(<<~JBUILDER)
129
135
  json.hit do
130
136
  json.hit2 nil, partial: "nested"
131
137
  end
132
138
  JBUILDER
133
139
 
134
- expected = strip_format(<<-JS)
140
+ expected = strip_format(<<~JS)
135
141
  (function(){
136
142
  var fragments={};
137
143
  var lastFragmentName;
@@ -147,7 +153,8 @@ class SearchExtensionTest < BreezyTemplateTestCase
147
153
  end
148
154
 
149
155
  test "filtering for a node in the tree via breezy_filter helper" do
150
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2')
156
+ @view.stubs(:breezy_filter).returns('hit.hit2')
157
+ result = jbuild(<<~JBUILDER)
151
158
  json.hit do
152
159
  json.hit2 do
153
160
  json.greeting 'hello world'
@@ -163,7 +170,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
163
170
  JBUILDER
164
171
  Rails.cache.clear
165
172
 
166
- expected = strip_format(<<-JS)
173
+ expected = strip_format(<<~JS)
167
174
  (function(){
168
175
  var fragments={};
169
176
  var lastFragmentName;
@@ -180,8 +187,8 @@ class SearchExtensionTest < BreezyTemplateTestCase
180
187
  end
181
188
 
182
189
  test "filtering a cached node returns just that" do
183
- undef_context_methods :fragment_name_with_digest, :cache_fragment_name
184
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2')
190
+ @view.stubs(:breezy_filter).returns('hit.hit2')
191
+ result = jbuild(<<~JBUILDER)
185
192
  json.hit do
186
193
  json.hit2 cache: 'a' do
187
194
  json.greeting 'hello world'
@@ -190,7 +197,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
190
197
  JBUILDER
191
198
  Rails.cache.clear
192
199
 
193
- expected = strip_format(<<-JS)
200
+ expected = strip_format(<<~JS)
194
201
  (function(){
195
202
  var fragments={};
196
203
  var lastFragmentName;
@@ -206,8 +213,8 @@ class SearchExtensionTest < BreezyTemplateTestCase
206
213
  end
207
214
 
208
215
  test "filtering disables all ancestor cache of target node" do
209
- undef_context_methods :fragment_name_with_digest, :cache_fragment_name
210
- jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2')
216
+ @view.stubs(:breezy_filter).returns('hit.hit2')
217
+ jbuild(<<~JBUILDER)
211
218
  json.hit do
212
219
  json.hit2 cache: 'a' do
213
220
  json.greeting 'stale'
@@ -215,7 +222,8 @@ class SearchExtensionTest < BreezyTemplateTestCase
215
222
  end
216
223
  JBUILDER
217
224
 
218
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2.greeting')
225
+ @view.stubs(:breezy_filter).returns('hit.hit2.greeting')
226
+ result = jbuild(<<~JBUILDER)
219
227
  json.hit do
220
228
  json.hit2 cache: 'a' do
221
229
  json.greeting 'fresh hit'
@@ -224,7 +232,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
224
232
  JBUILDER
225
233
  Rails.cache.clear
226
234
 
227
- expected = strip_format(<<-JS)
235
+ expected = strip_format(<<~JS)
228
236
  (function(){
229
237
  var fragments={};
230
238
  var lastFragmentName;
@@ -239,8 +247,8 @@ class SearchExtensionTest < BreezyTemplateTestCase
239
247
  end
240
248
 
241
249
  test "filtering disables all ancestor cache of target node with partial options" do
242
- undef_context_methods :fragment_name_with_digest, :cache_fragment_name
243
- jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2')
250
+ @view.stubs(:breezy_filter).returns('hit.hit2')
251
+ jbuild(<<~JBUILDER)
244
252
  json.hit do
245
253
  json.hit2 cache: 'a' do
246
254
  json.greeting 'stale'
@@ -248,14 +256,15 @@ class SearchExtensionTest < BreezyTemplateTestCase
248
256
  end
249
257
  JBUILDER
250
258
 
251
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2.terms')
259
+ @view.stubs(:breezy_filter).returns('hit.hit2.terms')
260
+ result = jbuild(<<~JBUILDER)
252
261
  json.hit do
253
262
  json.hit2 nil, cache: 'a', partial: 'footer'
254
263
  end
255
264
  JBUILDER
256
265
  Rails.cache.clear
257
266
 
258
- expected = strip_format(<<-JS)
267
+ expected = strip_format(<<~JS)
259
268
  (function(){
260
269
  var fragments={};
261
270
  var lastFragmentName;
@@ -270,7 +279,8 @@ class SearchExtensionTest < BreezyTemplateTestCase
270
279
  end
271
280
 
272
281
  test "filtering for a node in an array of a tree by id" do
273
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2.id=1')
282
+ @view.stubs(:breezy_filter).returns('hit.hit2.id=1')
283
+ result = jbuild(<<~JBUILDER)
274
284
  json.hit do
275
285
  json.hit2 do
276
286
  data = ObjectCollection.new([{id: 1, name: 'hit' }, {id:2, name: 'miss'}])
@@ -283,7 +293,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
283
293
  JBUILDER
284
294
  Rails.cache.clear
285
295
 
286
- expected = strip_format(<<-JS)
296
+ expected = strip_format(<<~JS)
287
297
  (function(){
288
298
  var fragments={};
289
299
  var lastFragmentName;
@@ -300,7 +310,9 @@ class SearchExtensionTest < BreezyTemplateTestCase
300
310
  end
301
311
 
302
312
  test "filtering for a node in an array of a tree by index" do
303
- result = jbuild(<<-JBUILDER, breezy_filter: 'hit.hit2.0')
313
+ @view.stubs(:breezy_filter).returns('hit.hit2.0')
314
+
315
+ result = jbuild(<<~JBUILDER)
304
316
  data = [{id: 1, name: 'hit' }, {id:2, name: 'miss'}]
305
317
  json.hit do
306
318
  json.hit2 do
@@ -313,7 +325,7 @@ class SearchExtensionTest < BreezyTemplateTestCase
313
325
  JBUILDER
314
326
  Rails.cache.clear
315
327
 
316
- expected = strip_format(<<-JS)
328
+ expected = strip_format(<<~JS)
317
329
  (function(){
318
330
  var fragments={};
319
331
  var lastFragmentName;