Class: MockSuey::RSpec::MockContext::MocksCollector
- Inherits:
-
Object
- Object
- MockSuey::RSpec::MockContext::MocksCollector
- Defined in:
- lib/mock_suey/rspec/mock_context.rb
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Registry contains all identified mocks/stubs in a form: Hash[Class: Hash[Symbol method_name, Array].
Instance Method Summary collapse
-
#initialize ⇒ MocksCollector
constructor
A new instance of MocksCollector.
- #watch(context_id) ⇒ Object
Constructor Details
#initialize ⇒ MocksCollector
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
#registry ⇒ Object (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 |