Class: RSpec::Matchers::BuiltIn::Change Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Change
- Defined in:
- 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.
Provides the implementation for change.
Not intended to be instantiated directly.
Constant Summary
Constant Summary
Constants inherited from BaseMatcher
Instance Method Summary (collapse)
-
- (Object) by(expected_delta)
Specifies the delta of the expected change.
-
- (Object) by_at_least(minimum)
Specifies a minimum delta of the expected change.
-
- (Object) by_at_most(maximum)
Specifies a maximum delta of the expected change.
- - (String) description private
- - (Boolean) does_not_match?(event_proc) private
- - (String) failure_message private
- - (String) failure_message_when_negated private
-
- (Object) from(value)
Specifies the original value.
-
- (Object) to(value)
Specifies the new value you expect.
Methods inherited from BaseMatcher
#diffable?, #expects_call_stack_jump?, #match_unless_raises
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, #values_match?
Instance Method Details
- (Object) by(expected_delta)
Specifies the delta of the expected change.
10 11 12 13 14 |
# File 'lib/rspec/matchers/built_in/change.rb', line 10 def by(expected_delta) ChangeRelatively.new(@change_details, expected_delta, :by) do |actual_delta| values_match?(expected_delta, actual_delta) end end |
- (Object) by_at_least(minimum)
Specifies a minimum delta of the expected change.
18 19 20 21 22 |
# File 'lib/rspec/matchers/built_in/change.rb', line 18 def by_at_least(minimum) ChangeRelatively.new(@change_details, minimum, :by_at_least) do |actual_delta| actual_delta >= minimum end end |
- (Object) by_at_most(maximum)
Specifies a maximum delta of the expected change.
26 27 28 29 30 |
# File 'lib/rspec/matchers/built_in/change.rb', line 26 def by_at_most(maximum) ChangeRelatively.new(@change_details, maximum, :by_at_most) do |actual_delta| actual_delta <= maximum end end |
- (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.
72 73 74 |
# File 'lib/rspec/matchers/built_in/change.rb', line 72 def description "change #{@change_details.}" end |
- (Boolean) does_not_match?(event_proc)
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.
53 54 55 56 |
# File 'lib/rspec/matchers/built_in/change.rb', line 53 def does_not_match?(event_proc) raise_block_syntax_error if block_given? !matches?(event_proc) && Proc === event_proc 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.
60 61 62 |
# File 'lib/rspec/matchers/built_in/change.rb', line 60 def "expected #{@change_details.} to have changed, but #{positive_failure_reason}" 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.
66 67 68 |
# File 'lib/rspec/matchers/built_in/change.rb', line 66 def "expected #{@change_details.} not to have changed, but #{negative_failure_reason}" end |
- (Object) from(value)
Specifies the original value.
40 41 42 |
# File 'lib/rspec/matchers/built_in/change.rb', line 40 def from(value) ChangeFromValue.new(@change_details, value) end |
- (Object) to(value)
Specifies the new value you expect.
34 35 36 |
# File 'lib/rspec/matchers/built_in/change.rb', line 34 def to(value) ChangeToValue.new(@change_details, value) end |