1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Don't require rubygems in tests; do fall back if necessary

This commit is contained in:
Ryan Tomayko 2009-01-20 12:24:36 -08:00
parent 045f93be91
commit 9d329651b4
2 changed files with 11 additions and 2 deletions

View file

@ -9,6 +9,7 @@ task :spec => :test
Rake::TestTask.new(:test) do |t|
t.test_files = FileList['test/*_test.rb']
t.ruby_opts = ['-rubygems'] if defined? Gem
end
desc 'Run compatibility specs (requires test/spec)'

View file

@ -1,5 +1,13 @@
require 'rubygems' # required so that sinatra/base can require rack
$:.unshift File.dirname(File.dirname(__FILE__)) + '/lib'
begin
require 'rack'
rescue LoadError
require 'rubygems'
require 'rack'
end
libdir = File.dirname(File.dirname(__FILE__)) + '/lib'
$LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
require 'sinatra/base'
require 'sinatra/test/unit'