Skip to content

Commit

Permalink
tests: ensure -N/--no-default-middleware not supported in config.ru
Browse files Browse the repository at this point in the history
Continue to make it easy to migrate AWAY from unicorn because
vendor lock-in is the worst thing, especially if it's on us.
  • Loading branch information
Eric Wong committed Sep 18, 2018
1 parent 47fddb5 commit c93a392
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
25 changes: 25 additions & 0 deletions t/t0301-no-default-middleware-ignored-in-config.sh
@@ -0,0 +1,25 @@
#!/bin/sh
. ./test-lib.sh
t_plan 3 "-N / --no-default-middleware option not supported in config.ru"

t_begin "setup and start" && {
unicorn_setup
RACK_ENV=development unicorn -D -c $unicorn_config t0301.ru
unicorn_wait_start
}

t_begin "check switches parsed as expected and -N ignored for Rack::Lint" && {
debug=false
lint=
eval "$(curl -sf http://$listen/vars)"
test x"$debug" = xtrue
test x"$lint" != x
test -f "$lint"
}

t_begin "killing succeeds" && {
kill $unicorn_pid
check_stderr
}

t_done
13 changes: 13 additions & 0 deletions t/t0301.ru
@@ -0,0 +1,13 @@
#\-N --debug
run(lambda do |env|
case env['PATH_INFO']
when '/vars'
b = "debug=#{$DEBUG.inspect}\n" \
"lint=#{caller.grep(%r{rack/lint\.rb})[0].split(':')[0]}\n"
end
h = {
'Content-Length' => b.size.to_s,
'Content-Type' => 'text/plain',
}
[ 200, h, [ b ] ]
end)

0 comments on commit c93a392

Please sign in to comment.