sinatra/test/integration_test.rb

26 lines
795 B
Ruby
Raw Normal View History

2011-10-31 21:40:22 +00:00
require File.expand_path('../helper', __FILE__)
require File.expand_path('../integration_helper', __FILE__)
2011-10-31 21:40:22 +00:00
class IntegrationTest < Test::Unit::TestCase
extend IntegrationHelper
attr_accessor :server
it('sets the app_file') { assert_equal server.app_file, server.get("/app_file") }
it('only extends main') { assert_equal "true", server.get("/mainonly") }
2011-10-31 21:59:09 +00:00
it 'logs once in development mode' do
random = "%064x" % Kernel.rand(2**256-1)
server.get "/ping?x=#{random}"
assert_equal 1, server.log.scan("GET /ping?x=#{random}").count
2011-10-31 21:59:09 +00:00
end
it 'starts the correct server' do
exp = %r{
==\sSinatra/#{Sinatra::VERSION}\s
has\staken\sthe\sstage\son\s\d+\sfor\sdevelopment\s
with\sbackup\sfrom\s#{server}
}ix
2012-03-07 16:15:05 +00:00
assert_match exp, server.log
2012-03-07 16:15:05 +00:00
end
end