Module: Matchi

Defined in:
lib/matchi.rb,
lib/matchi/be.rb,
lib/matchi/eq.rb,
lib/matchi/match.rb,
lib/matchi/change.rb,
lib/matchi/number.rb,
lib/matchi/satisfy.rb,
lib/matchi/constant.rb,
lib/matchi/be_within.rb,
lib/matchi/change/to.rb,
lib/matchi/predicate.rb,
lib/matchi/change/from.rb,
lib/matchi/be_a_kind_of.rb,
lib/matchi/be_within/of.rb,
lib/matchi/change/delta.rb,
lib/matchi/change/from_to.rb,
lib/matchi/raise_exception.rb,
lib/matchi/be_an_instance_of.rb

Overview

Framework-agnostic matchers for Ruby.

A matcher is any object that responds to match? with a block and to to_s. The block is evaluated once and yields the actual value, or, for Change and RaiseException, produces the effect to observe; the matcher returns true or false. The expected value controls the comparison wherever a comparison takes place, so a hostile actual value cannot forge a match; Predicate and the Change refinements by delta, which use values produced by the object under test, depend on its honesty.

Examples:

Matchi::Eq.new(42).match? { 42 } # => true

Defined Under Namespace

Modules: Constant, Number Classes: Be, BeAKindOf, BeAnInstanceOf, BeWithin, Change, Eq, Match, Predicate, RaiseException, Satisfy