类: RSpec::Matchers::BuiltIn::Include 私有
- 继承
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Include
- 定义在
- lib/rspec/matchers/built_in/include.rb
概述
此类是私有 API 的一部分。 应尽量避免使用此类,因为它可能会在将来被移除或更改。
提供 include
的实现。不打算直接实例化。
常量摘要
从 BaseMatcher 继承的常量
实例方法摘要 折叠
- #description ⇒ String 私有
- #diffable? ⇒ Boolean 私有
- #does_not_match?(actual) ⇒ Boolean 私有
- #expected ⇒ Array, Hash 私有
- #failure_message ⇒ String 私有
- #failure_message_when_negated ⇒ String 私有
-
#initialize(*expecteds) ⇒ Include 构造函数 私有
Include 的新实例。
- #matches?(actual) ⇒ Boolean 私有
从 CountExpectation 包含的方法
#at_least, #at_most, #exactly, #once, #thrice, #times, #twice
从 BaseMatcher 继承的方法
#expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
从 Composable 包含的方法
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
构造函数详情
#initialize(*expecteds) ⇒Include
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
返回 Include 的新实例。
15 16 17 |
# File 'lib/rspec/matchers/built_in/include.rb', line 15 def initialize(*expecteds) @expecteds = expecteds end |
实例方法详情
#description ⇒String
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
43 44 45 |
# File 'lib/rspec/matchers/built_in/include.rb', line 43 def description improve_hash_formatting("include#{readable_list_of(expecteds)}#{count_expectation_description}") end |
#diffable? ⇒Boolean
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
61 62 63 |
# File 'lib/rspec/matchers/built_in/include.rb', line 61 def diffable? !diff_would_wrongly_highlight_matched_item? end |
#does_not_match?(actual) ⇒Boolean
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
32 33 34 35 36 37 38 39 |
# File 'lib/rspec/matchers/built_in/include.rb', line 32 def does_not_match?(actual) check_actual?(actual) && if check_expected_count? !expected_count_matches?(count_inclusions) else perform_match { |v| !v } end end |
#expected ⇒Array, Hash
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
67 68 69 70 71 72 73 |
# File 'lib/rspec/matchers/built_in/include.rb', line 67 def expected if expecteds.one? && Hash === expecteds.first expecteds.first else expecteds end end |
#failure_message ⇒String
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
49 50 51 |
# File 'lib/rspec/matchers/built_in/include.rb', line 49 def ("to") { super } end |
#failure_message_when_negated ⇒String
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
55 56 57 |
# File 'lib/rspec/matchers/built_in/include.rb', line 55 def ("not to") { super } end |
#matches?(actual) ⇒Boolean
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
21 22 23 24 25 26 27 28 |
# File 'lib/rspec/matchers/built_in/include.rb', line 21 def matches?(actual) check_actual?(actual) && if check_expected_count? expected_count_matches?(count_inclusions) else perform_match { |v| v } end end |