Browse files

#88: Do not force minitest loading when test-unit is available (resto…

…ring original fix)
  • Loading branch information...
1 parent 8d01c6f commit 68ae50045e610188df5ded29b2a37a7dc556357f @os97673 os97673 committed with gabebw Oct 30, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/shoulda/matchers/assertion_error.rb
View
5 lib/shoulda/matchers/assertion_error.rb
@@ -3,7 +3,10 @@ module Matchers
if Gem.ruby_version >= Gem::Version.new('1.8') && Gem.ruby_version < Gem::Version.new('1.9')
require 'test/unit'
AssertionError = Test::Unit::AssertionFailedError
- elsif Gem.ruby_version >= Gem::Version.new('1.9')
+ elsif defined?(Test::Unit::AssertionFailedError)
+ # Test::Unit has been loaded already, so we use it
+ AssertionError = Test::Unit::AssertionFailedError
+ elsif Gem.ruby_version >= Gem::Version.new("1.9")
require 'minitest/unit'
AssertionError = MiniTest::Assertion
else

0 comments on commit 68ae500

Please sign in to comment.