aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/layout_test.rb
blob: f652453ebdf3f03c83e18852d4a24e9dec2a8540 (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
require File.dirname(__FILE__) + '/../abstract_unit'

class TestLayoutController < ActionController::Base
  layout "layouts/standard"
  
  def hello_world
  end
  
  def hello_world_outside_layout
  end

  def rescue_action(e) raise end
end

class ChildWithoutTestLayoutController < TestLayoutController
  layout nil

  def hello_world
  end
end

class ChildWithOtherTestLayoutController < TestLayoutController
  layout nil

  def hello_world
  end
end

class RenderTest < Test::Unit::TestCase
  def setup
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new

    @request.host = "www.nextangle.com"
  end

  def test_layout_rendering
    @request.action = "hello_world"
    response = process_request
    assert_equal "200 OK", response.headers["Status"]
    assert_equal "layouts/standard", response.template.template_name
  end


  private
    def process_request
      TestLayoutController.process(@request, @response)
    end
end