Class: MockSuey::RSpec::MockContext::MocksCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/mock_suey/rspec/mock_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMocksCollector

Returns a new instance of MocksCollector.



31
32
33
34
# File 'lib/mock_suey/rspec/mock_context.rb', line 31

def initialize
  @registry = Hash.new { |h, k| h[k] = {} }
  @mocks = {}
end

Instance Attribute Details

#registryObject (readonly)

Registry contains all identified mocks/stubs in a form:

Hash[Class: Hash[Symbol method_name, Array[MethodCall]]


29
30
31
# File 'lib/mock_suey/rspec/mock_context.rb', line 29

def registry
  @registry
end

Instance Method Details

#watch(context_id) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/mock_suey/rspec/mock_context.rb', line 36

def watch(context_id)
  return if mocks.key?(context_id)

  mocks[context_id] = true

  evaluate_context!(context_id)
end