Project

General

Profile

Actions

Bug #8975

closed

Confusing code sample for assert_send

Added by agrimm (Andrew Grimm) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Assignee:
Target version:
-
ruby -v:
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
[ruby-core:57570]

Description

Test::Unit::Assertsions#assert_send has the code sample

assert_send([[1, 2], :member?, 1]) # -> pass
assert_send([[1, 2], :member?, 4]) # -> fail

Having an array within an array is somewhat confusing. When I first read it, I ignored the extra square brackets. A less confusing example would be

assert_send(["Hello world", :include?, "Hello"]) # -> pass
assert_send(["Hello world", :include?, "Goodbye"]) # -> fail
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0