struct Spectator::Matchers::ReceiveMatcher

Defined in:

spectator/matchers/receive_matcher.cr

Constructors

Instance Method Summary

Instance methods inherited from struct Spectator::Matchers::StandardMatcher

match(actual : Expression(T)) : MatchData forall T match, negated_match(actual : Expression(T)) : MatchData forall T negated_match

Instance methods inherited from struct Spectator::Matchers::Matcher

description : String description, match(actual : Expression(T)) : MatchData forall T match, negated_match(actual : Expression(T)) : MatchData forall T negated_match

Constructor methods inherited from struct Spectator::Matchers::Matcher

new new

Instance methods inherited from class Object

should(matcher, message = nil) should, should_eventually(matcher, message = nil) should_eventually, should_never(matcher, message = nil) should_never, should_not(matcher, message = nil) should_not

Constructor Detail

def self.new(expected : Expression(Symbol), args : Mocks::Arguments? = nil, range : Range? = nil) #

[View source]

Instance Method Detail

def at_least(count) #

[View source]
def at_least_once #

[View source]
def at_least_twice #

[View source]
def at_most(count) #

[View source]
def at_most_once #

[View source]
def at_most_twice #

[View source]
def description : String #
Description copied from struct Spectator::Matchers::Matcher

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.


[View source]
def exactly(count) #

[View source]
def failure_message(actual : Expression(T)) : String forall T #
Description copied from struct Spectator::Matchers::StandardMatcher

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.


[View source]
def failure_message_when_negated(actual) : String #

[View source]
def humanize_range(range : Range) #

[View source]
def match?(actual : Expression(T)) : Bool forall T #
Description copied from struct Spectator::Matchers::StandardMatcher

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


[View source]
def negated_values(actual : Expression(T)) forall T #
Description copied from struct Spectator::Matchers::StandardMatcher

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.


[View source]
def once #

[View source]
def twice #

[View source]
def values(actual : Expression(T)) forall T #
Description copied from struct Spectator::Matchers::StandardMatcher

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.


[View source]
def with(*args, **opts) #

[View source]