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, enumerable?, #or, surface_descriptions_in, #values_match?

Constructor Details

- (ThrowSymbol) initialize(expected_symbol = nil, expected_arg = nil)

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

- (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.

Returns:

  • (String)
86
87
88
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 86
def description
  "throw #{expected}"
end

- (Boolean) does_not_match?(given_proc)

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

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

- (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.

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

- (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.

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

- (True) supports_block_expectations?

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