Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DummyServer::Servlet#not_found requires two arguments #761

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions spec/support/dummy_server/servlet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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!"
Expand All @@ -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!"
Expand Down