Class: RSpec::Matchers::BuiltIn::ChangeRelatively Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::ChangeRelatively
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.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.
Used to specify a relative change.
Constant Summary
Constants inherited from BaseMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected, #matcher_name, #rescued_exception
Instance Method Summary collapse
- #description ⇒ Object private
- #does_not_match?(_event_proc) ⇒ Boolean private
- #failure_message ⇒ Object private
-
#initialize(change_details, expected_delta, relativity, &comparer) ⇒ ChangeRelatively
constructor
private
A new instance of ChangeRelatively.
- #matches?(event_proc) ⇒ Boolean private
- #supports_block_expectations? ⇒ Boolean private
- #supports_value_expectations? ⇒ Boolean private
Methods inherited from BaseMatcher
#actual_formatted, #diffable?, #expected_formatted, #expects_call_stack_jump?, #match_unless_raises, matcher_name
Methods included from BaseMatcher::DefaultFailureMessages
#failure_message_when_negated, has_default_failure_messages?
Methods included from BaseMatcher::HashFormatting
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
#initialize(change_details, expected_delta, relativity, &comparer) ⇒ ChangeRelatively
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 ChangeRelatively.
129 130 131 132 133 134 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.rb', line 129 def initialize(change_details, expected_delta, relativity, &comparer) @change_details = change_details @expected_delta = expected_delta @relativity = relativity @comparer = comparer end |
Instance Method Details
#description ⇒ Object
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.
156 157 158 159 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.rb', line 156 def description "change #{@change_details.value_representation} " \ "#{@relativity.to_s.tr('_', ' ')} #{description_of @expected_delta}" end |
#does_not_match?(_event_proc) ⇒ 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.
150 151 152 153 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.rb', line 150 def does_not_match?(_event_proc) raise NotImplementedError, "`expect { }.not_to change " \ "{ }.#{@relativity}()` is not supported" end |
#failure_message ⇒ Object
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.
137 138 139 140 141 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.rb', line 137 def "expected #{@change_details.value_representation} to have changed " \ "#{@relativity.to_s.tr('_', ' ')} " \ "#{description_of @expected_delta}, but #{failure_reason}" end |
#matches?(event_proc) ⇒ 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.
144 145 146 147 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.rb', line 144 def matches?(event_proc) @event_proc = event_proc @change_details.perform_change(event_proc) && @comparer.call(@change_details.actual_delta) end |
#supports_block_expectations? ⇒ 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.
162 163 164 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.rb', line 162 def supports_block_expectations? true end |
#supports_value_expectations? ⇒ 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.
167 168 169 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/change.rb', line 167 def supports_value_expectations? false end |