module Spec::ObjectExtensions
Direct including types
Defined in:
spec/expectations.crInstance Method Summary
-
#should(expectation : BeAExpectation(T), failure_message : String | Nil = nil, *, file = __FILE__, line = __LINE__) : T forall T
Validates an expectation and fails the example if it does not match.
-
#should(expectation, failure_message : String | Nil = nil, *, file = __FILE__, line = __LINE__)
Validates an expectation and fails the example if it does not match.
-
#should_not(expectation : BeAExpectation(T), failure_message : String | Nil = nil, *, file = __FILE__, line = __LINE__) forall T
Validates an expectation and fails the example if it matches.
-
#should_not(expectation : BeNilExpectation, failure_message : String | Nil = nil, *, file = __FILE__, line = __LINE__)
Validates an expectation and fails the example if it matches.
-
#should_not(expectation, failure_message : String | Nil = nil, *, file = __FILE__, line = __LINE__)
Validates an expectation and fails the example if it matches.
Instance Method Detail
Validates an expectation and fails the example if it does not match.
This overload returns a value whose type is restricted to the expected type. For example:
x = 1 || 'a'
typeof(x) # => Int32 | Char
x = x.should be_a(Int32)
typeof(x) # => Int32
See Spec::Expectations
for available expectations.
Validates an expectation and fails the example if it does not match.
See Spec::Expectations
for available expectations.
Validates an expectation and fails the example if it matches.
This overload returns a value whose type is restricted to exclude the given
type in should_not be_a
. For example:
x = 1 || 'a'
typeof(x) # => Int32 | Char
x = x.should_not be_a(Char)
typeof(x) # => Int32
See Spec::Expectations
for available expectations.
Validates an expectation and fails the example if it matches.
This overload returns a value whose type is restricted to be not Nil
. For example:
x = 1 || nil
typeof(x) # => Int32 | Nil
x = x.should_not be_nil
typeof(x) # => Int32
See Spec::Expectations
for available expectations.
Validates an expectation and fails the example if it matches.
See Spec::Expectations
for available expectations.