Class: RSpec::Matchers::BuiltIn::HaveAttributes Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::HaveAttributes
- Defined in:
- lib/rspec/matchers/built_in/have_attributes.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.
Provides the implementation for have_attributes
.
Not intended to be instantiated directly.
Constant Summary
Constant Summary
Constants inherited from BaseMatcher
Instance Method Summary (collapse)
- - (String) description private
- - (Boolean) diffable? private
- - (Boolean) does_not_match?(actual) private
- - (String) failure_message private
- - (String) failure_message_when_negated private
-
- (HaveAttributes) initialize(expected)
constructor
private
A new instance of HaveAttributes.
- - (Boolean) matches?(actual) private
Methods inherited from BaseMatcher
#expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
- (HaveAttributes) initialize(expected)
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.
Returns a new instance of HaveAttributes
11 12 13 14 15 16 |
# File 'lib/rspec/matchers/built_in/have_attributes.rb', line 11 def initialize(expected) @expected = expected @values = {} @respond_to_failed = false @negated = false end |
Instance Method Details
- (String) description
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.
43 44 45 46 |
# File 'lib/rspec/matchers/built_in/have_attributes.rb', line 43 def description described_items = surface_descriptions_in(expected) improve_hash_formatting "have attributes #{RSpec::Support::ObjectFormatter.format(described_items)}" end |
- (Boolean) diffable?
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.
50 51 52 |
# File 'lib/rspec/matchers/built_in/have_attributes.rb', line 50 def diffable? !@respond_to_failed && !@negated end |
- (Boolean) does_not_match?(actual)
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.
34 35 36 37 38 39 |
# File 'lib/rspec/matchers/built_in/have_attributes.rb', line 34 def does_not_match?(actual) @actual = actual @negated = true return false unless respond_to_attributes? perform_match(:none?) end |
- (String) failure_message
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.
56 57 58 59 60 |
# File 'lib/rspec/matchers/built_in/have_attributes.rb', line 56 def do "expected #{actual_formatted} to #{description} but had attributes #{ formatted_values }" end end |
- (String) failure_message_when_negated
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.
64 65 66 |
# File 'lib/rspec/matchers/built_in/have_attributes.rb', line 64 def { "expected #{actual_formatted} not to #{description}" } end |
- (Boolean) matches?(actual)
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.
25 26 27 28 29 30 |
# File 'lib/rspec/matchers/built_in/have_attributes.rb', line 25 def matches?(actual) @actual = actual @negated = false return false unless respond_to_attributes? perform_match(:all?) end |