Skip to main content

to_have_length

Method of AlephExpectation.

Overloads​

NameDescription
to_have_length(integer expected, const Map options) -> voidRecords a failure unless the actual value has the expected size.
to_have_length(integer expected) -> voidRecords a failure unless the actual value has the expected size.

to_have_length(integer expected, const Map options) -> void​

Records a failure unless the actual value has the expected size.

Parameters​

  • expected: The expected length.
  • options: Optional matcher options.
    • message (String): Custom failure message to record when the matcher fails.
    • stop (Bool): Stops collecting further expectations in the current test when this matcher fails.

Returns​

Nothing. Failed expectations are collected in the active test result.

Example​


expect([1, 2, 3]).to_have_length(3, ["message": "expected three items"])

to_have_length(integer expected) -> void​

Records a failure unless the actual value has the expected size.

Parameters​

  • expected: The expected length.

Returns​

Nothing. Failed expectations are collected in the active test result.

Example​


expect([1, 2, 3]).to_have_length(3)