1 require 'abstract_unit'
3 class CaptureController
< ActionController
::Base
4 def self.controller_name
; "test"; end
5 def self.controller_path
; "test"; end
8 render
:layout => "talk_from_action"
11 def content_for_with_parameter
12 render
:layout => "talk_from_action"
15 def content_for_concatenated
16 render
:layout => "talk_from_action"
19 def non_erb_block_content_for
20 render
:layout => "talk_from_action"
23 def rescue_action(e
) raise end
26 class CaptureTest
< Test
::Unit::TestCase
28 @controller = CaptureController
.new
30 # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
31 # a more accurate simulation of what happens in "real life".
32 @controller.logger
= Logger
.new(nil)
34 @request = ActionController
::TestRequest.new
35 @response = ActionController
::TestResponse.new
37 @request.host
= "www.nextangle.com"
40 def test_simple_capture
42 assert_equal
"Dreamy days", @response.body
.strip
47 assert_equal expected_content_for_output
, @response.body
50 def test_should_concatentate_content_for
51 get
:content_for_concatenated
52 assert_equal expected_content_for_output
, @response.body
55 def test_should_set_content_for_with_parameter
56 get
:content_for_with_parameter
57 assert_equal expected_content_for_output
, @response.body
60 def test_non_erb_block_content_for
61 get
:non_erb_block_content_for
62 assert_equal expected_content_for_output
, @response.body
66 def expected_content_for_output
67 "<title>Putting stuff in the title!</title>\n\nGreat stuff!"