minor: more testing bug fixes, refactoring -- ideas from mlanett

This commit is contained in:
Tyler Brock 2012-02-06 20:51:44 -05:00
parent 2c82762782
commit d3948114ea

View File

@ -42,11 +42,14 @@ task :test do
puts "To test the pure ruby driver: \nrake test:ruby\n\n" puts "To test the pure ruby driver: \nrake test:ruby\n\n"
end end
task :path do
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
end
namespace :test do namespace :test do
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
desc "Test the driver with the C extension enabled." desc "Test the driver with the C extension enabled."
task :c do task :c => :path do
ENV['C_EXT'] = 'TRUE' ENV['C_EXT'] = 'TRUE'
if ENV['TEST'] if ENV['TEST']
Rake::Task['test:functional'].invoke Rake::Task['test:functional'].invoke
@ -61,7 +64,7 @@ namespace :test do
end end
desc "Test the driver using pure ruby (no C extension)" desc "Test the driver using pure ruby (no C extension)"
task :ruby do task :ruby => :path do
ENV['C_EXT'] = nil ENV['C_EXT'] = nil
if ENV['TEST'] if ENV['TEST']
Rake::Task['test:functional'].invoke Rake::Task['test:functional'].invoke
@ -123,7 +126,7 @@ namespace :test do
t.ruby_opts << '-w' t.ruby_opts << '-w'
end end
task :drop_databases do |t| task :drop_databases => :path do |t|
puts "Dropping test databases..." puts "Dropping test databases..."
require 'mongo' require 'mongo'
con = Mongo::Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost', con = Mongo::Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost',
@ -205,7 +208,7 @@ end
namespace :ci do namespace :ci do
namespace :test do namespace :test do
task :c do task :c => :path do
Rake::Task['gem:install'].invoke Rake::Task['gem:install'].invoke
Rake::Task['gem:install_extensions'].invoke Rake::Task['gem:install_extensions'].invoke
Rake::Task['test:c'].invoke Rake::Task['test:c'].invoke