模块: RSpec::Matchers::DSL::DefaultImplementations
概述
为自定义匹配器定义匹配器协议方法的默认实现。您可以在 RSpec::Matchers.define
块中使用 Macros 方法覆盖任何这些方法。
实例方法概要 收起
-
#description ⇒ Object
默认描述。
-
#diffable? ⇒ Boolean 私有
由
should
和should_not
返回的对象内部使用。 -
#expects_call_stack_jump? ⇒ Boolean
大多数匹配器不希望调用堆栈跳转。
-
#supports_block_expectations? ⇒ Boolean
默认情况下,匹配器不支持块期望。
- #supports_value_expectations? ⇒ Boolean
从 BuiltIn::BaseMatcher::DefaultFailureMessages 中包含的方法
#failure_message, #failure_message_when_negated
实例方法详情
#description ⇒Object
默认描述。
395 396 397 398 399 |
# File 'lib/rspec/matchers/dsl.rb', line 395 def description english_name = EnglishPhrasing.split_words(name) expected_list = EnglishPhrasing.list(expected) "#{english_name}#{expected_list}#{chained_method_clause_sentences}" end |
#diffable? ⇒Boolean
此方法属于私有 API。 尽可能避免使用此方法,因为它可能会在将来被移除或更改。
由 should
和 should_not
返回的对象内部使用。
390 391 392 |
# File 'lib/rspec/matchers/dsl.rb', line 390 def diffable? false end |
#expects_call_stack_jump? ⇒Boolean
大多数匹配器不希望调用堆栈跳转。
412 413 414 |
# File 'lib/rspec/matchers/dsl.rb', line 412 def expects_call_stack_jump? false end |
#supports_block_expectations? ⇒Boolean
默认情况下,匹配器不支持块期望。您必须选择加入。
403 404 405 |
# File 'lib/rspec/matchers/dsl.rb', line 403 def supports_block_expectations? false end |
#supports_value_expectations? ⇒Boolean
407 408 409 |
# File 'lib/rspec/matchers/dsl.rb', line 407 def supports_value_expectations? true end |