Module: Matchy::ExpectationBuilder

Defined in:
lib/matchy/expectation_builder.rb

Class Method Summary collapse

Class Method Details

.build_expectation(match, exp, obj) ⇒ Object



3
4
5
6
7
# File 'lib/matchy/expectation_builder.rb', line 3

def self.build_expectation(match, exp, obj)
  return Matchy::Expectations::OperatorExpectation.new(obj, match) unless exp
  
  (exp.matches?(obj) != match) ? exp.fail!(match) : exp.pass!(match)
end