Class: Synthesis::Adapter
- Includes:
- Logging
- Defined in:
- lib/synthesis/adapter.rb
Overview
Subclasses of Adapter must implement the run, collect_expectations and stop_collecting_expectations methods. For example implementations refer to Synthesis::MochaAdapter and Synthesis::RSpecAdapter.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#fail_unless(&block) ⇒ Object
The block parameter will yield twice, once for collecting and once for verifying the collected expectations.
-
#ignore_instances_of(type) ⇒ Object
The type of object representing a mock or stub for the test framework.
-
#initialize(pattern) ⇒ Adapter
constructor
A new instance of Adapter.
Methods included from Logging
Constructor Details
#initialize(pattern) ⇒ Adapter
Returns a new instance of Adapter.
9 10 11 |
# File 'lib/synthesis/adapter.rb', line 9 def initialize(pattern) @pattern = pattern end |
Class Method Details
.inherited(subclass) ⇒ Object
33 34 35 |
# File 'lib/synthesis/adapter.rb', line 33 def inherited(subclass) @adapter = subclass end |
.load(pattern) ⇒ Object
37 38 39 |
# File 'lib/synthesis/adapter.rb', line 37 def load(pattern) @adapter.new(pattern) end |
Instance Method Details
#fail_unless(&block) ⇒ Object
The block parameter will yield twice, once for collecting and once for verifying the collected expectations.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/synthesis/adapter.rb', line 15 def fail_unless(&block) log "Collecting expectations..." collect_expectations Dir[*@pattern].each { |t| require t } exit -1 unless yield log "Verifying expectation invocations..." stop_collecting_expectations ExpectationRecord.record_invocations yield end |