Ruby: rack - extend rack tests

This commit is contained in:
Alex Ford
2023-06-13 11:46:59 +01:00
parent 4d59181571
commit e8079727ee
2 changed files with 22 additions and 0 deletions

View File

@@ -4,8 +4,10 @@ rackApps
| rack.rb:24:1:37:3 | Logger | rack.rb:30:12:30:14 | env |
| rack.rb:39:1:45:3 | Redirector | rack.rb:40:12:40:14 | env |
| rack.rb:59:1:75:3 | Baz | rack.rb:60:12:60:14 | env |
| rack.rb:77:1:95:3 | Qux | rack.rb:79:17:79:19 | env |
rackResponseContentTypes
| rack.rb:8:5:8:38 | call to [] | rack.rb:7:34:7:45 | "text/plain" |
| rack.rb:20:5:20:27 | call to [] | rack.rb:19:28:19:38 | "text/html" |
redirectResponses
| rack.rb:43:5:43:45 | call to [] | rack.rb:42:30:42:40 | "/foo.html" |
| rack.rb:93:5:93:78 | call to finish | rack.rb:93:60:93:70 | redirect_to |

View File

@@ -73,3 +73,23 @@ class Baz
[400, {}, "nope"]
end
end
class Qux
attr_reader :env
def self.call(env)
new(env).call
end
def initialize(env)
@env = env
end
def call
do_redirect
end
def do_redirect
redirect_to = env['redirect_to']
Rack::Response.new(['redirecting'], 302, 'Location' => redirect_to).finish
end
end