aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/render_template_test.rb
blob: 758a206dbb3bc36e1fcadfe1b056cc63a18e430c (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
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")

module HappyPath
  
  class RenderTemplateController < ActionController::Base2
    
    def render_hello_world
      render :template => "test/basic"
    end

    def render_hello_world_with_forward_slash
      render :template => "/test/basic"
    end

    def render_template_in_top_directory
      render :template => 'shared'
    end

    def render_template_in_top_directory_with_slash
      render :template => '/shared'
    end
  end
  
  class TestTemplateRender < SimpleRouteCase
    describe "rendering a normal template with full path"
    
    get "/happy_path/render_template/render_hello_world"
    assert_body   "Hello from basic.html.erb"
    assert_status 200
  end
  
  class TestTemplateRenderWithForwardSlash < SimpleRouteCase
    describe "rendering a normal template with full path starting with a leading slash"
    
    get "/happy_path/render_template/render_hello_world_with_forward_slash"
    assert_body   "Hello from basic.html.erb"
    assert_status 200
  end
  
  class TestTemplateRenderInTopDirectory < SimpleRouteCase
    describe "rendering a template not in a subdirectory"
    
    get "/happy_path/render_template/render_template_in_top_directory"
    assert_body   "Elastica"
    assert_status 200
  end

  class TestTemplateRenderInTopDirectoryWithSlash < SimpleRouteCase
    describe "rendering a template not in a subdirectory with a leading slash"
    
    get "/happy_path/render_template/render_template_in_top_directory_with_slash"
    assert_body   "Elastica"
    assert_status 200
  end

end