diff --git a/test/integration/app.rb b/test/integration/app.rb new file mode 100644 index 00000000..b13d6e99 --- /dev/null +++ b/test/integration/app.rb @@ -0,0 +1,6 @@ +require 'sinatra' + +get '/app_file' do + content_type :txt + settings.app_file +end \ No newline at end of file diff --git a/test/integration_test.rb b/test/integration_test.rb new file mode 100644 index 00000000..c91f097c --- /dev/null +++ b/test/integration_test.rb @@ -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