mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
e424eaf052
Add a lowlevel_error_handler, so we can customize the default error message. example: ``` lowlevel_error_handler do [302, {'Content-Type' => 'text', 'Location' => 'foo.html'}, ['302 found']] end ``` [fix #458]
26 lines
591 B
Ruby
26 lines
591 B
Ruby
require 'test/unit'
|
|
|
|
require 'puma'
|
|
require 'puma/configuration'
|
|
|
|
class TestConfigFile < Test::Unit::TestCase
|
|
def test_app_from_app_DSL
|
|
opts = { :config_file => "test/config/app.rb" }
|
|
conf = Puma::Configuration.new opts
|
|
conf.load
|
|
|
|
app = conf.app
|
|
|
|
assert_equal [200, {}, ["embedded app"]], app.call({})
|
|
end
|
|
|
|
def test_lowleve_error_handler_DSL
|
|
opts = { :config_file => "test/config/app.rb" }
|
|
conf = Puma::Configuration.new opts
|
|
conf.load
|
|
|
|
app = conf.options[:lowlevel_error_handler]
|
|
|
|
assert_equal [200, {}, ["error page"]], app.call({})
|
|
end
|
|
end
|