Class: Synthesis::MochaAdapter

Inherits:
Adapter show all
Defined in:
lib/synthesis/adapter/mocha.rb

Instance Method Summary collapse

Methods inherited from Adapter

#fail_unless, #ignore_instances_of, inherited, #initialize, load

Methods included from Logging

#silence!, #speak!

Constructor Details

This class inherits a constructor from Synthesis::Adapter

Instance Method Details

#collect_expectationsObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/synthesis/adapter/mocha.rb', line 14

def collect_expectations
  ignore_instances_of Class::AnyInstance
  Object.extend(ExpectationRecorder)
  Object.record_expectations_on(:expects)
  Mocha::Expectation.extend(ExpectationInterceptor)
  Mocha::Expectation.intercept_test_subject_on(:invoke)
  Mocha::Expectation.intercept_expected_arguments_on(:with)
  Mocha::Expectation.intercept_expected_return_values_on(:returns)
  Mocha::Expectation.intercept_expected_return_values_on(:raises)
  Mocha::Expectation.remove_expectation_on(:never)
end

#runObject



9
10
11
12
# File 'lib/synthesis/adapter/mocha.rb', line 9

def run
  Test::Unit.run = true # Yes means no...
			fail_unless { Test::Unit::AutoRunner.run(false, nil, []) }
end

#stop_collecting_expectationsObject



26
27
28
29
# File 'lib/synthesis/adapter/mocha.rb', line 26

def stop_collecting_expectations
  Mocha::Expectation.stop_intercepting!
  Object.stop_recording!
end