123456789_123456789_123456789_123456789_123456789_

Class: BasicObject

Overview

The legacy :should syntax adds the following methods directly to BasicObject so that they are available off of any object. Note, however, that this syntax does not always play nice with delegate/proxy objects. We recommend you use the non-monkeypatching :expect syntax instead.

See Also:

Instance Method Summary

Instance Method Details

#should(matcher, message) ⇒ Boolean

Note:

This is only available when you have enabled the :should syntax.

Passes if matcher returns true. Available on every Object.

Examples:

actual.should eq expected
actual.should match /expression/

Parameters:

  • matcher (Matcher)
  • message (String)

    optional message to display when the expectation fails

Returns:

  • (Boolean)

    true if the expectation succeeds (else raises)

See Also:

[ GitHub ]

#should_not(matcher, message) ⇒ Boolean

Note:

This is only available when you have enabled the :should syntax.

Passes if matcher returns false. Available on every Object.

Examples:

actual.should_not eq expected

Parameters:

  • matcher (Matcher)
  • message (String)

    optional message to display when the expectation fails

Returns:

  • (Boolean)

    false if the negative expectation succeeds (else raises)

See Also:

[ GitHub ]