Skip to content

Expectation::toContain ​

Member of Expectation

idl
Expectation.toContain, compare, $
  /_expect_failure

Verifies that an expectation value contains the specified variable value. Behind the scenes this uses the idl obj.where() method. The following data types can be used as expectation values:

  • array
  • list
  • hash
  • orderedhash
  • dictionary

Examples ​

idl
(it.expects([1, 2, 42])).toContain, 42
(it.expects(list(1, 2, 42))).toContain, 42
(it.expects(hash('42', 42))).toContain, '42'
(it.expects(orderedhash('42', 42))).toContain, '42'
(it.expects(dictionary('fortyTwo', 42))).toContain, 'fortyTwo'

Arguments ​

compare ​

requiredinputtype=any

Specify a value that an expectation value should contain.

Keywords ​

_expect_failure {#kw-_expect_failure} ​

optionalinputtype=Boolean

If the test fails for some reason, set this to force passing because we expected failure. This keyword is for internal use only.

Licensed under MIT.