Class: RSpec::Matchers::ExpectedsForMultipleDiffs Private
- Inherits:
-
Object
- Object
- RSpec::Matchers::ExpectedsForMultipleDiffs
- Defined in:
- lib/rspec/matchers/expecteds_for_multiple_diffs.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.
Handles list of expected values when there is a need to render multiple diffs. Also can handle one value.
Constant Summary
Class Method Summary (collapse)
-
+ (RSpec::Matchers::ExpectedsForMultipleDiffs) for_many_matchers(matchers)
private
Wraps provided matcher list in instance of ExpectedForMultipleDiffs.
-
+ (RSpec::Matchers::ExpectedsForMultipleDiffs) from(expected)
private
Wraps provided expected value in instance of ExpectedForMultipleDiffs.
Instance Method Summary (collapse)
-
- (ExpectedsForMultipleDiffs) initialize(expected_list)
constructor
private
A new instance of ExpectedsForMultipleDiffs.
-
- (String) message_with_diff(message, differ, actual)
private
Returns message with diff(s) appended for provided differ factory and actual value if there are any.
Constructor Details
- (ExpectedsForMultipleDiffs) initialize(expected_list)
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 ExpectedsForMultipleDiffs
16 17 18 |
# File 'lib/rspec/matchers/expecteds_for_multiple_diffs.rb', line 16 def initialize(expected_list) @expected_list = expected_list end |
Class Method Details
+ (RSpec::Matchers::ExpectedsForMultipleDiffs) for_many_matchers(matchers)
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.
Wraps provided matcher list in instance of ExpectedForMultipleDiffs.
36 37 38 |
# File 'lib/rspec/matchers/expecteds_for_multiple_diffs.rb', line 36 def self.for_many_matchers(matchers) new(matchers.map { |m| [m.expected, diff_label_for(m)] }) end |
+ (RSpec::Matchers::ExpectedsForMultipleDiffs) from(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.
Wraps provided expected value in instance of ExpectedForMultipleDiffs. If provided value is already an ExpectedForMultipleDiffs then it just returns it.
26 27 28 29 |
# File 'lib/rspec/matchers/expecteds_for_multiple_diffs.rb', line 26 def self.from(expected) return expected if self === expected new([[expected, DEFAULT_DIFF_LABEL]]) end |
Instance Method Details
- (String) message_with_diff(message, differ, 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.
Returns message with diff(s) appended for provided differ factory and actual value if there are any
47 48 49 50 51 |
# File 'lib/rspec/matchers/expecteds_for_multiple_diffs.rb', line 47 def (, differ, actual) diff = diffs(differ, actual) = "#{}\n#{diff}" unless diff.empty? end |