类: RSpec::Matchers::BuiltIn::Cover 私有
- 继承自
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Cover
- 定义在
- lib/rspec/matchers/built_in/cover.rb
概述
此类属于私有 API 的一部分。 应尽量避免使用此类,因为它可能在将来被移除或更改。
提供 cover
的实现。不建议直接实例化。
常量摘要
从 BaseMatcher 继承的常量
实例方法摘要 折叠
- #does_not_match?(range) ⇒ Boolean 私有
-
#initialize(*expected) ⇒ Cover 构造函数 私有
Cover 的新实例。
- #matches?(range) ⇒ Boolean 私有
从 BaseMatcher 继承的方法
#description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
从 BaseMatcher::DefaultFailureMessages 包含的方法
#failure_message, #failure_message_when_negated
从 Composable 包含的方法
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
构造函数详细信息
#initialize(*expected) ⇒Cover
此方法属于私有 API 的一部分。 应尽量避免使用此方法,因为它可能在将来被移除或更改。
返回 Cover 的新实例。
8 9 10 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 8 def initialize(*expected) @expected = expected end |
实例方法详细信息
#does_not_match?(range) ⇒Boolean
此方法属于私有 API 的一部分。 应尽量避免使用此方法,因为它可能在将来被移除或更改。
17 18 19 20 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 17 def does_not_match?(range) @actual = range expected.none? { |e| range.cover?(e) } end |
#matches?(range) ⇒Boolean
此方法属于私有 API 的一部分。 应尽量避免使用此方法,因为它可能在将来被移除或更改。
12 13 14 15 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 12 def matches?(range) @actual = range @expected.all? { |e| range.cover?(e) } end |