Class: Test::Unit::Assertions::AssertExceptionHelper
- Inherits:
-
Object
- Object
- Test::Unit::Assertions::AssertExceptionHelper
show all
- Defined in:
- lib/test/unit/assertions.rb
Defined Under Namespace
Classes: WrappedException
Instance Method Summary
collapse
Constructor Details
#initialize(test_case, expected_exceptions) ⇒ AssertExceptionHelper
1802
1803
1804
1805
1806
1807
|
# File 'lib/test/unit/assertions.rb', line 1802
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
1824
1825
1826
1827
1828
1829
|
# File 'lib/test/unit/assertions.rb', line 1824
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
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
|
# File 'lib/test/unit/assertions.rb', line 1809
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
|