Skip to content
Browse files

add a test/run_all script

  • Loading branch information...
1 parent a63fb7f commit eb3243e26f5376abbbf26d6795b8b77bc4349153 @svenfuchs committed Nov 17, 2010
Showing with 44 additions and 2 deletions.
  1. +6 −2 README.textile
  2. +17 −0 ci/Gemfile.no-rails.lock
  3. +21 −0 test/run_all.rb
View
8 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.
View
17 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
View
21 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 })

0 comments on commit eb3243e

Please sign in to comment.
Something went wrong with that request. Please try again.