From 7d31ddb7e507541e894dfb2c8550416934d4bdaa Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Wed, 6 Sep 2023 20:36:49 +0200 Subject: [PATCH] not_found requires two arguments --- spec/support/dummy_server/servlet.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/support/dummy_server/servlet.rb b/spec/support/dummy_server/servlet.rb index 96cb08de..9f835c33 100644 --- a/spec/support/dummy_server/servlet.rb +++ b/spec/support/dummy_server/servlet.rb @@ -9,9 +9,9 @@ def self.sockets @sockets ||= [] end - def not_found(_req, res) + def not_found(req, res) res.status = 404 - res.body = "Not Found" + res.body = "#{req.unparsed_uri} not found" end def self.handlers @@ -27,7 +27,7 @@ def self.#{method}(path, &block) def do_#{method.upcase}(req, res) handler = self.class.handlers["#{method}:\#{req.path}"] return instance_exec(req, res, &handler) if handler - not_found + not_found(req, res) end RUBY end @@ -68,7 +68,7 @@ def do_#{method.upcase}(req, res) end get "/params" do |req, res| - next not_found unless "foo=bar" == req.query_string + next not_found(req, res) unless "foo=bar" == req.query_string res.status = 200 res.body = "Params!" @@ -77,7 +77,7 @@ def do_#{method.upcase}(req, res) get "/multiple-params" do |req, res| params = CGI.parse req.query_string - next not_found unless {"foo" => ["bar"], "baz" => ["quux"]} == params + next not_found(req, res) unless {"foo" => ["bar"], "baz" => ["quux"]} == params res.status = 200 res.body = "More Params!"