Module: Expectation
- Defined in:
- lib/expectation.rb,
lib/expectation.rb,
lib/expectation/version.rb
Overview
–
- Author
-
radiospiel ([email protected])
- Copyright
-
Copyright © 2011, 2012 radiospiel
- License
-
Distributes under the terms of the Modified BSD License, see LICENSE.BSD for details.
Defined Under Namespace
Modules: Assertions, Matcher Classes: MultiMatcher
Constant Summary collapse
Class Method Summary collapse
-
.expect!(*expectations, &block) ⇒ Object
Verifies a number of expectations.
Class Method Details
.expect!(*expectations, &block) ⇒ Object
Verifies a number of expectations. If one or more expectations are not met it raises an Error (on the first failing expectation).
In contrast to the global expect! function this method does not adjust an Error’s backtrace.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/expectation.rb', line 44 def self.expect!(*expectations, &block) expectations.each do |expectation| if expectation.is_a?(Hash) expectation.all? do |actual, exp| Matcher.match! actual, exp end else Matcher.match! expectation, :truish end end Matcher.match! block, :__block if block end |