From c75c8334919772a8c09e6bcc8af4cdb8d0bc1d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Pablo=20Ferna=CC=81ndez?= Date: Fri, 15 Jun 2012 11:39:17 +0100 Subject: [PATCH] Do not force loading minitest when test-unit is available. Closes #88. Credit goes to Matt Conway (@wr0ngway https://github.com/wr0ngway) --- lib/shoulda/matchers/assertion_error.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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