Class: RSpec::Matchers::BuiltIn::RaiseError Private
- Inherits:
-
Object
- Object
- RSpec::Matchers::BuiltIn::RaiseError
- Includes:
- Composable
- Defined in:
- lib/rspec/matchers/built_in/raise_error.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the implementation for raise_error
.
Not intended to be instantiated directly.
rubocop:disable ClassLength
Instance Method Summary (collapse)
- - (String) description private
- - (Boolean) expects_call_stack_jump? private
- - (String) failure_message private
- - (String) failure_message_when_negated private
-
- (RaiseError) initialize(expected_error_or_message = nil, expected_message = nil, &block)
constructor
private
A new instance of RaiseError.
-
- (Object) with_message(expected_message)
Specifies the expected error message.
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, #values_match?
Constructor Details
- (RaiseError) initialize(expected_error_or_message = nil, expected_message = nil, &block)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RaiseError
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rspec/matchers/built_in/raise_error.rb', line 11 def initialize(=nil, =nil, &block) @block = block @actual_error = nil @warn_about_bare_error = warn_about_potential_false_positives? && .nil? case when nil @expected_error, @expected_message = Exception, when String @expected_error, @expected_message = Exception, else @expected_error, @expected_message = , end end |
Instance Method Details
- (String) description
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
93 94 95 |
# File 'lib/rspec/matchers/built_in/raise_error.rb', line 93 def description "raise #{expected_error}" end |
- (Boolean) expects_call_stack_jump?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
75 76 77 |
# File 'lib/rspec/matchers/built_in/raise_error.rb', line 75 def expects_call_stack_jump? true end |
- (String) failure_message
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 |
# File 'lib/rspec/matchers/built_in/raise_error.rb', line 81 def @eval_block ? @actual_error. : "expected #{expected_error}#{given_error}" end |
- (String) failure_message_when_negated
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 |
# File 'lib/rspec/matchers/built_in/raise_error.rb', line 87 def "expected no #{expected_error}#{given_error}" end |
- (Object) with_message(expected_message)
Specifies the expected error message.
28 29 30 31 32 33 |
# File 'lib/rspec/matchers/built_in/raise_error.rb', line 28 def () if @expected_message @warn_about_bare_error = false @expected_message = self end |