Sha256: 21c9a2ee0b4f7500b755387070fbb37e73f15a801fa7aa47487dd8aa6bea4124
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
require 'matchi' module Expect # This module provides matchers to define expectations. module Matcher # Evaluate the expectation with the passed block. # # @param [Boolean] negated # @param [Hash] definition # # @return [Boolean] Report if the expectation is true or false. def self.pass?(negated, definition, &actual) params = Array(definition).flatten 1 name = params.first expected_args = params[1..-1] matcher = get(name).new(*expected_args) negated ^ matcher.matches?(&actual) end # Get the class of a matcher from its symbol. # # @example # # Matcher.get(:eql) # => Eql def self.get(name) Matchi.const_get name.to_s.split('_').map(&:capitalize).join.to_sym end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
expect-0.0.3 | lib/expect/matcher.rb |