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.
-
#proxy ⇒ Object
Public API.
-
#returns(val = nil, &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
5 6 7 |
# File 'lib/muack/modifier.rb', line 5 def defi @defi end |
#mock ⇒ Object
Returns the value of attribute mock
5 6 7 |
# File 'lib/muack/modifier.rb', line 5 def mock @mock end |
Instance Method Details
#object ⇒ Object
Public API
41 42 43 |
# File 'lib/muack/modifier.rb', line 41 def object mock.object end |
#proxy ⇒ Object
Public API
19 20 21 22 |
# File 'lib/muack/modifier.rb', line 19 def proxy defi.proxy = true self end |
#returns(val = nil, &block) ⇒ Object
Public API
13 14 15 16 |
# File 'lib/muack/modifier.rb', line 13 def returns val=nil, &block defi.block = block || lambda{ val } self end |
#times(number) ⇒ Object
Public API
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/muack/modifier.rb', line 25 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
7 8 9 10 |
# File 'lib/muack/modifier.rb', line 7 def with_any_args defi.args = [WithAnyArgs] self end |