Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ruby >= 1.9.1 compatibility

  • Loading branch information...
commit 26cf11dded94416b6a2ac192378993a77c07f3c6 1 parent 60db1a4
@krekoten krekoten authored committed
Showing with 13 additions and 2 deletions.
  1. +11 −1 lib/test_declarative.rb
  2. +2 −1  test/test_declarative_test.rb
View
12 lib/test_declarative.rb
@@ -17,4 +17,14 @@ def test(name, &block)
end
end
end
-end
+
+ target.instance_eval do
+ alias :orig_test_methods :test_methods
+
+ def test_methods
+ methods = orig_test_methods
+ methods.delete('test')
+ methods
+ end
+ end if target.respond_to?(:test_methods)
+end
View
3  test/test_declarative_test.rb
@@ -11,7 +11,8 @@ def test_responds_to_test
def test_adds_a_test_method
called = false
assert_nothing_raised { Test::Unit::TestCase.test('some test') { called = true } }
- Test::Unit::TestCase.new(:'test_some_test').run(Test::Unit::TestResult.new) {}
+ puts Test::Unit::TestCase.public_instance_methods(true).grep(/^test/).map { |m| m.to_s }
+ Test::Unit::TestCase.new(:'test_some_test').run((RUBY_VERSION < '1.9.1' ? Test::Unit::TestResult : MiniTest::Unit).new) {}
assert called
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.