Class: RSpec::Matchers::BuiltIn::Exist::ExistenceTest Private
- Inherits:
-
Struct
- Object
- Struct
- RSpec::Matchers::BuiltIn::Exist::ExistenceTest
- Defined in:
- lib/rspec/matchers/built_in/exist.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Simple class for memoizing actual/expected for this matcher and examining the match
Instance Attribute Summary collapse
-
#actual ⇒ Object
Returns the value of attribute actual.
-
#expected ⇒ Object
Returns the value of attribute expected.
Instance Method Summary collapse
- #actual_exists? ⇒ Boolean private
- #valid_test? ⇒ Boolean private
- #validity_message ⇒ String private
Instance Attribute Details
#actual ⇒ Object
Returns the value of attribute actual
43 44 45 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 43 def actual @actual end |
#expected ⇒ Object
Returns the value of attribute expected
43 44 45 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 43 def expected @expected end |
Instance Method Details
#actual_exists? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
52 53 54 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 52 def actual_exists? existence_values.first end |
#valid_test? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 46 def valid_test? uniq_truthy_values.size == 1 end |
#validity_message ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/rspec/matchers/built_in/exist.rb', line 58 def case uniq_truthy_values.size when 0 " but it does not respond to either `exist?` or `exists?`" when 2 " but `exist?` and `exists?` returned different values:\n\n"\ " exist?: #{existence_values.first}\n"\ "exists?: #{existence_values.last}" end end |