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
< ActionController
::TestCase
27 tests CaptureController
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.host
= "www.nextangle.com"
37 def test_simple_capture
39 assert_equal
"Dreamy days", @response.body
.strip
44 assert_equal expected_content_for_output
, @response.body
47 def test_should_concatentate_content_for
48 get
:content_for_concatenated
49 assert_equal expected_content_for_output
, @response.body
52 def test_should_set_content_for_with_parameter
53 get
:content_for_with_parameter
54 assert_equal expected_content_for_output
, @response.body
57 def test_non_erb_block_content_for
58 get
:non_erb_block_content_for
59 assert_equal expected_content_for_output
, @response.body
63 def expected_content_for_output
64 "<title>Putting stuff in the title!</title>\n\nGreat stuff!"