Class: RSpec::Matchers::BuiltIn::ThrowSymbol Private
- Inherits:
-
Object
- Object
- RSpec::Matchers::BuiltIn::ThrowSymbol
- Includes:
- Composable
- Defined in:
- lib/rspec/matchers/built_in/throw_symbol.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 throw_symbol
.
Not intended to be instantiated directly.
Instance Method Summary collapse
- #description ⇒ String private
-
#does_not_match?(given_proc) ⇒ Boolean
private
rubocop:enable MethodLength.
- #expects_call_stack_jump? ⇒ Boolean private
- #failure_message ⇒ String private
- #failure_message_when_negated ⇒ String private
-
#initialize(expected_symbol = nil, expected_arg = nil) ⇒ ThrowSymbol
constructor
private
A new instance of ThrowSymbol.
-
#supports_block_expectations? ⇒ True
private
Indicates this matcher matches against a block.
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
#initialize(expected_symbol = nil, expected_arg = nil) ⇒ ThrowSymbol
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 ThrowSymbol.
10 11 12 13 14 |
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 10 def initialize(expected_symbol=nil, expected_arg=nil) @expected_symbol = expected_symbol @expected_arg = expected_arg @caught_symbol = @caught_arg = nil end |
Instance Method Details
#description ⇒ String
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.
86 87 88 |
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 86 def description "throw #{expected}" end |
#does_not_match?(given_proc) ⇒ Boolean
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.
rubocop:enable MethodLength
68 69 70 |
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 68 def does_not_match?(given_proc) !matches?(given_proc) && Proc === given_proc end |
#expects_call_stack_jump? ⇒ Boolean
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.
97 98 99 |
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 97 def expects_call_stack_jump? true end |
#failure_message ⇒ String
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.
74 75 76 |
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 74 def "expected #{expected} to be thrown, #{actual_result}" end |
#failure_message_when_negated ⇒ String
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.
80 81 82 |
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 80 def "expected #{expected('no Symbol')}#{' not' if @expected_symbol} to be thrown, #{actual_result}" end |
#supports_block_expectations? ⇒ True
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.
Indicates this matcher matches against a block.
93 94 95 |
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 93 def supports_block_expectations? true end |