diff --git a/README.textile b/README.textile index c21c3f27..54e331f6 100644 --- a/README.textile +++ b/README.textile @@ -64,8 +64,12 @@ h2. Tests You can run tests both with * `rake test` or just `rake` -* run any test file directly, e.g. `ruby -Itest test/api/simple_test.rb` -* run all tests with `ruby -Itest test/all.rb` +* run any test file directly, e.g. `ruby -Ilib -Itest test/api/simple_test.rb` +* run all tests with `ruby -Ilib -Itest test/all.rb` + +You can run all tests against all Gemfiles with + +* `ruby test/run_all.rb` The structure of the test suite is a bit unusual as it uses modules to reuse particular tests in different test cases. diff --git a/ci/Gemfile.no-rails.lock b/ci/Gemfile.no-rails.lock new file mode 100644 index 00000000..69edfd33 --- /dev/null +++ b/ci/Gemfile.no-rails.lock @@ -0,0 +1,17 @@ +GEM + remote: http://rubygems.org/ + specs: + mocha (0.9.9) + rake + rake (0.8.7) + test_declarative (0.0.4) + +PLATFORMS + ruby + +DEPENDENCIES + mocha + test_declarative + +METADATA + version: 1.0.6 diff --git a/test/run_all.rb b/test/run_all.rb new file mode 100644 index 00000000..048b3a01 --- /dev/null +++ b/test/run_all.rb @@ -0,0 +1,21 @@ +def bundle_check + `bundle check` == "The Gemfile's dependencies are satisfied\n" +end + +command = 'ruby -w -Ilib -Itest test/all.rb' +gemfiles = %w(ci/Gemfile.all ci/Gemfile.rails-3.x ci/Gemfile.rails-2.3.x ci/Gemfile.no-rails) + +results = gemfiles.map do |gemfile| + puts "BUNDLE_GEMFILE=#{gemfile}" + ENV['BUNDLE_GEMFILE'] = gemfile + + unless bundle_check + puts "bundle install" + system('bundle install') + end + + puts command + system('ruby -w -Ilib -Itest test/all.rb') +end + +exit(results.inject(true) { |a, b| a && b })