Updated README.rdoc again
[feedcatcher.git] / vendor / rails / actionpack / test / controller / capture_test.rb
1 require 'abstract_unit'
2
3 class CaptureController < ActionController::Base
4 def self.controller_name; "test"; end
5 def self.controller_path; "test"; end
6
7 def content_for
8 render :layout => "talk_from_action"
9 end
10
11 def content_for_with_parameter
12 render :layout => "talk_from_action"
13 end
14
15 def content_for_concatenated
16 render :layout => "talk_from_action"
17 end
18
19 def non_erb_block_content_for
20 render :layout => "talk_from_action"
21 end
22
23 def rescue_action(e) raise end
24 end
25
26 class CaptureTest < ActionController::TestCase
27 tests CaptureController
28
29 def setup
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)
33
34 @request.host = "www.nextangle.com"
35 end
36
37 def test_simple_capture
38 get :capturing
39 assert_equal "Dreamy days", @response.body.strip
40 end
41
42 def test_content_for
43 get :content_for
44 assert_equal expected_content_for_output, @response.body
45 end
46
47 def test_should_concatentate_content_for
48 get :content_for_concatenated
49 assert_equal expected_content_for_output, @response.body
50 end
51
52 def test_should_set_content_for_with_parameter
53 get :content_for_with_parameter
54 assert_equal expected_content_for_output, @response.body
55 end
56
57 def test_non_erb_block_content_for
58 get :non_erb_block_content_for
59 assert_equal expected_content_for_output, @response.body
60 end
61
62 private
63 def expected_content_for_output
64 "<title>Putting stuff in the title!</title>\n\nGreat stuff!"
65 end
66 end