Module: ReturnSpy

Included in:
Module, Object
Defined in:
lib/return_spy.rb,
lib/return_spy/support.rb,
lib/return_spy/version.rb,
lib/return_spy/decorator.rb

Defined Under Namespace

Modules: Decorator, Support

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activate!Object



14
15
16
# File 'lib/return_spy.rb', line 14

def activate!
  @active = true
end

.active?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/return_spy.rb', line 10

def active?
  @active
end

.deactivate!Object



18
19
20
# File 'lib/return_spy.rb', line 18

def deactivate!
  @active = false
end

.expectationsObject



29
30
31
# File 'lib/return_spy.rb', line 29

def expectations
  @_expectations ||= []
end

.without_return_spyObject



22
23
24
25
26
27
# File 'lib/return_spy.rb', line 22

def without_return_spy
  active = active?
  deactivate!
  yield
  activate! if active
end

Instance Method Details

#method_added(name) ⇒ Object



36
37
38
# File 'lib/return_spy.rb', line 36

def method_added(name)
  common_method_added(name, Decorator::InstanceMethod)
end

#singleton_method_added(name) ⇒ Object



40
41
42
# File 'lib/return_spy.rb', line 40

def singleton_method_added(name)
  common_method_added(name, Decorator::SingletonMethod)
end