Add app reference to the handlers which are bound to the app

This commit is contained in:
Johannes Müller 2017-10-18 19:48:01 +02:00 committed by sdogruyol
parent dc93bb2235
commit 72bcac6dd5
12 changed files with 58 additions and 49 deletions

View file

@ -26,9 +26,8 @@ describe "Kemal::ExceptionHandler" do
app.get "/" do |env|
env.response.status_code = 403
end
context.app = app
subject = Kemal::ExceptionHandler.new(app)
subject.next = Kemal::RouteHandler.new
subject.next = app.route_handler
subject.call(context)
response.close
io.rewind
@ -50,9 +49,8 @@ describe "Kemal::ExceptionHandler" do
app.get "/" do |env|
env.response.status_code = 500
end
context.app = app
subject = Kemal::ExceptionHandler.new(app)
subject.next = Kemal::RouteHandler.new
subject.next = app.route_handler
subject.call(context)
response.close
io.rewind
@ -75,9 +73,8 @@ describe "Kemal::ExceptionHandler" do
env.response.content_type = "application/json"
env.response.status_code = 500
end
context.app = app
subject = Kemal::ExceptionHandler.new(app)
subject.next = Kemal::RouteHandler.new
subject.next = app.route_handler
subject.call(context)
response.close
io.rewind
@ -100,9 +97,8 @@ describe "Kemal::ExceptionHandler" do
env.response.content_type = "application/json"
env.response.status_code = 500
end
context.app = app
subject = Kemal::ExceptionHandler.new(Kemal::Base.new)
subject.next = Kemal::RouteHandler.new
subject = Kemal::ExceptionHandler.new(app)
subject.next = app.route_handler
subject.call(context)
response.close
io.rewind