Class: Test::Unit::Assertions::AssertExceptionHelper
- Inherits:
-
Object
- Object
- Test::Unit::Assertions::AssertExceptionHelper
- Defined in:
- lib/test/unit/assertions.rb
Defined Under Namespace
Classes: WrappedException
Instance Method Summary collapse
- #expected?(actual_exception, equality = nil) ⇒ Boolean
- #expected_exceptions ⇒ Object
-
#initialize(test_case, expected_exceptions) ⇒ AssertExceptionHelper
constructor
A new instance of AssertExceptionHelper.
Constructor Details
#initialize(test_case, expected_exceptions) ⇒ AssertExceptionHelper
Returns a new instance of AssertExceptionHelper.
2111 2112 2113 2114 2115 2116 |
# File 'lib/test/unit/assertions.rb', line 2111 def initialize(test_case, expected_exceptions) @test_case = test_case @expected_exceptions = expected_exceptions @expected_classes, @expected_modules, @expected_objects = split_expected_exceptions(expected_exceptions) end |
Instance Method Details
#expected?(actual_exception, equality = nil) ⇒ Boolean
2133 2134 2135 2136 2137 2138 |
# File 'lib/test/unit/assertions.rb', line 2133 def expected?(actual_exception, equality=nil) equality ||= :instance_of? expected_class?(actual_exception, equality) or expected_module?(actual_exception) or expected_object?(actual_exception) end |
#expected_exceptions ⇒ Object
2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 |
# File 'lib/test/unit/assertions.rb', line 2118 def expected_exceptions exceptions = @expected_exceptions.collect do |exception| if exception.is_a?(Exception) WrappedException.new(exception) else exception end end if exceptions.size == 1 exceptions[0] else exceptions end end |