struct

Spectator::Matchers::ReceiveMatcher

Inherits Spectator::Matchers::StandardMatcher < Spectator::Matchers::Matcher < Struct < Value < Object

Constructors

new(expected : TestExpression(Symbol), args : Mocks::Arguments | Nil = nil, range : Range | Nil = nil)
Source

Instance methods

at_least(count)
Source
at_least_once
Source
at_least_twice
Source
at_most(count)
Source
at_most_once
Source
at_most_twice
Source
description

Short text about the matcher's purpose. This explains what condition satisfies the matcher. The description is used when the one-liner syntax is used.

it { is_expected.to do_something }

The phrasing should be such that it reads "it ___." where the blank is what is returned by this method.

Source
exactly(count)
Source
failure_message(actual : TestExpression(T)) : String forall T

Message displayed when the matcher isn't satisifed.

This is only called when #match? returns false.

The message should typically only contain the test expression labels. Actual values should be returned by #values.

Source
failure_message_when_negated(actual) : String
Source
humanize_range(range : Range)
Source
match?(actual : TestExpression(T)) : Bool forall T

Checks whether the matcher is satisifed with the expression given to it.

Source
negated_values(actual : TestExpression(T)) forall T

Additional information about the match failure when negated.

By default, just the actual value is produced (same as #values). The return value must be a NamedTuple with Strings for each value. The tuple can be of any size, but the keys must be known at compile-time (as Symbols), and the values must be strings. Generally, the string values are produced by calling #inspect on the relevant object. It should look like this:

{
  expected: "Not foo",
  actual:   "bar",
}

The values should typically only contain the test expression values, not the labels. Labeled should be returned by #failure_message_when_negated.

Source
once
Source
twice
Source
values(actual : TestExpression(T)) forall T

Additional information about the match failure.

By default, just the actual value is produced. The return value must be a NamedTuple with Strings for each value. The tuple can be of any size, but the keys must be known at compile-time (as Symbols), and the values must be strings. Generally, the string values are produced by calling #inspect on the relevant object. It should look like this:

{
  expected: "foo",
  actual:   "bar",
}

The values should typically only contain the test expression values, not the labels. Labeled should be returned by #failure_message.

Source
with(*args, **opts)
Source

Nested types