mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
add integration test
This commit is contained in:
parent
1ef2e5f84d
commit
6232c77a99
2 changed files with 28 additions and 0 deletions
6
test/integration/app.rb
Normal file
6
test/integration/app.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
require 'sinatra'
|
||||
|
||||
get '/app_file' do
|
||||
content_type :txt
|
||||
settings.app_file
|
||||
end
|
22
test/integration_test.rb
Normal file
22
test/integration_test.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
require File.expand_path('../helper', __FILE__)
|
||||
require 'rbconfig'
|
||||
require 'open-uri'
|
||||
|
||||
class IntegrationTest < Test::Unit::TestCase
|
||||
it 'starts a top level application' do
|
||||
cmd = []
|
||||
app_file = File.expand_path('../integration/app.rb', __FILE__)
|
||||
if RbConfig.respond_to? :ruby
|
||||
cmd << RbConfig.ruby.inspect
|
||||
else
|
||||
file, dir = RbConfig::CONFIG.values_at('ruby_install_name', 'bindir')
|
||||
cmd << File.expand_path(file, dir).inspect
|
||||
end
|
||||
cmd << "-I" << File.expand_path('../../lib', __FILE__).inspect
|
||||
cmd << app_file.inspect
|
||||
cmd << "2>&1"
|
||||
pipe = IO.popen(cmd.join(" "))
|
||||
assert_equal open('http://localhost:4567/app_file').read, app_file
|
||||
Process.kill("TERM", pipe.pid)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue