Skip to content

Commit 3012c25

Browse files
committed
No need to check if fragment responds to :each
1 parent ba11500 commit 3012c25

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

test/abstract_unit.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,3 @@
66

77
FIXTURE_LOAD_PATH = File.expand_path('../fixtures', __FILE__)
88

9-
module RackTestUtils
10-
def body_to_string(body)
11-
if body.respond_to?(:each)
12-
str = ''
13-
body.each {|s| str << s }
14-
str
15-
else
16-
body
17-
end
18-
end
19-
extend self
20-
end

test/caching_test.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ def test_simple_action_not_cached
249249
assert_not_equal cached_time, @response.body
250250
end
251251

252-
include RackTestUtils
253-
254252
def test_action_cache_with_layout
255253
draw do
256254
get '/action_caching_test/with_layout', to: 'action_caching_test#with_layout'
@@ -265,8 +263,7 @@ def test_action_cache_with_layout
265263
get :with_layout
266264
assert_response :success
267265
assert_not_equal cached_time, @response.body
268-
body = body_to_string(read_fragment('hostname.com/action_caching_test/with_layout'))
269-
assert_equal @response.body, body
266+
assert_equal @response.body, read_fragment('hostname.com/action_caching_test/with_layout')
270267
end
271268

272269
def test_action_cache_with_layout_and_layout_cache_false
@@ -283,8 +280,7 @@ def test_action_cache_with_layout_and_layout_cache_false
283280
get :layout_false
284281
assert_response :success
285282
assert_not_equal cached_time, @response.body
286-
body = body_to_string(read_fragment('hostname.com/action_caching_test/layout_false'))
287-
assert_equal cached_time, body
283+
assert_equal cached_time, read_fragment('hostname.com/action_caching_test/layout_false')
288284
end
289285

290286
def test_action_cache_with_layout_and_layout_cache_false_via_proc
@@ -301,8 +297,7 @@ def test_action_cache_with_layout_and_layout_cache_false_via_proc
301297
get :with_layout_proc_param, params: { layout: false }
302298
assert_response :success
303299
assert_not_equal cached_time, @response.body
304-
body = body_to_string(read_fragment('hostname.com/action_caching_test/with_layout_proc_param'))
305-
assert_equal cached_time, body
300+
assert_equal cached_time, read_fragment('hostname.com/action_caching_test/with_layout_proc_param')
306301
end
307302

308303
def test_action_cache_with_layout_and_layout_cache_true_via_proc
@@ -319,8 +314,7 @@ def test_action_cache_with_layout_and_layout_cache_true_via_proc
319314
get :with_layout_proc_param, params: { layout: true }
320315
assert_response :success
321316
assert_not_equal cached_time, @response.body
322-
body = body_to_string(read_fragment('hostname.com/action_caching_test/with_layout_proc_param'))
323-
assert_equal @response.body, body
317+
assert_equal @response.body, read_fragment('hostname.com/action_caching_test/with_layout_proc_param')
324318
end
325319

326320
def test_action_cache_conditional_options

0 commit comments

Comments
 (0)