类: RSpec::Matchers::BuiltIn::ThrowSymbol 私有

继承
Object
  • Object
显示全部
包含
Composable
定义于
lib/rspec/matchers/built_in/throw_symbol.rb

概述

此类是私有 API 的一部分。 尽可能避免使用此类,因为它可能在未来被移除或更改。

提供 throw_symbol 的实现。不打算直接实例化。

实例方法摘要 折叠

Composable 包含的方法

#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?

构造函数详情

#initialize(expected_symbol = nil, expected_arg = nil) ⇒ThrowSymbol

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

返回 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

实例方法详情

#descriptionString

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

返回

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

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

rubocop:enable Metrics/MethodLength

返回

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

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

返回

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

#failure_messageString

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

返回

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

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

返回

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

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

指示此匹配器匹配块。

返回

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

此方法是私有 API 的一部分。 尽可能避免使用此方法,因为它可能在未来被移除或更改。

返回

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