Class: Ww::Double::Mock::Expectation
- Inherits:
-
Object
- Object
- Ww::Double::Mock::Expectation
- Defined in:
- lib/ww/double/mock.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
- #executed! ⇒ Object
- #executed? ⇒ Boolean
-
#initialize(verb, path, verifier = nil) ⇒ Expectation
constructor
A new instance of Expectation.
- #verify(request, testing_thread = nil) ⇒ Object
Constructor Details
#initialize(verb, path, verifier = nil) ⇒ Expectation
Returns a new instance of Expectation.
9 10 11 12 |
# File 'lib/ww/double/mock.rb', line 9 def initialize(verb, path, verifier = nil) @identifier = "_mock_ #{verb.to_s.upcase} #{path}" @verifier = verifier end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
7 8 9 |
# File 'lib/ww/double/mock.rb', line 7 def identifier @identifier end |
Instance Method Details
#executed! ⇒ Object
5 |
# File 'lib/ww/double/mock.rb', line 5 def executed!; @e = true; end |
#executed? ⇒ Boolean
6 |
# File 'lib/ww/double/mock.rb', line 6 def executed?; !!@e; end |
#verify(request, testing_thread = nil) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/ww/double/mock.rb', line 14 def verify(request, testing_thread = nil) return true unless @verifier && testing_thread # no need to verify return true if @verifier.call(r = request.dup, r.params) testing_thread.raise MockError end |