Skip to content

Commit

Permalink
add a test/run_all script
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Nov 17, 2010
1 parent a63fb7f commit eb3243e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 17 additions & 0 deletions ci/Gemfile.no-rails.lock
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions test/run_all.rb
Original file line number Diff line number Diff line change
@@ -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.