Skip to content

Commit

Permalink
Ruby >= 1.9.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
krekoten authored and Sven Fuchs committed Oct 6, 2010
1 parent 60db1a4 commit 26cf11d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib/test_declarative.rb
Expand Up @@ -17,4 +17,14 @@ def test(name, &block)
end end
end 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
3 changes: 2 additions & 1 deletion test/test_declarative_test.rb
Expand Up @@ -11,7 +11,8 @@ def test_responds_to_test
def test_adds_a_test_method def test_adds_a_test_method
called = false called = false
assert_nothing_raised { Test::Unit::TestCase.test('some test') { called = true } } 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 assert called
end end
end end

0 comments on commit 26cf11d

Please sign in to comment.