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

#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)


82
83
84
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 82

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.

Returns:

  • (Boolean)


64
65
66
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 64

def does_not_match?(given_proc)
  !matches?(given_proc) && Proc === given_proc
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)


70
71
72
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 70

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)


76
77
78
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 76

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)


89
90
91
# File 'lib/rspec/matchers/built_in/throw_symbol.rb', line 89

def supports_block_expectations?
  true
end