Permalink
Browse files

Don't rely on implementation-specific order-dependence of array compa…

…risons in unit tests

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent 041e47b commit ea7f1fb026a384a2b39362aa179ebfa0ba14a816 @nicksieger nicksieger committed with tenderlove Jul 12, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 activesupport/test/core_ext/class_test.rb
@@ -1,5 +1,6 @@
require 'abstract_unit'
require 'active_support/core_ext/class'
+require 'set'
class ClassTest < Test::Unit::TestCase
class Parent; end
@@ -12,16 +13,16 @@ class B < A; end
class C < B; end
def test_descendants
- assert_equal [Foo, Bar, Baz, A, B, C], Parent.descendants
- assert_equal [Bar, Baz], Foo.descendants
+ assert_equal [Foo, Bar, Baz, A, B, C].to_set, Parent.descendants.to_set
+ assert_equal [Bar, Baz].to_set, Foo.descendants.to_set
assert_equal [Baz], Bar.descendants
assert_equal [], Baz.descendants
end
def test_subclasses
- assert_equal [Foo, A], Parent.subclasses
+ assert_equal [Foo, A].to_set, Parent.subclasses.to_set
assert_equal [Bar], Foo.subclasses
assert_equal [Baz], Bar.subclasses
assert_equal [], Baz.subclasses
end
-end
+end

0 comments on commit ea7f1fb

Please sign in to comment.