Permalink
Browse files

Use only required Active Support version

We can detect required Active Support version from required
"active_support/testing/assertions".
  • Loading branch information...
kou committed Aug 28, 2015
1 parent 88f1fc8 commit ca1ab1d5815021d224e569a88fa8eabc3d46bc35
Showing with 10 additions and 6 deletions.
  1. +10 −6 lib/test/unit/active_support.rb
@@ -17,14 +17,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
# Prevent AS/test_case.rb from being required after this
unless $LOADED_FEATURES.any? {|lf| lf.end_with? "active_support/test_case.rb"}
$LOAD_PATH.reverse_each do |lp|
path = File.join(lp, "active_support/test_case.rb")
$LOADED_FEATURES << path if File.exist?(path)
require "active_support/testing/assertions"
$LOADED_FEATURES.size.times do |i|
feature = $LOADED_FEATURES[i]
if feature.end_with?("active_support/testing/assertions.rb")
as_test_case_feature = feature.gsub(/testing\/assertions.rb\z/,
"test_case.rb")
$LOADED_FEATURES[i, 0] = as_test_case_feature
break
elsif feature.end_with?("active_support/test_case.rb")
break
end
end
require "active_support/testing/assertions"
module ActiveSupport
if const_defined?(:TestCase)

0 comments on commit ca1ab1d

Please sign in to comment.