diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-06-30 00:08:43 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-06-30 00:21:42 +0100 |
commit | b4d8c7d148c6b44eea6701687ca2a97df9088747 (patch) | |
tree | b9163b21a238ee22e14d5e651b8c74caee622af4 /activesupport/test | |
parent | e9fa602e1c70a5c8e1644b218d5784e7c195eb35 (diff) | |
download | rails-b4d8c7d148c6b44eea6701687ca2a97df9088747.tar.gz rails-b4d8c7d148c6b44eea6701687ca2a97df9088747.tar.bz2 rails-b4d8c7d148c6b44eea6701687ca2a97df9088747.zip |
Array.wrap should follow Kernel#Array semantics when the object's to_ary is nil. In this case, the object should be wrapped.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 0e5407bc35..e532010b18 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -456,8 +456,9 @@ class ArrayWrapperTests < Test::Unit::TestCase assert_equal [o], Array.wrap(o) end - def test_wrap_returns_nil_if_to_ary_returns_nil - assert_nil Array.wrap(NilToAry.new) + def test_wrap_returns_wrapped_if_to_ary_returns_nil + o = NilToAry.new + assert_equal [o], Array.wrap(o) end def test_wrap_does_not_complain_if_to_ary_does_not_return_an_array |