Class: Muack::Modifier
- Inherits:
-
Struct
- Object
- Struct
- Muack::Modifier
- Defined in:
- lib/muack/modifier.rb
Instance Attribute Summary collapse
-
#defi ⇒ Object
Returns the value of attribute defi.
-
#mock ⇒ Object
Returns the value of attribute mock.
Instance Method Summary collapse
-
#object ⇒ Object
Public API.
-
#peek_args(opts = {}, &block) ⇒ Object
Public API.
-
#peek_return(opts = {}, &block) ⇒ Object
Public API.
-
#returns(opts = {}, &block) ⇒ Object
Public API.
-
#times(number) ⇒ Object
Public API.
-
#with_any_args ⇒ Object
Public API.
Instance Attribute Details
#defi ⇒ Object
Returns the value of attribute defi
6 7 8 |
# File 'lib/muack/modifier.rb', line 6 def defi @defi end |
#mock ⇒ Object
Returns the value of attribute mock
6 7 8 |
# File 'lib/muack/modifier.rb', line 6 def mock @mock end |
Instance Method Details
#object ⇒ Object
Public API
48 49 50 |
# File 'lib/muack/modifier.rb', line 48 def object mock.object end |
#peek_args(opts = {}, &block) ⇒ Object
Public API
36 37 38 39 |
# File 'lib/muack/modifier.rb', line 36 def peek_args opts={}, &block defi.peek_args = create_block(block, opts) self end |
#peek_return(opts = {}, &block) ⇒ Object
Public API
42 43 44 45 |
# File 'lib/muack/modifier.rb', line 42 def peek_return opts={}, &block defi.peek_return = create_block(block, opts) self end |
#returns(opts = {}, &block) ⇒ Object
Public API
30 31 32 33 |
# File 'lib/muack/modifier.rb', line 30 def returns opts={}, &block defi.returns = create_block(block, opts) self end |
#times(number) ⇒ Object
Public API
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/muack/modifier.rb', line 8 def times number if mock.__mock_class == Stub raise StubHasNoTimes.new(object, defi, number) end if number >= 1 (number - 1).times{ mock.__mock_defis_push(defi) } elsif number == 0 mock.__mock_defis_pop(defi) else raise "What would you expect from calling a method #{number} times?" end self end |
#with_any_args ⇒ Object
Public API
24 25 26 27 |
# File 'lib/muack/modifier.rb', line 24 def with_any_args defi.args = [WithAnyArgs] self end |