Class: RSpec::Matchers::BuiltIn::ThrowSymbol Private

Inherits:
Object
  • Object
show all
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

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

#descriptionString

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:

  • (String)
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 Metrics/MethodLength

Returns:

  • (Boolean)
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.

Returns:

  • (Boolean)
103
104
105
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 103
def expects_call_stack_jump?
  true
end

#failure_messageString

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:

  • (String)
74
75
76
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 74
def failure_message
  "expected #{expected} to be thrown, #{actual_result}"
end

#failure_message_when_negatedString

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:

  • (String)
80
81
82
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 80
def failure_message_when_negated
  "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.

Returns:

  • (True)
93
94
95
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 93
def supports_block_expectations?
  true
end

#supports_value_expectations?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.

Returns:

  • (Boolean)
98
99
100
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 98
def supports_value_expectations?
  false
end