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:
parent
045f93be91
commit
9d329651b4
2 changed files with 11 additions and 2 deletions
1
Rakefile
1
Rakefile
|
@ -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)'
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue