Module: FlexMock::ArgumentTypes
Overview
Include this module in your test class if you wish to use the eq
and any
argument matching methods without a prefix. (Otherwise use FlexMock.any
and FlexMock.eq(obj)
.
Instance Method Summary collapse
-
#any ⇒ Object
Return an argument matcher that matches any argument.
-
#ducktype(*methods) ⇒ Object
Return an argument matcher that matches any object that implementes (i.e. responds to) the given method list.
-
#eq(obj) ⇒ Object
Return an argument matcher that only matches things equal to (==) the given object.
-
#hsh(hash) ⇒ Object
Return an argument matcher that matches a hash with the given entries.
-
#on(&block) ⇒ Object
Return an argument matcher that matches any object, that when passed to the supplied block, will cause the block to return true.
- #optional_proc ⇒ Object
Instance Method Details
#any ⇒ Object
Return an argument matcher that matches any argument.
22 23 24 |
# File 'lib/flexmock/argument_types.rb', line 22 def any ANY end |
#ducktype(*methods) ⇒ Object
Return an argument matcher that matches any object that implementes (i.e. responds to) the given method list.
47 48 49 |
# File 'lib/flexmock/argument_types.rb', line 47 def ducktype(*methods) DuckMatcher.new(methods) end |
#eq(obj) ⇒ Object
Return an argument matcher that only matches things equal to (==) the given object.
28 29 30 |
# File 'lib/flexmock/argument_types.rb', line 28 def eq(obj) EqualMatcher.new(obj) end |
#hsh(hash) ⇒ Object
Return an argument matcher that matches a hash with the given entries.
41 42 43 |
# File 'lib/flexmock/argument_types.rb', line 41 def hsh(hash) HashMatcher.new(hash) end |
#on(&block) ⇒ Object
Return an argument matcher that matches any object, that when passed to the supplied block, will cause the block to return true.
35 36 37 |
# File 'lib/flexmock/argument_types.rb', line 35 def on(&block) ProcMatcher.new(&block) end |
#optional_proc ⇒ Object
51 52 53 |
# File 'lib/flexmock/argument_types.rb', line 51 def optional_proc OPTIONAL_PROC_MATCHER end |