1
1
require 'test_helper'
2
2
3
- class PjaxControllerTest < ActionController ::TestCase
3
+ class DefaultLayoutControllerTest < ActionController ::TestCase
4
4
test 'renders without layout' do
5
5
request . env [ 'HTTP_X_PJAX' ] = true
6
6
7
7
get :index
8
8
9
9
if Rails ::VERSION ::STRING >= '4.0.0'
10
- assert_equal 'pjax #index', response . body
10
+ assert_match 'default_layout #index', response . body
11
11
else
12
12
# The behavior for ~> 3.0 varies from 4.0. If there is a layout for parent
13
13
# controller and `layout` in parent controller is set to false it will be
14
14
# rendered anyway with a warning in a log file. It should be set explicit
15
15
# in child controller.
16
- assert_equal 'layouts/application pjax #index' , response . body
16
+ assert_match 'layouts/application default_layout #index' , response . body
17
17
end
18
18
end
19
19
20
20
test 'renders with default layout' do
21
21
get :index
22
22
23
- assert_equal 'layouts/application pjax #index' , response . body
23
+ assert_match 'layouts/application default_layout #index' , response . body
24
24
end
25
25
26
26
test 'prevents pjax' do
@@ -36,20 +36,20 @@ class PjaxControllerTest < ActionController::TestCase
36
36
37
37
get :index , '_pjax' => true
38
38
39
- assert_equal ( { 'controller' => 'pjax ' , 'action' => 'index' } , @controller . params )
39
+ assert_equal ( { 'controller' => 'default_layout ' , 'action' => 'index' } , @controller . params )
40
40
assert_equal '' , request . env [ 'QUERY_STRING' ]
41
41
assert_nil request . env [ 'rack.request.query_string' ]
42
42
assert_nil request . env [ 'rack.request.query_hash' ]
43
43
assert_nil request . env [ 'action_dispatch.request.query_parameters' ]
44
- assert_equal '/pjax ' , request . original_fullpath
45
- assert_equal '/pjax ' , request . fullpath
44
+ assert_equal '/default_layout ' , request . original_fullpath
45
+ assert_equal '/default_layout ' , request . fullpath
46
46
end
47
47
48
48
test 'sets pjax url' do
49
49
request . env [ 'HTTP_X_PJAX' ] = true
50
50
51
51
get :index
52
52
53
- assert_equal 'http://test.host/pjax ' , response . headers [ 'X-PJAX-URL' ]
53
+ assert_equal 'http://test.host/default_layout ' , response . headers [ 'X-PJAX-URL' ]
54
54
end
55
55
end
0 commit comments