blob: bc17f36783d9ef8e65ea2d510c1d150f3793eb40 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
require 'abstract_unit'
class OutputBufferTest < ActionController::TestCase
class TestController < ActionController::Base
def index
render :text => 'foo'
end
end
tests TestController
def test_flush_output_buffer
# Start with the default body parts
get :index
assert_equal ['foo'], @response.body_parts
assert_nil @controller.template.output_buffer
# Nil output buffer is skipped
@controller.template.flush_output_buffer
assert_nil @controller.template.output_buffer
assert_equal ['foo'], @response.body_parts
# Empty output buffer is skipped
@controller.template.output_buffer = ''
@controller.template.flush_output_buffer
assert_equal '', @controller.template.output_buffer
assert_equal ['foo'], @response.body_parts
# Flushing appends the output buffer to the body parts
@controller.template.output_buffer = 'bar'
@controller.template.flush_output_buffer
assert_equal '', @controller.template.output_buffer
assert_equal ['foo', 'bar'], @response.body_parts
end
end
|