diff --git a/lib/shoulda/matchers/assertion_error.rb b/lib/shoulda/matchers/assertion_error.rb index b49bcb005..4704769d9 100644 --- a/lib/shoulda/matchers/assertion_error.rb +++ b/lib/shoulda/matchers/assertion_error.rb @@ -1,11 +1,12 @@ module Shoulda module Matchers - if RUBY_VERSION > "1.9" + if defined?(Test::Unit::AssertionFailedError) + AssertionError = Test::Unit::AssertionFailedError + elsif Gem.ruby_version >= Gem::Version.new("1.9") require 'minitest/unit' AssertionError = MiniTest::Assertion else - require 'test/unit/assertionfailederror' - AssertionError = Test::Unit::AssertionFailedError + raise "No unit test library available" end end -end +end \ No newline at end of file