Module: FlexMock::Minitest

Includes:
ArgumentTypes, MockContainer, TestUnitAssertions
Defined in:
lib/flexmock/minitest_integration.rb

Overview

Minitest::Test Integration.

Include this module in any Test subclass (in test-style minitest) or or describe block (in spec-style minitest) to get integration with FlexMock. When this module is included, the mock container methods (e.g. flexmock(), flexstub()) will be available.

Instance Method Summary collapse

Methods included from TestUnitAssertions

#assert_spy_called, #assert_spy_not_called

Methods included from SpyDescribers

#append_call_record, #block_description, #describe_calls, #describe_spy, #describe_spy_expectation, #describe_spy_negative_expectation, #spy_description, #times_description

Methods included from MockContainer

#flexmock, #flexmock_close, #flexmock_created_mocks, #flexmock_remember, #flexmock_teardown, #flexmock_verify

Methods included from Ordering

#flexmock_allocate_order, #flexmock_current_order, #flexmock_current_order=, #flexmock_groups, #flexmock_validate_order

Methods included from ArgumentTypes

#any, #ducktype, #eq, #hsh, #on, #optional_proc

Instance Method Details

#after_teardownObject



53
54
55
56
57
# File 'lib/flexmock/minitest_integration.rb', line 53

def after_teardown
  if @flexmock_teardown_failure
    raise @flexmock_teardown_failure
  end
end

#before_teardownObject

Teardown the test case, verifying any mocks that might have been defined in this test case.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/flexmock/minitest_integration.rb', line 37

def before_teardown
  super
  @flexmock_teardown_failure = nil
  if respond_to?(:capture_exceptions)
    capture_exceptions do
      flexmock_teardown
    end
  else
    begin
      flexmock_teardown
    rescue Exception => e
      @flexmock_teardown_failure = e
    end
  end
end