Module: Expect::Matcher
- Defined in:
- lib/expect/matcher.rb
Overview
This module provides matchers to define expectations.
Class Method Summary collapse
-
.pass?(definition, &actual) ⇒ Boolean
Evaluate the expectation with the passed block.
Class Method Details
.pass?(definition, &actual) ⇒ Boolean
Evaluate the expectation with the passed block.
11 12 13 14 15 16 17 18 |
# File 'lib/expect/matcher.rb', line 11 def self.pass?(definition, &actual) params = Array(definition).flatten(1) name = params.first.to_s.split('_').map(&:capitalize).join.to_sym expected_args = params[1..-1] matcher = Matchi.const_get(name).new(*expected_args) matcher.matches?(&actual) end |