@@ -21,47 +21,6 @@ def setup
2121 )
2222 end
2323
24- def full_path ( fn )
25- File . join ( APP_ROOT , fn )
26- end
27-
28- def test_find_route
29- entry = @app . find_route ( '/' )
30- assert_equal :not_found , entry [ :kind ]
31-
32- entry = @app . find_route ( '/test' )
33- assert_equal :static , entry [ :kind ]
34- assert_equal full_path ( 'index.html' ) , entry [ :fn ]
35-
36- entry = @app . find_route ( '/test/about' )
37- assert_equal :module , entry [ :kind ]
38- assert_equal full_path ( 'about/index.rb' ) , entry [ :fn ]
39-
40- entry = @app . find_route ( '/test/../test_app.rb' )
41- assert_equal :not_found , entry [ :kind ]
42-
43- entry = @app . find_route ( '/test/_layout/default' )
44- assert_equal :not_found , entry [ :kind ]
45-
46- entry = @app . find_route ( '/test/api' )
47- assert_equal :module , entry [ :kind ]
48- assert_equal full_path ( 'api+.rb' ) , entry [ :fn ]
49-
50- entry = @app . find_route ( '/test/api/foo/bar' )
51- assert_equal :module , entry [ :kind ]
52- assert_equal full_path ( 'api+.rb' ) , entry [ :fn ]
53-
54- entry = @app . find_route ( '/test/api/foo/../bar' )
55- assert_equal :not_found , entry [ :kind ]
56-
57- entry = @app . find_route ( '/test/api_1' )
58- assert_equal :not_found , entry [ :kind ]
59-
60- entry = @app . find_route ( '/test/about/foo' )
61- assert_equal :markdown , entry [ :kind ]
62- assert_equal full_path ( 'about/foo.md' ) , entry [ :fn ]
63- end
64-
6524 def make_request ( *, **)
6625 req = mock_req ( *, **)
6726 @app . call ( req )
@@ -136,6 +95,10 @@ def test_app_rendering
13695 assert_equal ( { status : 'Error' , message : 'Teapot' } , req . response_json )
13796 assert_equal Status ::TEAPOT , req . response_status
13897
98+ req = make_request ( ':method' => 'POST' , ':path' => '/test/api/foo/bar?q=incr' )
99+ assert_equal ( { status : 'Error' , message : 'Teapot' } , req . response_json )
100+ assert_equal Status ::TEAPOT , req . response_status
101+
139102 req = make_request ( ':method' => 'GET' , ':path' => '/test/bar' )
140103 assert_equal 'foobar' , req . response_body
141104 assert_equal Status ::OK , req . response_status
0 commit comments