roda 3.28.0 → 3.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/README.rdoc +10 -0
- data/doc/release_notes/3.29.0.txt +15 -0
- data/lib/roda.rb +1 -0
- data/lib/roda/plugins/caching.rb +2 -0
- data/lib/roda/plugins/common_logger.rb +1 -1
- data/lib/roda/plugins/exception_page.rb +7 -1
- data/lib/roda/plugins/indifferent_params.rb +2 -0
- data/lib/roda/version.rb +1 -1
- metadata +4 -214
- data/Rakefile +0 -108
- data/doc/release_notes/1.0.0.txt +0 -329
- data/doc/release_notes/1.1.0.txt +0 -226
- data/doc/release_notes/1.2.0.txt +0 -406
- data/doc/release_notes/1.3.0.txt +0 -109
- data/doc/release_notes/2.0.0.txt +0 -75
- data/doc/release_notes/2.1.0.txt +0 -124
- data/doc/release_notes/2.10.0.txt +0 -27
- data/doc/release_notes/2.11.0.txt +0 -70
- data/doc/release_notes/2.12.0.txt +0 -40
- data/doc/release_notes/2.13.0.txt +0 -10
- data/doc/release_notes/2.14.0.txt +0 -44
- data/doc/release_notes/2.15.0.txt +0 -53
- data/doc/release_notes/2.16.0.txt +0 -48
- data/doc/release_notes/2.17.0.txt +0 -62
- data/doc/release_notes/2.18.0.txt +0 -69
- data/doc/release_notes/2.19.0.txt +0 -30
- data/doc/release_notes/2.2.0.txt +0 -97
- data/doc/release_notes/2.20.0.txt +0 -5
- data/doc/release_notes/2.21.0.txt +0 -17
- data/doc/release_notes/2.22.0.txt +0 -41
- data/doc/release_notes/2.23.0.txt +0 -29
- data/doc/release_notes/2.24.0.txt +0 -65
- data/doc/release_notes/2.25.0.txt +0 -14
- data/doc/release_notes/2.26.0.txt +0 -13
- data/doc/release_notes/2.27.0.txt +0 -56
- data/doc/release_notes/2.28.0.txt +0 -17
- data/doc/release_notes/2.29.0.txt +0 -156
- data/doc/release_notes/2.3.0.txt +0 -109
- data/doc/release_notes/2.4.0.txt +0 -55
- data/doc/release_notes/2.5.0.txt +0 -23
- data/doc/release_notes/2.5.1.txt +0 -4
- data/doc/release_notes/2.6.0.txt +0 -21
- data/doc/release_notes/2.7.0.txt +0 -75
- data/doc/release_notes/2.8.0.txt +0 -44
- data/doc/release_notes/2.9.0.txt +0 -6
- data/spec/all.rb +0 -1
- data/spec/assets/css/app.scss +0 -1
- data/spec/assets/css/no_access.css +0 -1
- data/spec/assets/css/raw.css +0 -1
- data/spec/assets/js/head/app.js +0 -1
- data/spec/composition_spec.rb +0 -31
- data/spec/define_roda_method_spec.rb +0 -274
- data/spec/env_spec.rb +0 -11
- data/spec/freeze_spec.rb +0 -37
- data/spec/integration_spec.rb +0 -209
- data/spec/matchers_spec.rb +0 -832
- data/spec/opts_spec.rb +0 -42
- data/spec/plugin/_after_hook_spec.rb +0 -19
- data/spec/plugin/all_verbs_spec.rb +0 -29
- data/spec/plugin/assets_preloading_spec.rb +0 -98
- data/spec/plugin/assets_spec.rb +0 -745
- data/spec/plugin/backtracking_array_spec.rb +0 -42
- data/spec/plugin/branch_locals_spec.rb +0 -106
- data/spec/plugin/caching_spec.rb +0 -337
- data/spec/plugin/chunked_spec.rb +0 -201
- data/spec/plugin/class_level_routing_spec.rb +0 -164
- data/spec/plugin/class_matchers_spec.rb +0 -40
- data/spec/plugin/common_logger_spec.rb +0 -85
- data/spec/plugin/content_for_spec.rb +0 -162
- data/spec/plugin/content_security_policy_spec.rb +0 -175
- data/spec/plugin/cookies_spec.rb +0 -51
- data/spec/plugin/csrf_spec.rb +0 -111
- data/spec/plugin/default_headers_spec.rb +0 -82
- data/spec/plugin/default_status_spec.rb +0 -95
- data/spec/plugin/delay_build_spec.rb +0 -23
- data/spec/plugin/delegate_spec.rb +0 -23
- data/spec/plugin/delete_empty_headers_spec.rb +0 -27
- data/spec/plugin/direct_call_spec.rb +0 -28
- data/spec/plugin/disallow_file_uploads_spec.rb +0 -25
- data/spec/plugin/drop_body_spec.rb +0 -24
- data/spec/plugin/early_hints_spec.rb +0 -19
- data/spec/plugin/empty_root_spec.rb +0 -14
- data/spec/plugin/environments_spec.rb +0 -42
- data/spec/plugin/error_email_spec.rb +0 -97
- data/spec/plugin/error_handler_spec.rb +0 -216
- data/spec/plugin/error_mail_spec.rb +0 -93
- data/spec/plugin/exception_page_spec.rb +0 -168
- data/spec/plugin/flash_spec.rb +0 -121
- data/spec/plugin/h_spec.rb +0 -11
- data/spec/plugin/halt_spec.rb +0 -119
- data/spec/plugin/hash_matcher_spec.rb +0 -27
- data/spec/plugin/hash_routes_spec.rb +0 -535
- data/spec/plugin/head_spec.rb +0 -52
- data/spec/plugin/header_matchers_spec.rb +0 -98
- data/spec/plugin/heartbeat_spec.rb +0 -74
- data/spec/plugin/hooks_spec.rb +0 -152
- data/spec/plugin/indifferent_params_spec.rb +0 -14
- data/spec/plugin/json_parser_spec.rb +0 -141
- data/spec/plugin/json_spec.rb +0 -83
- data/spec/plugin/mail_processor_spec.rb +0 -451
- data/spec/plugin/mailer_spec.rb +0 -282
- data/spec/plugin/match_affix_spec.rb +0 -43
- data/spec/plugin/match_hook_spec.rb +0 -79
- data/spec/plugin/middleware_spec.rb +0 -237
- data/spec/plugin/middleware_stack_spec.rb +0 -81
- data/spec/plugin/module_include_spec.rb +0 -48
- data/spec/plugin/multi_route_spec.rb +0 -268
- data/spec/plugin/multi_run_spec.rb +0 -87
- data/spec/plugin/multi_view_spec.rb +0 -50
- data/spec/plugin/multibyte_string_matcher_spec.rb +0 -44
- data/spec/plugin/named_templates_spec.rb +0 -96
- data/spec/plugin/not_allowed_spec.rb +0 -69
- data/spec/plugin/not_found_spec.rb +0 -128
- data/spec/plugin/optimized_string_matchers_spec.rb +0 -43
- data/spec/plugin/padrino_render_spec.rb +0 -34
- data/spec/plugin/param_matchers_spec.rb +0 -69
- data/spec/plugin/params_capturing_spec.rb +0 -33
- data/spec/plugin/partials_spec.rb +0 -43
- data/spec/plugin/pass_spec.rb +0 -29
- data/spec/plugin/path_matchers_spec.rb +0 -42
- data/spec/plugin/path_rewriter_spec.rb +0 -45
- data/spec/plugin/path_spec.rb +0 -222
- data/spec/plugin/placeholder_string_matchers_spec.rb +0 -126
- data/spec/plugin/precompile_templates_spec.rb +0 -61
- data/spec/plugin/public_spec.rb +0 -85
- data/spec/plugin/render_each_spec.rb +0 -82
- data/spec/plugin/render_locals_spec.rb +0 -114
- data/spec/plugin/render_spec.rb +0 -912
- data/spec/plugin/request_aref_spec.rb +0 -51
- data/spec/plugin/request_headers_spec.rb +0 -39
- data/spec/plugin/response_request_spec.rb +0 -43
- data/spec/plugin/route_block_args_spec.rb +0 -86
- data/spec/plugin/route_csrf_spec.rb +0 -305
- data/spec/plugin/run_append_slash_spec.rb +0 -77
- data/spec/plugin/run_handler_spec.rb +0 -53
- data/spec/plugin/sessions_spec.rb +0 -452
- data/spec/plugin/shared_vars_spec.rb +0 -45
- data/spec/plugin/sinatra_helpers_spec.rb +0 -537
- data/spec/plugin/slash_path_empty_spec.rb +0 -22
- data/spec/plugin/static_routing_spec.rb +0 -192
- data/spec/plugin/static_spec.rb +0 -30
- data/spec/plugin/status_303_spec.rb +0 -28
- data/spec/plugin/status_handler_spec.rb +0 -158
- data/spec/plugin/streaming_spec.rb +0 -246
- data/spec/plugin/strip_path_prefix_spec.rb +0 -24
- data/spec/plugin/symbol_matchers_spec.rb +0 -51
- data/spec/plugin/symbol_status_spec.rb +0 -25
- data/spec/plugin/symbol_views_spec.rb +0 -32
- data/spec/plugin/timestamp_public_spec.rb +0 -85
- data/spec/plugin/type_routing_spec.rb +0 -348
- data/spec/plugin/typecast_params_spec.rb +0 -1370
- data/spec/plugin/unescape_path_spec.rb +0 -22
- data/spec/plugin/view_options_spec.rb +0 -170
- data/spec/plugin_spec.rb +0 -71
- data/spec/redirect_spec.rb +0 -41
- data/spec/request_spec.rb +0 -97
- data/spec/response_spec.rb +0 -199
- data/spec/route_spec.rb +0 -39
- data/spec/session_middleware_spec.rb +0 -129
- data/spec/session_spec.rb +0 -37
- data/spec/spec_helper.rb +0 -137
- data/spec/version_spec.rb +0 -14
- data/spec/views/_test.erb +0 -1
- data/spec/views/a.erb +0 -1
- data/spec/views/a.rdoc +0 -2
- data/spec/views/about.erb +0 -1
- data/spec/views/about.str +0 -1
- data/spec/views/about/_test.css.gz +0 -0
- data/spec/views/about/_test.erb +0 -1
- data/spec/views/about/_test.erb.gz +0 -0
- data/spec/views/about/comp_test.erb +0 -1
- data/spec/views/b.erb +0 -1
- data/spec/views/c.erb +0 -1
- data/spec/views/comp_layout.erb +0 -1
- data/spec/views/comp_test.erb +0 -1
- data/spec/views/content-yield.erb +0 -1
- data/spec/views/each.str +0 -1
- data/spec/views/home.erb +0 -2
- data/spec/views/home.str +0 -2
- data/spec/views/iv.erb +0 -1
- data/spec/views/layout-alternative.erb +0 -2
- data/spec/views/layout-yield.erb +0 -3
- data/spec/views/layout.erb +0 -2
- data/spec/views/layout.str +0 -2
- data/spec/views/multiple-layout.erb +0 -1
- data/spec/views/multiple.erb +0 -1
@@ -1,50 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'tilt/erb'
|
5
|
-
rescue LoadError
|
6
|
-
warn "tilt not installed, skipping multi_view plugin test"
|
7
|
-
else
|
8
|
-
describe "multi_view plugin" do
|
9
|
-
before do
|
10
|
-
app(:bare) do
|
11
|
-
plugin :render, :views=>'spec/views', :layout=>'layout-yield'
|
12
|
-
plugin :multi_view
|
13
|
-
|
14
|
-
route do |r|
|
15
|
-
r.multi_view(['a', 'b', 'c'])
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it "supports easy rendering of multiple views by name" do
|
21
|
-
body('/a').gsub(/\s+/, '').must_equal "HeaderaFooter"
|
22
|
-
body('/b').gsub(/\s+/, '').must_equal "HeaderbFooter"
|
23
|
-
body('/c').gsub(/\s+/, '').must_equal "HeadercFooter"
|
24
|
-
status('/d').must_equal 404
|
25
|
-
status('/a', 'REQUEST_METHOD'=>'POST').must_equal 404
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "multi_view plugin multi_view_compile method " do
|
30
|
-
before do
|
31
|
-
app(:bare) do
|
32
|
-
plugin :render, :views=>'spec/views', :layout=>'layout-yield'
|
33
|
-
plugin :multi_view
|
34
|
-
regexp = multi_view_compile(['a', 'b', 'c'])
|
35
|
-
|
36
|
-
route do |r|
|
37
|
-
r.multi_view(regexp)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it "supports easy rendering of multiple views by name" do
|
43
|
-
body('/a').gsub(/\s+/, '').must_equal "HeaderaFooter"
|
44
|
-
body('/b').gsub(/\s+/, '').must_equal "HeaderbFooter"
|
45
|
-
body('/c').gsub(/\s+/, '').must_equal "HeadercFooter"
|
46
|
-
status('/d').must_equal 404
|
47
|
-
status('/a', 'REQUEST_METHOD'=>'POST').must_equal 404
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
describe "multibyte_string_matcher plugin" do
|
4
|
-
it "uses multibyte safe string matching" do
|
5
|
-
str = "\xD0\xB8".dup.force_encoding('UTF-8')
|
6
|
-
app(:unescape_path) do |r|
|
7
|
-
r.is String do |s|
|
8
|
-
s
|
9
|
-
end
|
10
|
-
|
11
|
-
r.is(Integer, /(#{str})/u) do |_, a|
|
12
|
-
a
|
13
|
-
end
|
14
|
-
|
15
|
-
r.is(Integer, Integer, str) do
|
16
|
-
'm'
|
17
|
-
end
|
18
|
-
|
19
|
-
r.is(Integer, str, Integer) do
|
20
|
-
'n'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
body('/%D0%B8').must_equal str
|
25
|
-
body('/1/%D0%B8').must_equal str
|
26
|
-
status('/1/2/%D0%B8').must_equal 404
|
27
|
-
status('/1/%D0%B8/2').must_equal 404
|
28
|
-
|
29
|
-
status('/1/%D0%B9').must_equal 404
|
30
|
-
status('/1/2/%D0%B9').must_equal 404
|
31
|
-
status('/1/%D0%B9/2').must_equal 404
|
32
|
-
|
33
|
-
@app.plugin :multibyte_string_matcher
|
34
|
-
|
35
|
-
body('/%D0%B8').must_equal str
|
36
|
-
body('/1/%D0%B8').must_equal str
|
37
|
-
body('/1/2/%D0%B8').must_equal 'm'
|
38
|
-
body('/1/%D0%B8/2').must_equal 'n'
|
39
|
-
|
40
|
-
status('/1/%D0%B9').must_equal 404
|
41
|
-
status('/1/2/%D0%B9').must_equal 404
|
42
|
-
status('/1/%D0%B9/2').must_equal 404
|
43
|
-
end
|
44
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'tilt/erb'
|
5
|
-
rescue LoadError
|
6
|
-
warn "tilt not installed, skipping named_templates plugin test"
|
7
|
-
else
|
8
|
-
describe "named_templates plugin" do
|
9
|
-
it "adds template method method for naming templates, and have render recognize it" do
|
10
|
-
app(:bare) do
|
11
|
-
plugin :named_templates
|
12
|
-
|
13
|
-
template :foo do
|
14
|
-
@b = 2
|
15
|
-
"foo<%= @a %><%= @b %>"
|
16
|
-
end
|
17
|
-
template :layout, :engine=>:str do
|
18
|
-
@c = 3
|
19
|
-
'bar#{@a}#{@c}-#{yield}-baz'
|
20
|
-
end
|
21
|
-
|
22
|
-
route do |r|
|
23
|
-
@a = 1
|
24
|
-
view(:foo)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
body.must_equal 'bar13-foo12-baz'
|
29
|
-
@app = Class.new(@app)
|
30
|
-
body.must_equal 'bar13-foo12-baz'
|
31
|
-
end
|
32
|
-
|
33
|
-
it "works when freezing the app" do
|
34
|
-
app(:bare) do
|
35
|
-
plugin :named_templates
|
36
|
-
|
37
|
-
template :foo do
|
38
|
-
@b = 2
|
39
|
-
"foo<%= @a %><%= @b %>"
|
40
|
-
end
|
41
|
-
template :layout, :engine=>:str do
|
42
|
-
@c = 3
|
43
|
-
'bar#{@a}#{@c}-#{yield}-baz'
|
44
|
-
end
|
45
|
-
|
46
|
-
route do |r|
|
47
|
-
@a = 1
|
48
|
-
view(:foo)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
app.freeze
|
53
|
-
body.must_equal 'bar13-foo12-baz'
|
54
|
-
|
55
|
-
proc{app.template(:b){"a"}}.must_raise
|
56
|
-
end
|
57
|
-
|
58
|
-
it "works with the view_options plugin" do
|
59
|
-
app(:bare) do
|
60
|
-
plugin :render
|
61
|
-
plugin :view_options
|
62
|
-
plugin :named_templates
|
63
|
-
|
64
|
-
template "foo/bar" do
|
65
|
-
@b = 2
|
66
|
-
"foobar<%= @a %><%= @b %>"
|
67
|
-
end
|
68
|
-
template "foo/layout", :engine=>:str do
|
69
|
-
@c = 3
|
70
|
-
'foo#{@a}#{@c}-#{yield}-baz'
|
71
|
-
end
|
72
|
-
template "bar/layout", :engine=>:str do
|
73
|
-
@c = 3
|
74
|
-
'bar#{@a}#{@c}-#{yield}-baz'
|
75
|
-
end
|
76
|
-
|
77
|
-
route do |r|
|
78
|
-
r.is 'foo' do
|
79
|
-
set_view_subdir :foo
|
80
|
-
@a = 1
|
81
|
-
view(:bar)
|
82
|
-
end
|
83
|
-
r.is 'bar' do
|
84
|
-
set_view_subdir :bar
|
85
|
-
@a = 4
|
86
|
-
@b = 2
|
87
|
-
view(:inline=>"barfoo<%= @a %><%= @b %>")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
body('/foo').must_equal 'foo13-foobar12-baz'
|
93
|
-
body('/bar').must_equal 'bar43-barfoo42-baz'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
describe "not_allowed plugin" do
|
4
|
-
it "skips the current block if pass is called" do
|
5
|
-
app(:not_allowed) do |r|
|
6
|
-
r.get '' do
|
7
|
-
'a'
|
8
|
-
end
|
9
|
-
|
10
|
-
r.is "c" do
|
11
|
-
r.get do
|
12
|
-
"cg"
|
13
|
-
end
|
14
|
-
|
15
|
-
r.post do
|
16
|
-
"cp"
|
17
|
-
end
|
18
|
-
|
19
|
-
"c"
|
20
|
-
end
|
21
|
-
|
22
|
-
r.on "q" do
|
23
|
-
r.is do
|
24
|
-
r.get do
|
25
|
-
"q"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
r.get do
|
31
|
-
r.is 'b' do
|
32
|
-
'b'
|
33
|
-
end
|
34
|
-
r.is(/(d)/) do |s|
|
35
|
-
s
|
36
|
-
end
|
37
|
-
r.get(/(e)/) do |s|
|
38
|
-
s
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
body.must_equal 'a'
|
44
|
-
status('REQUEST_METHOD'=>'POST').must_equal 405
|
45
|
-
header('Allow', 'REQUEST_METHOD'=>'POST').must_equal 'GET'
|
46
|
-
|
47
|
-
body('/b').must_equal 'b'
|
48
|
-
status('/b', 'REQUEST_METHOD'=>'POST').must_equal 404
|
49
|
-
|
50
|
-
body('/d').must_equal 'd'
|
51
|
-
status('/d', 'REQUEST_METHOD'=>'POST').must_equal 404
|
52
|
-
|
53
|
-
body('/e').must_equal 'e'
|
54
|
-
status('/e', 'REQUEST_METHOD'=>'POST').must_equal 404
|
55
|
-
|
56
|
-
body('/q').must_equal 'q'
|
57
|
-
status('/q', 'REQUEST_METHOD'=>'POST').must_equal 405
|
58
|
-
|
59
|
-
body('/c').must_equal 'cg'
|
60
|
-
body('/c').must_equal 'cg'
|
61
|
-
body('/c', 'REQUEST_METHOD'=>'POST').must_equal 'cp'
|
62
|
-
body('/c', 'REQUEST_METHOD'=>'PATCH').must_equal 'c'
|
63
|
-
status('/c', 'REQUEST_METHOD'=>'PATCH').must_equal 405
|
64
|
-
header('Allow', '/c', 'REQUEST_METHOD'=>'PATCH').must_equal 'GET, POST'
|
65
|
-
|
66
|
-
@app.plugin :head
|
67
|
-
header('Allow', '/c', 'REQUEST_METHOD'=>'PATCH').must_equal 'HEAD, GET, POST'
|
68
|
-
end
|
69
|
-
end
|
@@ -1,128 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
describe "not_found plugin" do
|
4
|
-
it "executes on no arguments" do
|
5
|
-
app(:bare) do
|
6
|
-
plugin :not_found
|
7
|
-
|
8
|
-
not_found do
|
9
|
-
"not found"
|
10
|
-
end
|
11
|
-
|
12
|
-
route do |r|
|
13
|
-
r.on "a" do
|
14
|
-
"found"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
body.must_equal 'not found'
|
20
|
-
status.must_equal 404
|
21
|
-
body("/a").must_equal 'found'
|
22
|
-
status("/a").must_equal 200
|
23
|
-
end
|
24
|
-
|
25
|
-
it "allows overriding status inside not_found" do
|
26
|
-
app(:bare) do
|
27
|
-
plugin :not_found
|
28
|
-
|
29
|
-
not_found do
|
30
|
-
response.status = 403
|
31
|
-
"not found"
|
32
|
-
end
|
33
|
-
|
34
|
-
route do |r|
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
status.must_equal 403
|
39
|
-
end
|
40
|
-
|
41
|
-
it "calculates correct Content-Length" do
|
42
|
-
app(:bare) do
|
43
|
-
plugin :not_found do
|
44
|
-
"a"
|
45
|
-
end
|
46
|
-
|
47
|
-
route{}
|
48
|
-
end
|
49
|
-
|
50
|
-
header('Content-Length').must_equal "1"
|
51
|
-
end
|
52
|
-
|
53
|
-
it "clears existing headers" do
|
54
|
-
app(:bare) do
|
55
|
-
plugin :not_found do ||
|
56
|
-
"a"
|
57
|
-
end
|
58
|
-
|
59
|
-
route do |r|
|
60
|
-
response['Content-Type'] = 'text/pdf'
|
61
|
-
response['Foo'] = 'bar'
|
62
|
-
nil
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
header('Content-Type').must_equal 'text/html'
|
67
|
-
header('Foo').must_be_nil
|
68
|
-
end
|
69
|
-
|
70
|
-
it "does not modify behavior if not_found is not called" do
|
71
|
-
app(:not_found) do |r|
|
72
|
-
r.on "a" do
|
73
|
-
"found"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
body.must_equal ''
|
78
|
-
body("/a").must_equal 'found'
|
79
|
-
end
|
80
|
-
|
81
|
-
it "can set not_found via the plugin block" do
|
82
|
-
app(:bare) do
|
83
|
-
plugin :not_found do
|
84
|
-
"not found"
|
85
|
-
end
|
86
|
-
|
87
|
-
route do |r|
|
88
|
-
r.on "a" do
|
89
|
-
"found"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
body.must_equal 'not found'
|
95
|
-
body("/a").must_equal 'found'
|
96
|
-
end
|
97
|
-
|
98
|
-
it "does not modify behavior if body is not an array" do
|
99
|
-
app(:bare) do
|
100
|
-
plugin :not_found do
|
101
|
-
"not found"
|
102
|
-
end
|
103
|
-
|
104
|
-
o = Object.new
|
105
|
-
def o.each; end
|
106
|
-
route do |r|
|
107
|
-
r.halt [404, {}, o]
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
body.must_equal ''
|
112
|
-
end
|
113
|
-
|
114
|
-
it "does not modify behavior if body is not an empty array" do
|
115
|
-
app(:bare) do
|
116
|
-
plugin :not_found do
|
117
|
-
"not found"
|
118
|
-
end
|
119
|
-
|
120
|
-
route do |r|
|
121
|
-
response.status = 404
|
122
|
-
response.write 'a'
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
body.must_equal 'a'
|
127
|
-
end
|
128
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
describe "optimized_string_matchers plugin" do
|
4
|
-
it "should support on_branch and is_exactly match methods" do
|
5
|
-
app(:optimized_string_matchers) do |r|
|
6
|
-
r.on_branch "e" do
|
7
|
-
r.is_exactly "f" do
|
8
|
-
"ef"
|
9
|
-
end
|
10
|
-
|
11
|
-
"ee"
|
12
|
-
end
|
13
|
-
|
14
|
-
r.on_branch "a" do
|
15
|
-
r.on_branch "b" do
|
16
|
-
r.is_exactly "c" do
|
17
|
-
"c"
|
18
|
-
end
|
19
|
-
|
20
|
-
"b"
|
21
|
-
end
|
22
|
-
|
23
|
-
"a"
|
24
|
-
end
|
25
|
-
|
26
|
-
"cc"
|
27
|
-
end
|
28
|
-
|
29
|
-
body.must_equal 'cc'
|
30
|
-
body('/a').must_equal 'a'
|
31
|
-
body('/a/').must_equal 'a'
|
32
|
-
body('/a/b/').must_equal 'b'
|
33
|
-
body('/a/b/c').must_equal 'c'
|
34
|
-
body('/a/b/c/').must_equal 'b'
|
35
|
-
body('/a/b/c/d').must_equal 'b'
|
36
|
-
body('/e').must_equal 'ee'
|
37
|
-
body('/eb').must_equal 'cc'
|
38
|
-
body('/e/').must_equal 'ee'
|
39
|
-
body('/e/f').must_equal 'ef'
|
40
|
-
body('/e/f/').must_equal 'ee'
|
41
|
-
body('/e/fe').must_equal 'ee'
|
42
|
-
end
|
43
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative "../spec_helper"
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'tilt/erb'
|
5
|
-
rescue LoadError
|
6
|
-
warn "tilt not installed, skipping padrino_render plugin test"
|
7
|
-
else
|
8
|
-
describe "padrino_render plugin" do
|
9
|
-
before do
|
10
|
-
app(:bare) do
|
11
|
-
plugin :padrino_render, :views=>"./spec/views"
|
12
|
-
|
13
|
-
route do |r|
|
14
|
-
|
15
|
-
r.is "render" do
|
16
|
-
render(:content=>'bar', :layout_opts=>{:locals=>{:title=>"Home"}})
|
17
|
-
end
|
18
|
-
|
19
|
-
r.is "render/nolayout" do
|
20
|
-
render("about", :locals=>{:title => "No Layout"}, :layout=>nil)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
it "render uses layout by default" do
|
27
|
-
body("/render").strip.must_equal "<title>Roda: Home</title>\nbar"
|
28
|
-
end
|
29
|
-
|
30
|
-
it "render doesn't use layout if layout is nil" do
|
31
|
-
body("/render/nolayout").strip.must_equal "<h1>No Layout</h1>"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|