Make sure AS test env doesn't have duplicate libs in load path

This commit is contained in:
Joshua Peek 2010-02-15 10:38:39 -06:00
parent eec2d301d4
commit 4419497e40
3 changed files with 14 additions and 2 deletions

@ -1,5 +1,4 @@
require 'test/unit'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_support'
class GrandParent

@ -1,6 +1,5 @@
# require 'abstract_unit'
require 'test/unit'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_support'
module CallbacksTest

@ -0,0 +1,14 @@
require 'abstract_unit'
class LoadPathsTest < Test::Unit::TestCase
def test_uniq_load_paths
load_paths_count = $LOAD_PATH.inject({}) { |paths, path|
expanded_path = File.expand_path(path)
paths[expanded_path] ||= 0
paths[expanded_path] += 1
paths
}
assert_equal [], load_paths_count.select { |k, v| v > 1 }, $LOAD_PATH.inspect
end
end