Module: Matchy::ExpectationBuilder

Defined in:
lib/matchy/expectation_builder.rb

Class Method Summary collapse

Class Method Details

.build_expectation(should_succeed, matcher, object) ⇒ Object



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

def self.build_expectation(should_succeed, matcher, object)
  return Matchy::Expectations::OperatorExpectation.new(object, should_succeed) unless matcher
  
  if should_succeed
    $current_test_case.assert_accepts(matcher, object)
  else
    $current_test_case.assert_rejects(matcher, object)
  end
end