Class: RSpec::Matchers::BuiltIn::ChangeFromValue Private
- Inherits:
-
SpecificValuesChange
- Object
- BaseMatcher
- SpecificValuesChange
- RSpec::Matchers::BuiltIn::ChangeFromValue
- 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 change from a specific value (and, optionally, to a specific value).
Constant Summary
Constants inherited from SpecificValuesChange
SpecificValuesChange::MATCH_ANYTHING
Constants inherited from BaseMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected, #matcher_name, #rescued_exception
Instance Method Summary collapse
- #does_not_match?(event_proc) ⇒ Boolean private
- #failure_message_when_negated ⇒ Object private
-
#initialize(change_details, expected_before) ⇒ ChangeFromValue
constructor
private
A new instance of ChangeFromValue.
-
#to(value) ⇒ Object
Specifies the new value you expect.
Methods inherited from SpecificValuesChange
#description, #failure_message, #matches?, #supports_block_expectations?, #supports_value_expectations?
Methods inherited from BaseMatcher
#actual_formatted, #description, #diffable?, #expected_formatted, #expects_call_stack_jump?, #match_unless_raises, matcher_name, #matches?, #supports_block_expectations?, #supports_value_expectations?
Methods included from BaseMatcher::DefaultFailureMessages
#failure_message, 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_before) ⇒ ChangeFromValue
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 ChangeFromValue.
271 272 273 274 |
# 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 271 def initialize(change_details, expected_before) @description_suffix = nil super(change_details, expected_before, MATCH_ANYTHING) end |
Instance Method Details
#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.
285 286 287 288 289 290 291 292 |
# 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 285 def does_not_match?(event_proc) if @description_suffix raise NotImplementedError, "`expect { }.not_to change { }.to()` " \ "is not supported" end perform_change(event_proc) && !@change_details.changed? && @matches_before end |
#failure_message_when_negated ⇒ 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.
295 296 297 298 299 |
# 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 295 def return not_given_a_block_failure unless Proc === @event_proc return before_value_failure unless @matches_before did_change_failure end |
#to(value) ⇒ Object
Specifies the new value you expect.
278 279 280 281 282 |
# 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 278 def to(value) @expected_after = value @description_suffix = " to #{description_of value}" self end |