Spec::Expectations
This module defines a number of methods to create expectations, which are automatically included into the top level namespace.
Expectations are used by Spec::ObjectExtensions#should and Spec::ObjectExtensions#should_not.
Instance methods
be
Returns a factory to create a comparison Expectation that:
- passes if actual is lesser than value:
be < value - passes if actual is lesser than or equal value:
be <= value - passes if actual is greater than value:
be > value - passes if actual is greater than or equal value:
be >= value
be_close(expected, delta)
Creates an Expectation that passes if actual is within delta of expected.
contain(expected)
Creates an Expectation that passes if actual includes expected (.includes?).
Works on collections and String.
end_with(expected)
Creates an Expectation that passes if actual ends with expected (.ends_with?).
Works on String.
expect_raises(klass : T.class, message : String | Regex | Nil = nil, file = __FILE__, line = __LINE__, &) forall T
Sourcestart_with(expected)
Creates an Expectation that passes if actual starts with expected (.starts_with?).
Works on String.