Sha256: d15f38caa280c908d4897b67bd224e24000ada232c75b21bff62318777ba4271
Contents?: true
Size: 1015 Bytes
Versions: 2
Compression:
Stored size: 1015 Bytes
Contents
require 'matchi/matchers_base' require 'fix' # Namespace for the Matchi library. module Matchi # Collection of matchers. module Matchers # **Fix** matcher. module Fix # The matcher. class Matcher include MatchersBase # Initialize the matcher with a spec. # # @example It MUST be equal to 42 matcher. # new(proc { it { MUST equal 42 } }) # # @param expected [Proc] A spec. def initialize(expected) @expected = expected end # @example Is 42 matching 6 * 7? # fix = new(proc { it { MUST equal 42 } }) # fix.matches? { 6 * 7 } # => true # # @yieldreturn [#object_id] A front object to compare against the spec. # # @return [Boolean] The result of the test: _pass_ or _fail_. def matches? ::Fix.describe(yield, verbose: false, &@expected) rescue SystemExit => e e.success? end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
matchi-fix-1.0.1 | lib/matchi/fix.rb |
matchi-fix-1.0.0 | lib/matchi/fix.rb |