模块: RSpec::Matchers::DSL::DefaultImplementations

包含
BuiltIn::BaseMatcher::DefaultFailureMessages
包含于
Matcher
定义于
lib/rspec/matchers/dsl.rb

概述

为自定义匹配器定义匹配器协议方法的默认实现。您可以在 RSpec::Matchers.define 块中使用 Macros 方法覆盖任何这些方法。

实例方法概要 收起

BuiltIn::BaseMatcher::DefaultFailureMessages 中包含的方法

#failure_message, #failure_message_when_negated

实例方法详情

#descriptionObject

默认描述。

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。 尽可能避免使用此方法,因为它可能会在将来被移除或更改。

shouldshould_not 返回的对象内部使用。

返回

  • (Boolean)
390
391
392
# File 'lib/rspec/matchers/dsl.rb', line 390
def diffable?
  false
end

#expects_call_stack_jump?Boolean

大多数匹配器不希望调用堆栈跳转。

返回

  • (Boolean)
412
413
414
# File 'lib/rspec/matchers/dsl.rb', line 412
def expects_call_stack_jump?
  false
end

#supports_block_expectations?Boolean

默认情况下,匹配器不支持块期望。您必须选择加入。

返回

  • (Boolean)
403
404
405
# File 'lib/rspec/matchers/dsl.rb', line 403
def supports_block_expectations?
  false
end

#supports_value_expectations?Boolean

返回

  • (Boolean)
407
408
409
# File 'lib/rspec/matchers/dsl.rb', line 407
def supports_value_expectations?
  true
end