类: RSpec::Matchers::BuiltIn::Exist 私有
- 继承
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Exist
- 定义于
- lib/rspec/matchers/built_in/exist.rb
概述
此类是私有 API 的一部分。 应尽量避免使用此类,因为它可能会在将来被移除或更改。
为 exist
提供实现。不建议直接实例化。
定义在命名空间下
常量摘要
从 BaseMatcher 继承的常量
实例方法摘要 收起
- #does_not_match?(actual) ⇒ Boolean 私有
- #failure_message ⇒ String 私有
- #failure_message_when_negated ⇒ String 私有
-
#initialize(*expected) ⇒ Exist 构造函数 私有
Exist 的新实例。
- #matches?(actual) ⇒ Boolean 私有
从 BaseMatcher 继承的方法
#description, #diffable?, #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(*expected) ⇒Exist
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
返回 Exist 的新实例。
8 9 10 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 8 def initialize(*expected) @expected = expected end |
实例方法详细信息
#does_not_match?(actual) ⇒Boolean
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
22 23 24 25 26 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 22 def does_not_match?(actual) @actual = actual @test = ExistenceTest.new @actual, @expected @test.valid_test? && !@test.actual_exists? end |
#failure_message ⇒String
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
30 31 32 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 30 def "expected #{actual_formatted} to exist#{@test.}" end |
#failure_message_when_negated ⇒String
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
36 37 38 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 36 def "expected #{actual_formatted} not to exist#{@test.}" end |
#matches?(actual) ⇒Boolean
此方法是私有 API 的一部分。 应尽量避免使用此方法,因为它可能会在将来被移除或更改。
14 15 16 17 18 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 14 def matches?(actual) @actual = actual @test = ExistenceTest.new @actual, @expected @test.valid_test? && @test.actual_exists? end |