diff options
author | Nick Sieger <nick@nicksieger.com> | 2010-07-13 06:14:26 +0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-17 01:59:51 +0800 |
commit | ea7f1fb026a384a2b39362aa179ebfa0ba14a816 (patch) | |
tree | 3fdbd2d56c6ae87c16696472075c25bbb0eb2804 | |
parent | 041e47b326badfbe1b5e33df172e123386c288ac (diff) | |
download | rails-ea7f1fb026a384a2b39362aa179ebfa0ba14a816.tar.gz rails-ea7f1fb026a384a2b39362aa179ebfa0ba14a816.tar.bz2 rails-ea7f1fb026a384a2b39362aa179ebfa0ba14a816.zip |
Don't rely on implementation-specific order-dependence of array comparisons in unit tests
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
-rw-r--r-- | activesupport/test/core_ext/class_test.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activesupport/test/core_ext/class_test.rb b/activesupport/test/core_ext/class_test.rb index 08bb13dd35..60ba3b8f88 100644 --- a/activesupport/test/core_ext/class_test.rb +++ b/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 ClassTest < Test::Unit::TestCase 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
\ No newline at end of file +end |