Skip to content
Browse files

Fix test suite runners for Ruby 1.8

  • Loading branch information...
1 parent 5859594 commit 841e17cbd21cfd47d01cd22f241d76679553daf8 @mcmire mcmire committed
Showing with 24 additions and 6 deletions.
  1. +3 −0 Gemfile
  2. +1 −0 Rakefile
  3. +2 −0 spec/global_helper.rb
  4. +3 −1 spec/runner.rb
  5. +15 −5 spec/suites/minitest/runner.rb
View
3 Gemfile
@@ -3,4 +3,7 @@ source 'http://rubygems.org'
gem "jeweler", '~> 1.8.4'
gem "rspec", "~> 2.13.0"
+if RUBY_VERSION !~ /^1.8/
+ gem "minitest", "~> 4.7.0"
+end
gem "session", "~> 2.4.0"
View
1 Rakefile
@@ -1,3 +1,4 @@
+require 'rubygems'
require 'rake'
require File.expand_path('../spec/runner.rb', __FILE__)
View
2 spec/global_helper.rb
@@ -1,4 +1,6 @@
+require 'rubygems'
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require 'rr'
View
4 spec/runner.rb
@@ -14,8 +14,10 @@ def initialize
end
def run
- TEST_SUITES.each do |path, class_fragment, desc|
+ TEST_SUITES.each_with_index do |(path, class_fragment, desc), i|
+ puts "----------------" unless i == 0
run_examples(path, class_fragment, desc)
+ puts
end
end
View
20 spec/suites/minitest/runner.rb
@@ -1,10 +1,20 @@
-require File.expand_path('../test_helper', __FILE__)
-
class MinitestSuiteRunner
+ def initialize
+ @minitest_available = false
+ unless RUBY_VERSION =~ /^1.8/
+ require File.expand_path('../test_helper', __FILE__)
+ @minitest_available = true
+ end
+ end
+
def run
- puts "Running MiniTest example suite"
- Dir[File.expand_path("../{.,*,**}/*_test.rb", __FILE__)].each do |file|
- require file
+ if @minitest_available
+ puts "Running MiniTest example suite"
+ Dir[File.expand_path("../{.,*,**}/*_test.rb", __FILE__)].each do |file|
+ require file
+ end
+ else
+ puts "Skipping MiniTest suite since we're on Ruby 1.8"
end
end
end

0 comments on commit 841e17c

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