class WrapTest
Public Instance Methods
test_array()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 30 def test_array ary = %w(foo bar) assert_same ary, Array.wrap(ary) end
test_nil()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 35 def test_nil assert_equal [], Array.wrap(nil) end
test_object()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 39 def test_object o = Object.new assert_equal [o], Array.wrap(o) end
test_object_with_to_ary()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 52 def test_object_with_to_ary assert_equal ["foo", "bar"], Array.wrap(FakeCollection.new) end
test_proxy_object()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 56 def test_proxy_object p = Proxy.new(Object.new) assert_equal [p], Array.wrap(p) end
test_proxy_to_object_with_to_ary()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 61 def test_proxy_to_object_with_to_ary p = Proxy.new(FakeCollection.new) assert_equal [p], Array.wrap(p) end
test_string()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 44 def test_string assert_equal ["foo"], Array.wrap("foo") end
test_string_with_newline()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 48 def test_string_with_newline assert_equal ["foo\nbar"], Array.wrap("foo\nbar") end
test_struct()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 66 def test_struct o = Struct.new(:foo).new(123) assert_equal [o], Array.wrap(o) end
test_wrap_does_not_complain_if_to_ary_does_not_return_an_array()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 76 def test_wrap_does_not_complain_if_to_ary_does_not_return_an_array assert_equal DoubtfulToAry.new.to_ary, Array.wrap(DoubtfulToAry.new) end
test_wrap_returns_wrapped_if_to_ary_returns_nil()
click to toggle source
# File activesupport/test/core_ext/array/wrap_test.rb, line 71 def test_wrap_returns_wrapped_if_to_ary_returns_nil o = NilToAry.new assert_equal [o], Array.wrap(o) end