Class: FlexMock::TestUnitFrameworkAdapter
- Includes:
- Test::Unit::Assertions
- Defined in:
- lib/flexmock/test_unit_integration.rb
Overview
Adapter for adapting FlexMock to the Test::Unit framework.
Instance Attribute Summary collapse
-
#assertions ⇒ Object
Returns the value of attribute assertions.
Instance Method Summary collapse
- #assertion_failed_error ⇒ Object
- #check(msg, &block) ⇒ Object
- #check_failed_error ⇒ Object
-
#initialize ⇒ TestUnitFrameworkAdapter
constructor
A new instance of TestUnitFrameworkAdapter.
- #make_assertion(msg, &block) ⇒ Object
Constructor Details
#initialize ⇒ TestUnitFrameworkAdapter
Returns a new instance of TestUnitFrameworkAdapter.
50 51 52 |
# File 'lib/flexmock/test_unit_integration.rb', line 50 def initialize @assertions = 0 end |
Instance Attribute Details
#assertions ⇒ Object
Returns the value of attribute assertions.
48 49 50 |
# File 'lib/flexmock/test_unit_integration.rb', line 48 def assertions @assertions end |
Instance Method Details
#assertion_failed_error ⇒ Object
68 69 70 71 72 |
# File 'lib/flexmock/test_unit_integration.rb', line 68 def assertion_failed_error defined?(Test::Unit::AssertionFailedError) ? Test::Unit::AssertionFailedError : MiniTest::Assertion end |
#check(msg, &block) ⇒ Object
64 65 66 |
# File 'lib/flexmock/test_unit_integration.rb', line 64 def check(msg, &block) make_assertion(msg, &block) end |
#check_failed_error ⇒ Object
74 75 76 |
# File 'lib/flexmock/test_unit_integration.rb', line 74 def check_failed_error assertion_failed_error end |
#make_assertion(msg, &block) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/flexmock/test_unit_integration.rb', line 54 def make_assertion(msg, &block) unless yield msg = msg.call if msg.is_a?(Proc) assert(false, msg) end rescue assertion_failed_error => ex ex..sub!(/Expected block to return true value./,'') raise ex end |