Class: Synthesis::ExpectationsAdapter

Inherits:
Adapter show all
Defined in:
lib/synthesis/adapter/expectations.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



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

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
# File 'lib/synthesis/adapter/expectations.rb', line 9

def run
  fail_unless { Expectations::SuiteRunner.instance.suite.execute }
end

#stop_collecting_expectationsObject



25
26
27
28
# File 'lib/synthesis/adapter/expectations.rb', line 25

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