aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/render_action_test.rb
blob: b6e98f82aaf7c6a7b27163d51e5cbd0dbdacba64 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")

module HappyPath
  
  class RenderActionController < ActionController::Base2
    
    def render_action_hello_world
      render :action => "hello_world"
    end
    
    def render_action_hello_world_as_string
      render "hello_world"
    end
    
    def render_action_hello_world_as_string_with_options
      render "hello_world", :status => 404
    end
    
    def render_action_hello_world_as_symbol
      render :hello_world
    end

    def render_action_hello_world_with_symbol
      render :action => :hello_world
    end
    
  end
  
  class TestRenderAction < SimpleRouteCase
    
    describe "Rendering an action using :action => <String>"
    
    get "/happy_path/render_action/render_action_hello_world"
    assert_body   "Hello world!"
    assert_status 200
    
  end
  
  class TestRenderActionWithString < SimpleRouteCase
    
    describe "Render an action using 'hello_world'"
    
    get "/happy_path/render_action/render_action_hello_world_as_string"
    assert_body   "Hello world!"
    assert_status 200
    
  end
  
  class TestRenderActionWithStringAndOptions < SimpleRouteCase
    
    describe "Render an action using 'hello_world'"
    
    get "/happy_path/render_action/render_action_hello_world_as_string_with_options"
    assert_body   "Hello world!"
    assert_status 404
    
  end
  
  class TestRenderActionAsSymbol < SimpleRouteCase
    describe "Render an action using :hello_world"
    
    get "/happy_path/render_action/render_action_hello_world_as_symbol"
    assert_body   "Hello world!"
    assert_status 200
  end
  
  class TestRenderActionWithSymbol < SimpleRouteCase
    describe "Render an action using :action => :hello_world"
    
    get "/happy_path/render_action/render_action_hello_world_with_symbol"
    assert_body   "Hello world!"
    assert_status 200
  end

end