From e17681829fb5bd271e78c21c04a5693d0c6d1448 Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Wed, 28 Jan 2009 14:15:21 -0500 Subject: [PATCH] Use mongo-qa only if it is in a "sister directory", not a subdirectory. --- .gitignore | 1 - README.rdoc | 15 +++++++-------- Rakefile | 11 ----------- tests/test_round_trip.rb | 8 ++++---- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 2fc5882..3b7369a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ t pkg doc mongo-ruby-driver-*.gem -mongo-qa diff --git a/README.rdoc b/README.rdoc index e9c5148..e164c8a 100644 --- a/README.rdoc +++ b/README.rdoc @@ -133,17 +133,16 @@ The tests assume that the Mongo database is running on the default port. The project mongo-qa (http://github.com/mongodb/mongo-qa) contains many more Mongo driver tests that are language independent. To run thoses tests as part -of the "rake test" task, run +of the "rake test" task, download the code "next to" this directory. So, after +installing the mongo-qa code you would have these two directories next to each +other: - $ rake mongo_qa + $ ls + mongo-qa + mongo-ruby-driver $ rake test -The mongo_qa task uses the "git clone" command to make a copy of that project -in a directory named mongo-qa. If the directory already exists, then the -mongo_qa task uses "git pull" to updated the code that's there. The Ruby -driver tests will then use some of the data files from that project when it -runs BSON tests. You can delete this directory at any time if you don't want -to run those tests any more. +The tests run just fine if the mongo-qa directory is not there. Additionally, the script bin/validate is used by the mongo-qa project's validator script. diff --git a/Rakefile b/Rakefile index 8b5fa73..16101c6 100644 --- a/Rakefile +++ b/Rakefile @@ -11,17 +11,6 @@ Rake::TestTask.new do |t| t.test_files = FileList['tests/test*.rb'] end -desc "Clone or pull (update) the mongo-qa project used for testing" -task :mongo_qa do - if File.exist?('mongo-qa') - Dir.chdir('mongo-qa') do - system('git pull') - end - else - system('git clone git://github.com/mongodb/mongo-qa.git') - end -end - desc "Generate documentation" task :rdoc do FileUtils.rm_rf('html') diff --git a/tests/test_round_trip.rb b/tests/test_round_trip.rb index 8fde787..78637d0 100644 --- a/tests/test_round_trip.rb +++ b/tests/test_round_trip.rb @@ -8,9 +8,9 @@ require 'test/unit' # OrderedHash and then test both Ruby-to-BSON and BSON-to-Ruby translations. # # There is a whole other project that includes similar tests -# (http://github.com/mongodb/mongo-qa). If the directory ../mongo-qa exists, -# then we find the BSON test files there and use those, too. Use the Rake task -# "mongo_qa" to obtain those tests. +# (http://github.com/mongodb/mongo-qa). If the directory ../../mongo-qa +# exists, (that is, the top-level dir of mongo-qa is next to the top-level dir +# of this project), then we find the BSON test files there and use those, too. class RoundTripTest < Test::Unit::TestCase include XGen::Mongo::Driver @@ -47,7 +47,7 @@ EOS # Dynamically generate one test for each test file. This way, if one test # fails the others will still run. create_test_for_round_trip_files_in_dir(File.join(HERE, 'data')) - mongo_qa_dir = File.join(HERE, '..', 'mongo-qa/modules/bson_tests/tests') + mongo_qa_dir = File.join(HERE, '../..', 'mongo-qa/modules/bson_tests/tests') if File.exist?(mongo_qa_dir) %w(basic_types complex single_types).each { |subdir_name| create_test_for_round_trip_files_in_dir(File.join(mongo_qa_dir, subdir_name))