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.
Class Method Summary collapse
-
.for_many_matchers(matchers) ⇒ RSpec::Matchers::ExpectedsForMultipleDiffs
private
Wraps provided matcher list in instance of ExpectedForMultipleDiffs.
-
.from(expected) ⇒ RSpec::Matchers::ExpectedsForMultipleDiffs
private
Wraps provided expected value in instance of ExpectedForMultipleDiffs.
Instance Method Summary collapse
-
#initialize(expected_list) ⇒ ExpectedsForMultipleDiffs
constructor
private
A new instance of ExpectedsForMultipleDiffs.
-
#message_with_diff(message, differ, actual) ⇒ String
private
Returns message with diff(s) appended for provided differ factory and actual value if there are any.
Constructor Details
#initialize(expected_list) ⇒ ExpectedsForMultipleDiffs
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
.for_many_matchers(matchers) ⇒ RSpec::Matchers::ExpectedsForMultipleDiffs
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 |
.from(expected) ⇒ RSpec::Matchers::ExpectedsForMultipleDiffs
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
#message_with_diff(message, differ, actual) ⇒ String
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 |