super_diff 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +64 -24
  3. data/lib/super_diff.rb +20 -17
  4. data/lib/super_diff/active_record.rb +20 -24
  5. data/lib/super_diff/active_record/diff_formatters/active_record_relation.rb +3 -3
  6. data/lib/super_diff/active_record/differs/active_record_relation.rb +3 -5
  7. data/lib/super_diff/active_record/object_inspection/inspectors/active_record_model.rb +32 -22
  8. data/lib/super_diff/active_record/object_inspection/inspectors/active_record_relation.rb +17 -7
  9. data/lib/super_diff/active_record/operation_tree_builders.rb +14 -0
  10. data/lib/super_diff/active_record/{operational_sequencers → operation_tree_builders}/active_record_model.rb +2 -2
  11. data/lib/super_diff/active_record/{operational_sequencers → operation_tree_builders}/active_record_relation.rb +4 -4
  12. data/lib/super_diff/active_record/{operation_sequences.rb → operation_trees.rb} +2 -2
  13. data/lib/super_diff/active_record/{operation_sequences → operation_trees}/active_record_relation.rb +2 -2
  14. data/lib/super_diff/active_support.rb +16 -19
  15. data/lib/super_diff/active_support/diff_formatters/hash_with_indifferent_access.rb +3 -3
  16. data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +3 -5
  17. data/lib/super_diff/active_support/object_inspection/inspectors/hash_with_indifferent_access.rb +17 -7
  18. data/lib/super_diff/active_support/operation_tree_builders.rb +10 -0
  19. data/lib/super_diff/active_support/{operational_sequencers → operation_tree_builders}/hash_with_indifferent_access.rb +2 -2
  20. data/lib/super_diff/active_support/{operation_sequences.rb → operation_trees.rb} +2 -2
  21. data/lib/super_diff/active_support/{operation_sequences → operation_trees}/hash_with_indifferent_access.rb +2 -2
  22. data/lib/super_diff/colorized_document_extensions.rb +4 -4
  23. data/lib/super_diff/configuration.rb +70 -0
  24. data/lib/super_diff/csi.rb +2 -1
  25. data/lib/super_diff/diff_formatters.rb +3 -3
  26. data/lib/super_diff/diff_formatters/array.rb +3 -3
  27. data/lib/super_diff/diff_formatters/base.rb +3 -2
  28. data/lib/super_diff/diff_formatters/collection.rb +3 -3
  29. data/lib/super_diff/diff_formatters/custom_object.rb +3 -3
  30. data/lib/super_diff/diff_formatters/default_object.rb +6 -8
  31. data/lib/super_diff/diff_formatters/defaults.rb +10 -0
  32. data/lib/super_diff/diff_formatters/hash.rb +3 -3
  33. data/lib/super_diff/diff_formatters/main.rb +41 -0
  34. data/lib/super_diff/diff_formatters/multiline_string.rb +7 -7
  35. data/lib/super_diff/differs.rb +4 -11
  36. data/lib/super_diff/differs/array.rb +2 -11
  37. data/lib/super_diff/differs/base.rb +20 -3
  38. data/lib/super_diff/differs/custom_object.rb +2 -11
  39. data/lib/super_diff/differs/default_object.rb +2 -8
  40. data/lib/super_diff/differs/defaults.rb +12 -0
  41. data/lib/super_diff/differs/hash.rb +2 -11
  42. data/lib/super_diff/differs/main.rb +48 -0
  43. data/lib/super_diff/differs/multiline_string.rb +2 -14
  44. data/lib/super_diff/differs/time_like.rb +15 -0
  45. data/lib/super_diff/equality_matchers.rb +3 -9
  46. data/lib/super_diff/equality_matchers/array.rb +3 -9
  47. data/lib/super_diff/equality_matchers/base.rb +1 -1
  48. data/lib/super_diff/equality_matchers/default.rb +3 -9
  49. data/lib/super_diff/equality_matchers/defaults.rb +12 -0
  50. data/lib/super_diff/equality_matchers/hash.rb +3 -9
  51. data/lib/super_diff/equality_matchers/main.rb +21 -0
  52. data/lib/super_diff/equality_matchers/multiline_string.rb +3 -9
  53. data/lib/super_diff/equality_matchers/primitive.rb +2 -2
  54. data/lib/super_diff/equality_matchers/singleline_string.rb +2 -2
  55. data/lib/super_diff/errors.rb +16 -0
  56. data/lib/super_diff/errors/no_diff_formatter_available_error.rb +21 -0
  57. data/lib/super_diff/errors/no_differ_available_error.rb +24 -0
  58. data/lib/super_diff/errors/no_operational_sequencer_available_error.rb +22 -0
  59. data/lib/super_diff/gem_version.rb +45 -0
  60. data/lib/super_diff/implementation_checks.rb +19 -0
  61. data/lib/super_diff/object_inspection.rb +1 -10
  62. data/lib/super_diff/object_inspection/inspection_tree.rb +6 -2
  63. data/lib/super_diff/object_inspection/inspectors.rb +5 -1
  64. data/lib/super_diff/object_inspection/inspectors/array.rb +20 -10
  65. data/lib/super_diff/object_inspection/inspectors/base.rb +36 -0
  66. data/lib/super_diff/object_inspection/inspectors/custom_object.rb +24 -14
  67. data/lib/super_diff/object_inspection/inspectors/default_object.rb +44 -30
  68. data/lib/super_diff/object_inspection/inspectors/defaults.rb +15 -0
  69. data/lib/super_diff/object_inspection/inspectors/hash.rb +20 -10
  70. data/lib/super_diff/object_inspection/inspectors/main.rb +35 -0
  71. data/lib/super_diff/object_inspection/inspectors/primitive.rb +20 -5
  72. data/lib/super_diff/object_inspection/inspectors/string.rb +15 -5
  73. data/lib/super_diff/object_inspection/inspectors/time_like.rb +23 -0
  74. data/lib/super_diff/object_inspection/nodes/inspection.rb +9 -2
  75. data/lib/super_diff/operation_tree_builders.rb +18 -0
  76. data/lib/super_diff/{operational_sequencers → operation_tree_builders}/array.rb +38 -59
  77. data/lib/super_diff/operation_tree_builders/base.rb +98 -0
  78. data/lib/super_diff/{operational_sequencers → operation_tree_builders}/custom_object.rb +3 -3
  79. data/lib/super_diff/{operational_sequencers → operation_tree_builders}/default_object.rb +8 -3
  80. data/lib/super_diff/operation_tree_builders/defaults.rb +5 -0
  81. data/lib/super_diff/operation_tree_builders/hash.rb +226 -0
  82. data/lib/super_diff/operation_tree_builders/main.rb +42 -0
  83. data/lib/super_diff/{operational_sequencers → operation_tree_builders}/multiline_string.rb +3 -3
  84. data/lib/super_diff/operation_tree_builders/time_like.rb +34 -0
  85. data/lib/super_diff/operation_trees.rb +13 -0
  86. data/lib/super_diff/{operation_sequences → operation_trees}/array.rb +5 -1
  87. data/lib/super_diff/{operation_sequences → operation_trees}/base.rb +9 -1
  88. data/lib/super_diff/{operation_sequences → operation_trees}/custom_object.rb +5 -1
  89. data/lib/super_diff/{operation_sequences → operation_trees}/default_object.rb +10 -8
  90. data/lib/super_diff/operation_trees/defaults.rb +5 -0
  91. data/lib/super_diff/{operation_sequences → operation_trees}/hash.rb +5 -1
  92. data/lib/super_diff/operation_trees/main.rb +35 -0
  93. data/lib/super_diff/operation_trees/multiline_string.rb +18 -0
  94. data/lib/super_diff/operations/unary_operation.rb +3 -0
  95. data/lib/super_diff/recursion_guard.rb +2 -0
  96. data/lib/super_diff/rspec.rb +49 -13
  97. data/lib/super_diff/rspec/augmented_matcher.rb +1 -1
  98. data/lib/super_diff/rspec/differ.rb +2 -17
  99. data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +2 -7
  100. data/lib/super_diff/rspec/differs/collection_including.rb +2 -7
  101. data/lib/super_diff/rspec/differs/hash_including.rb +2 -7
  102. data/lib/super_diff/rspec/differs/object_having_attributes.rb +2 -7
  103. data/lib/super_diff/rspec/matcher_text_builders/base.rb +7 -7
  104. data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +6 -6
  105. data/lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb +1 -1
  106. data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +4 -4
  107. data/lib/super_diff/rspec/matcher_text_builders/match.rb +1 -1
  108. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -1
  109. data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +6 -6
  110. data/lib/super_diff/rspec/matcher_text_template.rb +1 -1
  111. data/lib/super_diff/rspec/monkey_patches.rb +23 -14
  112. data/lib/super_diff/rspec/object_inspection.rb +0 -1
  113. data/lib/super_diff/rspec/object_inspection/inspectors.rb +16 -0
  114. data/lib/super_diff/rspec/object_inspection/inspectors/collection_containing_exactly.rb +17 -8
  115. data/lib/super_diff/rspec/object_inspection/inspectors/collection_including.rb +15 -9
  116. data/lib/super_diff/rspec/object_inspection/inspectors/hash_including.rb +20 -10
  117. data/lib/super_diff/rspec/object_inspection/inspectors/instance_of.rb +23 -0
  118. data/lib/super_diff/rspec/object_inspection/inspectors/kind_of.rb +23 -0
  119. data/lib/super_diff/rspec/object_inspection/inspectors/object_having_attributes.rb +20 -11
  120. data/lib/super_diff/rspec/object_inspection/inspectors/primitive.rb +13 -0
  121. data/lib/super_diff/rspec/object_inspection/inspectors/value_within.rb +29 -0
  122. data/lib/super_diff/rspec/operation_tree_builders.rb +22 -0
  123. data/lib/super_diff/rspec/{operational_sequencers → operation_tree_builders}/collection_containing_exactly.rb +17 -6
  124. data/lib/super_diff/rspec/{operational_sequencers → operation_tree_builders}/collection_including.rb +2 -2
  125. data/lib/super_diff/rspec/{operational_sequencers → operation_tree_builders}/hash_including.rb +3 -11
  126. data/lib/super_diff/rspec/{operational_sequencers → operation_tree_builders}/object_having_attributes.rb +4 -8
  127. data/lib/super_diff/version.rb +1 -1
  128. data/spec/examples.txt +393 -393
  129. data/spec/integration/rspec/be_falsey_matcher_spec.rb +10 -10
  130. data/spec/integration/rspec/be_matcher_spec.rb +100 -100
  131. data/spec/integration/rspec/be_nil_matcher_spec.rb +10 -10
  132. data/spec/integration/rspec/be_predicate_matcher_spec.rb +103 -103
  133. data/spec/integration/rspec/be_truthy_matcher_spec.rb +10 -10
  134. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +107 -107
  135. data/spec/integration/rspec/eq_matcher_spec.rb +230 -230
  136. data/spec/integration/rspec/have_attributes_matcher_spec.rb +360 -233
  137. data/spec/integration/rspec/have_predicate_matcher_spec.rb +65 -65
  138. data/spec/integration/rspec/include_matcher_spec.rb +73 -73
  139. data/spec/integration/rspec/match_array_matcher_spec.rb +149 -107
  140. data/spec/integration/rspec/match_matcher_spec.rb +274 -274
  141. data/spec/integration/rspec/raise_error_matcher_spec.rb +86 -86
  142. data/spec/integration/rspec/respond_to_matcher_spec.rb +240 -240
  143. data/spec/integration/rspec/third_party_matcher_spec.rb +8 -8
  144. data/spec/integration/rspec/unhandled_errors_spec.rb +69 -13
  145. data/spec/spec_helper.rb +22 -13
  146. data/spec/support/command_runner.rb +3 -0
  147. data/spec/support/integration/helpers.rb +15 -95
  148. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +15 -30
  149. data/spec/support/integration/test_programs/base.rb +122 -0
  150. data/spec/support/integration/test_programs/plain.rb +13 -0
  151. data/spec/support/integration/test_programs/rspec_active_record.rb +17 -0
  152. data/spec/support/integration/test_programs/rspec_active_support.rb +17 -0
  153. data/spec/support/integration/test_programs/rspec_rails.rb +17 -0
  154. data/spec/support/models/active_record/person.rb +4 -11
  155. data/spec/support/models/active_record/shipping_address.rb +10 -14
  156. data/spec/support/object_id.rb +6 -5
  157. data/spec/support/shared_examples/active_record.rb +108 -108
  158. data/spec/support/shared_examples/hash_with_indifferent_access.rb +196 -232
  159. data/spec/tmp/integration_spec.rb +15 -0
  160. data/spec/unit/{equality_matcher_spec.rb → equality_matchers/main_spec.rb} +518 -362
  161. data/spec/unit/object_inspection_spec.rb +77 -1
  162. data/super_diff.gemspec +3 -2
  163. metadata +83 -54
  164. data/lib/super_diff/active_record/object_inspection/map_extension.rb +0 -18
  165. data/lib/super_diff/active_record/operational_sequencers.rb +0 -14
  166. data/lib/super_diff/active_support/object_inspection/map_extension.rb +0 -15
  167. data/lib/super_diff/active_support/operational_sequencers.rb +0 -10
  168. data/lib/super_diff/diff_formatter.rb +0 -32
  169. data/lib/super_diff/differ.rb +0 -51
  170. data/lib/super_diff/differs/time.rb +0 -24
  171. data/lib/super_diff/equality_matcher.rb +0 -32
  172. data/lib/super_diff/no_differ_available_error.rb +0 -22
  173. data/lib/super_diff/no_operational_sequencer_available_error.rb +0 -20
  174. data/lib/super_diff/object_inspection/inspector.rb +0 -27
  175. data/lib/super_diff/object_inspection/inspectors/time.rb +0 -13
  176. data/lib/super_diff/object_inspection/map.rb +0 -30
  177. data/lib/super_diff/operation_sequences.rb +0 -9
  178. data/lib/super_diff/operational_sequencer.rb +0 -48
  179. data/lib/super_diff/operational_sequencers.rb +0 -17
  180. data/lib/super_diff/operational_sequencers/base.rb +0 -89
  181. data/lib/super_diff/operational_sequencers/hash.rb +0 -85
  182. data/lib/super_diff/operational_sequencers/time_like.rb +0 -30
  183. data/lib/super_diff/rspec/configuration.rb +0 -31
  184. data/lib/super_diff/rspec/object_inspection/map_extension.rb +0 -23
  185. data/lib/super_diff/rspec/operational_sequencers.rb +0 -22
@@ -6,7 +6,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
6
6
  as_both_colored_and_uncolored do |color_enabled|
7
7
  snippet = <<~TEST.strip
8
8
  expected = ["Einie", "Marty"]
9
- actual = ["Marty", "Jennifer", "Doc"]
9
+ actual = ["Marty", "Jennifer", "Doc"]
10
10
  expect(actual).to match_array(expected)
11
11
  TEST
12
12
  program = make_plain_test_program(
@@ -19,22 +19,22 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
19
19
  snippet: %|expect(actual).to match_array(expected)|,
20
20
  expectation: proc {
21
21
  line do
22
- plain "Expected "
23
- beta %|["Marty", "Jennifer", "Doc"]|
24
- plain " to match array with "
25
- alpha %|"Einie"|
26
- plain " and "
27
- alpha %|"Marty"|
28
- plain "."
22
+ plain %|Expected |
23
+ actual %|["Marty", "Jennifer", "Doc"]|
24
+ plain %| to match array with |
25
+ expected %|"Einie"|
26
+ plain %| and |
27
+ expected %|"Marty"|
28
+ plain %|.|
29
29
  end
30
30
  },
31
31
  diff: proc {
32
- plain_line %| [|
33
- plain_line %| "Marty",|
34
- plain_line %| "Jennifer",|
35
- plain_line %| "Doc",|
36
- alpha_line %|- "Einie"|
37
- plain_line %| ]|
32
+ plain_line %| [|
33
+ plain_line %| "Marty",|
34
+ actual_line %|+ "Jennifer",|
35
+ actual_line %|+ "Doc",|
36
+ expected_line %|- "Einie"|
37
+ plain_line %| ]|
38
38
  },
39
39
  )
40
40
 
@@ -60,13 +60,13 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
60
60
  snippet: %|expect(values).not_to match_array(values)|,
61
61
  expectation: proc {
62
62
  line do
63
- plain "Expected "
64
- beta %|["Einie", "Marty"]|
65
- plain " not to match array with "
66
- alpha %|"Einie"|
67
- plain " and "
68
- alpha %|"Marty"|
69
- plain "."
63
+ plain %|Expected |
64
+ actual %|["Einie", "Marty"]|
65
+ plain %| not to match array with |
66
+ expected %|"Einie"|
67
+ plain %| and |
68
+ expected %|"Marty"|
69
+ plain %|.|
70
70
  end
71
71
  },
72
72
  )
@@ -90,7 +90,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
90
90
  "George McFly",
91
91
  "Lorraine McFly"
92
92
  ]
93
- actual = [
93
+ actual = [
94
94
  "Marty McFly",
95
95
  "Doc Brown",
96
96
  "Einie",
@@ -108,32 +108,32 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
108
108
  snippet: %|expect(actual).to match_array(expected)|,
109
109
  expectation: proc {
110
110
  line do
111
- plain " Expected "
112
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
111
+ plain %| Expected |
112
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
113
113
  end
114
114
 
115
115
  line do
116
- plain "to match array with "
117
- alpha %|"Doc Brown"|
118
- plain ", "
119
- alpha %|"Marty McFly"|
120
- plain ", "
121
- alpha %|"Biff Tannen"|
122
- plain ", "
123
- alpha %|"George McFly"|
124
- plain " and "
125
- alpha %|"Lorraine McFly"|
116
+ plain %|to match array with |
117
+ expected %|"Doc Brown"|
118
+ plain %|, |
119
+ expected %|"Marty McFly"|
120
+ plain %|, |
121
+ expected %|"Biff Tannen"|
122
+ plain %|, |
123
+ expected %|"George McFly"|
124
+ plain %| and |
125
+ expected %|"Lorraine McFly"|
126
126
  end
127
127
  },
128
128
  diff: proc {
129
- plain_line %| [|
130
- plain_line %| "Marty McFly",|
131
- plain_line %| "Doc Brown",|
132
- plain_line %| "Einie",|
133
- plain_line %| "Lorraine McFly",|
134
- alpha_line %|- "Biff Tannen",|
135
- alpha_line %|- "George McFly"|
136
- plain_line %| ]|
129
+ plain_line %| [|
130
+ plain_line %| "Marty McFly",|
131
+ plain_line %| "Doc Brown",|
132
+ plain_line %| "Lorraine McFly",|
133
+ actual_line %|+ "Einie",|
134
+ expected_line %|- "Biff Tannen",|
135
+ expected_line %|- "George McFly"|
136
+ plain_line %| ]|
137
137
  },
138
138
  )
139
139
 
@@ -165,19 +165,19 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
165
165
  newline_before_expectation: true,
166
166
  expectation: proc {
167
167
  line do
168
- plain " Expected "
169
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
168
+ plain %| Expected |
169
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
170
170
  end
171
171
 
172
172
  line do
173
- plain "not to match array with "
174
- alpha %|"Marty McFly"|
175
- plain ", "
176
- alpha %|"Doc Brown"|
177
- plain ", "
178
- alpha %|"Einie"|
179
- plain " and "
180
- alpha %|"Lorraine McFly"|
173
+ plain %|not to match array with |
174
+ expected %|"Marty McFly"|
175
+ plain %|, |
176
+ expected %|"Doc Brown"|
177
+ plain %|, |
178
+ expected %|"Einie"|
179
+ plain %| and |
180
+ expected %|"Lorraine McFly"|
181
181
  end
182
182
  },
183
183
  )
@@ -200,7 +200,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
200
200
  /Georg McFly/,
201
201
  /Lorrain McFly/
202
202
  ]
203
- actual = [
203
+ actual = [
204
204
  "Marty McFly",
205
205
  "Doc Brown",
206
206
  "Einie",
@@ -218,33 +218,33 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
218
218
  snippet: %|expect(actual).to match_array(expected)|,
219
219
  expectation: proc {
220
220
  line do
221
- plain " Expected "
222
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
221
+ plain %| Expected |
222
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
223
223
  end
224
224
 
225
225
  line do
226
- plain "to match array with "
227
- alpha %|/ Brown$/|
228
- plain ", "
229
- alpha %|"Marty McFly"|
230
- plain ", "
231
- alpha %|"Biff Tannen"|
232
- plain ", "
233
- alpha %|/Georg McFly/|
234
- plain " and "
235
- alpha %|/Lorrain McFly/|
226
+ plain %|to match array with |
227
+ expected %|/ Brown$/|
228
+ plain %|, |
229
+ expected %|"Marty McFly"|
230
+ plain %|, |
231
+ expected %|"Biff Tannen"|
232
+ plain %|, |
233
+ expected %|/Georg McFly/|
234
+ plain %| and |
235
+ expected %|/Lorrain McFly/|
236
236
  end
237
237
  },
238
238
  diff: proc {
239
- plain_line %| [|
240
- plain_line %| "Marty McFly",|
241
- plain_line %| "Doc Brown",|
242
- plain_line %| "Einie",|
243
- plain_line %| "Lorraine McFly",|
244
- alpha_line %|- "Biff Tannen",|
245
- alpha_line %|- /Georg McFly/,|
246
- alpha_line %|- /Lorrain McFly/|
247
- plain_line %| ]|
239
+ plain_line %| [|
240
+ plain_line %| "Marty McFly",|
241
+ plain_line %| "Doc Brown",|
242
+ actual_line %|+ "Einie",|
243
+ actual_line %|+ "Lorraine McFly",|
244
+ expected_line %|- "Biff Tannen",|
245
+ expected_line %|- /Georg McFly/,|
246
+ expected_line %|- /Lorrain McFly/|
247
+ plain_line %| ]|
248
248
  },
249
249
  )
250
250
 
@@ -277,23 +277,23 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
277
277
  newline_before_expectation: true,
278
278
  expectation: proc {
279
279
  line do
280
- plain " Expected "
280
+ plain %| Expected |
281
281
  # rubocop:disable Metrics/LineLength
282
- beta %|[/ Brown$/, "Marty McFly", "Biff Tannen", /Georg McFly/, /Lorrain McFly/]|
282
+ actual %|[/ Brown$/, "Marty McFly", "Biff Tannen", /Georg McFly/, /Lorrain McFly/]|
283
283
  # rubocop:enable Metrics/LineLength
284
284
  end
285
285
 
286
286
  line do
287
- plain "not to match array with "
288
- alpha %|/ Brown$/|
289
- plain ", "
290
- alpha %|"Marty McFly"|
291
- plain ", "
292
- alpha %|"Biff Tannen"|
293
- plain ", "
294
- alpha %|/Georg McFly/|
295
- plain " and "
296
- alpha %|/Lorrain McFly/|
287
+ plain %|not to match array with |
288
+ expected %|/ Brown$/|
289
+ plain %|, |
290
+ expected %|"Marty McFly"|
291
+ plain %|, |
292
+ expected %|"Biff Tannen"|
293
+ plain %|, |
294
+ expected %|/Georg McFly/|
295
+ plain %| and |
296
+ expected %|/Lorrain McFly/|
297
297
  end
298
298
  },
299
299
  )
@@ -314,7 +314,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
314
314
  a_collection_containing_exactly("zing"),
315
315
  an_object_having_attributes(baz: "qux"),
316
316
  ]
317
- actual = [
317
+ actual = [
318
318
  { foo: "bar" },
319
319
  double(baz: "qux"),
320
320
  { blargh: "riddle" }
@@ -331,34 +331,34 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
331
331
  snippet: %|expect(actual).to match_array(expected)|,
332
332
  expectation: proc {
333
333
  line do
334
- plain " Expected "
334
+ plain %| Expected |
335
335
  # rubocop:disable Metrics/LineLength
336
- beta %|[{ foo: "bar" }, #<Double (anonymous)>, { blargh: "riddle" }]|
336
+ actual %|[{ foo: "bar" }, #<Double (anonymous)>, { blargh: "riddle" }]|
337
337
  # rubocop:enable Metrics/LineLength
338
338
  end
339
339
 
340
340
  line do
341
- plain "to match array with "
342
- alpha %|#<a hash including (foo: "bar")>|
343
- plain ", "
344
- alpha %|#<a collection containing exactly ("zing")>|
345
- plain " and "
346
- alpha %|#<an object having attributes (baz: "qux")>|
341
+ plain %|to match array with |
342
+ expected %|#<a hash including (foo: "bar")>|
343
+ plain %|, |
344
+ expected %|#<a collection containing exactly ("zing")>|
345
+ plain %| and |
346
+ expected %|#<an object having attributes (baz: "qux")>|
347
347
  end
348
348
  },
349
349
  diff: proc {
350
- plain_line %| [|
351
- plain_line %| {|
352
- plain_line %| foo: "bar"|
353
- plain_line %| },|
354
- plain_line %| #<Double (anonymous)>,|
355
- plain_line %| {|
356
- plain_line %| blargh: "riddle"|
357
- plain_line %| },|
358
- alpha_line %|- #<a collection containing exactly (|
359
- alpha_line %|- "zing"|
360
- alpha_line %|- )>|
361
- plain_line %| ]|
350
+ plain_line %| [|
351
+ plain_line %| {|
352
+ plain_line %| foo: "bar"|
353
+ plain_line %| },|
354
+ plain_line %| #<Double (anonymous)>,|
355
+ actual_line %|+ {|
356
+ actual_line %|+ blargh: "riddle"|
357
+ actual_line %|+ },|
358
+ expected_line %|- #<a collection containing exactly (|
359
+ expected_line %|- "zing"|
360
+ expected_line %|- )>|
361
+ plain_line %| ]|
362
362
  },
363
363
  )
364
364
 
@@ -369,4 +369,46 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
369
369
  end
370
370
  end
371
371
  end
372
+
373
+ context "when the input value is a string" do
374
+ it "produces the correct failure message when used in the positive" do
375
+ as_both_colored_and_uncolored do |color_enabled|
376
+ snippet = <<~TEST.strip
377
+ expected = "Einie"
378
+ actual = ["Marty", "Jennifer", "Doc"]
379
+ expect(actual).to match_array(expected)
380
+ TEST
381
+ program = make_plain_test_program(
382
+ snippet,
383
+ color_enabled: color_enabled,
384
+ )
385
+
386
+ expected_output = build_expected_output(
387
+ color_enabled: color_enabled,
388
+ snippet: %|expect(actual).to match_array(expected)|,
389
+ expectation: proc {
390
+ line do
391
+ plain %|Expected |
392
+ actual %|["Marty", "Jennifer", "Doc"]|
393
+ plain %| to match array with |
394
+ expected %|"Einie"|
395
+ plain %|.|
396
+ end
397
+ },
398
+ diff: proc {
399
+ plain_line %| [|
400
+ actual_line %|+ "Marty",|
401
+ actual_line %|+ "Jennifer",|
402
+ actual_line %|+ "Doc",|
403
+ expected_line %|- "Einie"|
404
+ plain_line %| ]|
405
+ },
406
+ )
407
+
408
+ expect(program).
409
+ to produce_output_when_run(expected_output).
410
+ in_color(color_enabled)
411
+ end
412
+ end
413
+ end
372
414
  end
@@ -7,7 +7,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
7
7
  as_both_colored_and_uncolored do |color_enabled|
8
8
  snippet = <<~TEST.strip
9
9
  expected = a_hash_including(city: "Hill Valley")
10
- actual = { city: "Burbank" }
10
+ actual = { city: "Burbank" }
11
11
  expect(actual).to match(expected)
12
12
  TEST
13
13
  program = make_plain_test_program(
@@ -20,18 +20,18 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
20
20
  snippet: %|expect(actual).to match(expected)|,
21
21
  expectation: proc {
22
22
  line do
23
- plain "Expected "
24
- beta %|{ city: "Burbank" }|
25
- plain " to match "
26
- alpha %|#<a hash including (city: "Hill Valley")>|
27
- plain "."
23
+ plain %|Expected |
24
+ actual %|{ city: "Burbank" }|
25
+ plain %| to match |
26
+ expected %|#<a hash including (city: "Hill Valley")>|
27
+ plain %|.|
28
28
  end
29
29
  },
30
30
  diff: proc {
31
- plain_line %| {|
32
- alpha_line %|- city: "Hill Valley"|
33
- beta_line %|+ city: "Burbank"|
34
- plain_line %| }|
31
+ plain_line %| {|
32
+ expected_line %|- city: "Hill Valley"|
33
+ actual_line %|+ city: "Burbank"|
34
+ plain_line %| }|
35
35
  },
36
36
  )
37
37
 
@@ -45,7 +45,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
45
45
  as_both_colored_and_uncolored do |color_enabled|
46
46
  snippet = <<~TEST.strip
47
47
  expected = a_hash_including(city: "Burbank")
48
- actual = { city: "Burbank" }
48
+ actual = { city: "Burbank" }
49
49
  expect(actual).not_to match(expected)
50
50
  TEST
51
51
  program = make_plain_test_program(
@@ -58,11 +58,11 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
58
58
  snippet: %|expect(actual).not_to match(expected)|,
59
59
  expectation: proc {
60
60
  line do
61
- plain "Expected "
62
- beta %|{ city: "Burbank" }|
63
- plain " not to match "
64
- alpha %|#<a hash including (city: "Burbank")>|
65
- plain "."
61
+ plain %|Expected |
62
+ actual %|{ city: "Burbank" }|
63
+ plain %| not to match |
64
+ expected %|#<a hash including (city: "Burbank")>|
65
+ plain %|.|
66
66
  end
67
67
  },
68
68
  )
@@ -82,7 +82,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
82
82
  city: "Hill Valley",
83
83
  zip: "90382"
84
84
  )
85
- actual = {
85
+ actual = {
86
86
  line_1: "123 Main St.",
87
87
  city: "Burbank",
88
88
  state: "CA",
@@ -100,24 +100,24 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
100
100
  snippet: %|expect(actual).to match(expected)|,
101
101
  expectation: proc {
102
102
  line do
103
- plain "Expected "
104
- beta %|{ line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" }|
103
+ plain %|Expected |
104
+ actual %|{ line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" }|
105
105
  end
106
106
 
107
107
  line do
108
- plain "to match "
109
- alpha %|#<a hash including (city: "Hill Valley", zip: "90382")>|
108
+ plain %|to match |
109
+ expected %|#<a hash including (city: "Hill Valley", zip: "90382")>|
110
110
  end
111
111
  },
112
112
  diff: proc {
113
- plain_line %| {|
114
- plain_line %| line_1: "123 Main St.",|
115
- alpha_line %|- city: "Hill Valley",|
116
- beta_line %|+ city: "Burbank",|
117
- plain_line %| state: "CA",|
118
- alpha_line %|- zip: "90382"|
119
- beta_line %|+ zip: "90210"|
120
- plain_line %| }|
113
+ plain_line %| {|
114
+ plain_line %| line_1: "123 Main St.",|
115
+ expected_line %|- city: "Hill Valley",|
116
+ actual_line %|+ city: "Burbank",|
117
+ plain_line %| state: "CA",|
118
+ expected_line %|- zip: "90382"|
119
+ actual_line %|+ zip: "90210"|
120
+ plain_line %| }|
121
121
  },
122
122
  )
123
123
 
@@ -134,7 +134,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
134
134
  city: "Burbank",
135
135
  zip: "90210"
136
136
  )
137
- actual = {
137
+ actual = {
138
138
  line_1: "123 Main St.",
139
139
  city: "Burbank",
140
140
  state: "CA",
@@ -153,13 +153,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
153
153
  newline_before_expectation: true,
154
154
  expectation: proc {
155
155
  line do
156
- plain " Expected "
157
- beta %|{ line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" }|
156
+ plain %| Expected |
157
+ actual %|{ line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" }|
158
158
  end
159
159
 
160
160
  line do
161
- plain "not to match "
162
- alpha %|#<a hash including (city: "Burbank", zip: "90210")>|
161
+ plain %|not to match |
162
+ expected %|#<a hash including (city: "Burbank", zip: "90210")>|
163
163
  end
164
164
  },
165
165
  )
@@ -173,7 +173,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
173
173
  end
174
174
 
175
175
  context "when the expected value includes a hash-including-<something>" do
176
- context "and the corresponding actual value is a hash" do
176
+ context "and the corresponding actual value is a hash" do
177
177
  it "produces the correct failure message when used in the positive" do
178
178
  as_both_colored_and_uncolored do |color_enabled|
179
179
  snippet = <<~TEST.strip
@@ -184,7 +184,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
184
184
  zip: "90382"
185
185
  )
186
186
  }
187
- actual = {
187
+ actual = {
188
188
  name: "Marty McFly",
189
189
  address: {
190
190
  line_1: "123 Main St.",
@@ -205,27 +205,27 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
205
205
  snippet: %|expect(actual).to match(expected)|,
206
206
  expectation: proc {
207
207
  line do
208
- plain "Expected "
209
- beta %|{ name: "Marty McFly", address: { line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" } }|
208
+ plain %|Expected |
209
+ actual %|{ name: "Marty McFly", address: { line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" } }|
210
210
  end
211
211
 
212
212
  line do
213
- plain "to match "
214
- alpha %|{ name: "Marty McFly", address: #<a hash including (city: "Hill Valley", zip: "90382")> }|
213
+ plain %|to match |
214
+ expected %|{ name: "Marty McFly", address: #<a hash including (city: "Hill Valley", zip: "90382")> }|
215
215
  end
216
216
  },
217
217
  diff: proc {
218
- plain_line %| {|
219
- plain_line %| name: "Marty McFly",|
220
- plain_line %| address: {|
221
- plain_line %| line_1: "123 Main St.",|
222
- alpha_line %|- city: "Hill Valley",|
223
- beta_line %|+ city: "Burbank",|
224
- plain_line %| state: "CA",|
225
- alpha_line %|- zip: "90382"|
226
- beta_line %|+ zip: "90210"|
227
- plain_line %| }|
228
- plain_line %| }|
218
+ plain_line %| {|
219
+ plain_line %| name: "Marty McFly",|
220
+ plain_line %| address: {|
221
+ plain_line %| line_1: "123 Main St.",|
222
+ expected_line %|- city: "Hill Valley",|
223
+ actual_line %|+ city: "Burbank",|
224
+ plain_line %| state: "CA",|
225
+ expected_line %|- zip: "90382"|
226
+ actual_line %|+ zip: "90210"|
227
+ plain_line %| }|
228
+ plain_line %| }|
229
229
  },
230
230
  )
231
231
 
@@ -245,7 +245,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
245
245
  zip: "90210"
246
246
  )
247
247
  }
248
- actual = {
248
+ actual = {
249
249
  name: "Marty McFly",
250
250
  address: {
251
251
  line_1: "123 Main St.",
@@ -267,13 +267,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
267
267
  newline_before_expectation: true,
268
268
  expectation: proc {
269
269
  line do
270
- plain " Expected "
271
- beta %|{ name: "Marty McFly", address: { line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" } }|
270
+ plain %| Expected |
271
+ actual %|{ name: "Marty McFly", address: { line_1: "123 Main St.", city: "Burbank", state: "CA", zip: "90210" } }|
272
272
  end
273
273
 
274
274
  line do
275
- plain "not to match "
276
- alpha %|{ name: "Marty McFly", address: #<a hash including (city: "Burbank", zip: "90210")> }|
275
+ plain %|not to match |
276
+ expected %|{ name: "Marty McFly", address: #<a hash including (city: "Burbank", zip: "90210")> }|
277
277
  end
278
278
  },
279
279
  )
@@ -285,7 +285,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
285
285
  end
286
286
  end
287
287
 
288
- context "and the corresponding actual value is not a hash" do
288
+ context "and the corresponding actual value is not a hash" do
289
289
  it "produces the correct failure message" do
290
290
  as_both_colored_and_uncolored do |color_enabled|
291
291
  snippet = <<~TEST.strip
@@ -296,7 +296,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
296
296
  zip: "90382"
297
297
  )
298
298
  }
299
- actual = {
299
+ actual = {
300
300
  name: "Marty McFly",
301
301
  address: nil
302
302
  }
@@ -312,24 +312,24 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
312
312
  snippet: %|expect(actual).to match(expected)|,
313
313
  expectation: proc {
314
314
  line do
315
- plain "Expected "
316
- beta %|{ name: "Marty McFly", address: nil }|
315
+ plain %|Expected |
316
+ actual %|{ name: "Marty McFly", address: nil }|
317
317
  end
318
318
 
319
319
  line do
320
- plain "to match "
321
- alpha %|{ name: "Marty McFly", address: #<a hash including (city: "Hill Valley", zip: "90382")> }|
320
+ plain %|to match |
321
+ expected %|{ name: "Marty McFly", address: #<a hash including (city: "Hill Valley", zip: "90382")> }|
322
322
  end
323
323
  },
324
324
  diff: proc {
325
- plain_line %! {!
326
- plain_line %! name: "Marty McFly",!
327
- alpha_line %!- address: #<a hash including (!
328
- alpha_line %!- city: "Hill Valley",!
329
- alpha_line %!- zip: "90382"!
330
- alpha_line %!- )>!
331
- beta_line %!+ address: nil!
332
- plain_line %! }!
325
+ plain_line %! {!
326
+ plain_line %! name: "Marty McFly",!
327
+ expected_line %!- address: #<a hash including (!
328
+ expected_line %!- city: "Hill Valley",!
329
+ expected_line %!- zip: "90382"!
330
+ expected_line %!- )>!
331
+ actual_line %!+ address: nil!
332
+ plain_line %! }!
333
333
  },
334
334
  )
335
335
 
@@ -347,7 +347,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
347
347
  as_both_colored_and_uncolored do |color_enabled|
348
348
  snippet = <<~TEST.strip
349
349
  expected = a_collection_including("a")
350
- actual = ["b"]
350
+ actual = ["b"]
351
351
  expect(actual).to match(expected)
352
352
  TEST
353
353
  program = make_plain_test_program(
@@ -360,19 +360,19 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
360
360
  snippet: %|expect(actual).to match(expected)|,
361
361
  expectation: proc {
362
362
  line do
363
- plain "Expected "
364
- beta %|["b"]|
365
- plain " to match "
366
- alpha %|#<a collection including ("a")>|
367
- plain "."
363
+ plain %|Expected |
364
+ actual %|["b"]|
365
+ plain %| to match |
366
+ expected %|#<a collection including ("a")>|
367
+ plain %|.|
368
368
  end
369
369
  },
370
370
  diff: proc {
371
- plain_line %| [|
372
- plain_line %| "b"|
373
- # alpha_line %|- "a",| # FIXME
374
- alpha_line %|- "a"|
375
- plain_line %| ]|
371
+ plain_line %| [|
372
+ plain_line %| "b"|
373
+ # expected_line %|- "a",| # FIXME
374
+ expected_line %|- "a"|
375
+ plain_line %| ]|
376
376
  },
377
377
  )
378
378
 
@@ -386,7 +386,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
386
386
  as_both_colored_and_uncolored do |color_enabled|
387
387
  snippet = <<~TEST.strip
388
388
  expected = a_collection_including("b")
389
- actual = ["b"]
389
+ actual = ["b"]
390
390
  expect(actual).not_to match(expected)
391
391
  TEST
392
392
  program = make_plain_test_program(
@@ -399,11 +399,11 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
399
399
  snippet: %|expect(actual).not_to match(expected)|,
400
400
  expectation: proc {
401
401
  line do
402
- plain "Expected "
403
- beta %|["b"]|
404
- plain " not to match "
405
- alpha %|#<a collection including ("b")>|
406
- plain "."
402
+ plain %|Expected |
403
+ actual %|["b"]|
404
+ plain %| not to match |
405
+ expected %|#<a collection including ("b")>|
406
+ plain %|.|
407
407
  end
408
408
  },
409
409
  )
@@ -420,7 +420,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
420
420
  as_both_colored_and_uncolored do |color_enabled|
421
421
  snippet = <<~TEST.strip
422
422
  expected = a_collection_including("milk", "bread")
423
- actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
423
+ actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
424
424
  expect(actual).to match(expected)
425
425
  TEST
426
426
  program = make_plain_test_program(
@@ -433,25 +433,25 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
433
433
  snippet: %|expect(actual).to match(expected)|,
434
434
  expectation: proc {
435
435
  line do
436
- plain "Expected "
437
- beta %|["milk", "toast", "eggs", "cheese", "English muffins"]|
436
+ plain %|Expected |
437
+ actual %|["milk", "toast", "eggs", "cheese", "English muffins"]|
438
438
  end
439
439
 
440
440
  line do
441
- plain "to match "
442
- alpha %|#<a collection including ("milk", "bread")>|
441
+ plain %|to match |
442
+ expected %|#<a collection including ("milk", "bread")>|
443
443
  end
444
444
  },
445
445
  diff: proc {
446
- plain_line %| [|
447
- plain_line %| "milk",|
448
- plain_line %| "toast",|
449
- plain_line %| "eggs",|
450
- plain_line %| "cheese",|
451
- # plain_line %| "English muffins",| # FIXME
452
- plain_line %| "English muffins"|
453
- alpha_line %|- "bread"|
454
- plain_line %| ]|
446
+ plain_line %| [|
447
+ plain_line %| "milk",|
448
+ plain_line %| "toast",|
449
+ plain_line %| "eggs",|
450
+ plain_line %| "cheese",|
451
+ # plain_line %| "English muffins",| # FIXME
452
+ plain_line %| "English muffins"|
453
+ expected_line %|- "bread"|
454
+ plain_line %| ]|
455
455
  },
456
456
  )
457
457
 
@@ -465,7 +465,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
465
465
  as_both_colored_and_uncolored do |color_enabled|
466
466
  snippet = <<~TEST.strip
467
467
  expected = a_collection_including("milk", "toast")
468
- actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
468
+ actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
469
469
  expect(actual).not_to match(expected)
470
470
  TEST
471
471
  program = make_plain_test_program(
@@ -479,13 +479,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
479
479
  newline_before_expectation: true,
480
480
  expectation: proc {
481
481
  line do
482
- plain " Expected "
483
- beta %|["milk", "toast", "eggs", "cheese", "English muffins"]|
482
+ plain %| Expected |
483
+ actual %|["milk", "toast", "eggs", "cheese", "English muffins"]|
484
484
  end
485
485
 
486
486
  line do
487
- plain "not to match "
488
- alpha %|#<a collection including ("milk", "toast")>|
487
+ plain %|not to match |
488
+ expected %|#<a collection including ("milk", "toast")>|
489
489
  end
490
490
  },
491
491
  )
@@ -499,7 +499,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
499
499
  end
500
500
 
501
501
  context "when the expected value includes a collection-including-<something>" do
502
- context "and the corresponding actual value is an array" do
502
+ context "and the corresponding actual value is an array" do
503
503
  it "produces the correct failure message when used in the positive" do
504
504
  as_both_colored_and_uncolored do |color_enabled|
505
505
  snippet = <<~TEST.strip
@@ -507,7 +507,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
507
507
  name: "shopping list",
508
508
  contents: a_collection_including("milk", "bread")
509
509
  }
510
- actual = {
510
+ actual = {
511
511
  name: "shopping list",
512
512
  contents: ["milk", "toast", "eggs"]
513
513
  }
@@ -523,26 +523,26 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
523
523
  snippet: %|expect(actual).to match(expected)|,
524
524
  expectation: proc {
525
525
  line do
526
- plain "Expected "
527
- beta %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
526
+ plain %|Expected |
527
+ actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
528
528
  end
529
529
 
530
530
  line do
531
- plain "to match "
532
- alpha %|{ name: "shopping list", contents: #<a collection including ("milk", "bread")> }|
531
+ plain %|to match |
532
+ expected %|{ name: "shopping list", contents: #<a collection including ("milk", "bread")> }|
533
533
  end
534
534
  },
535
535
  diff: proc {
536
- plain_line %| {|
537
- plain_line %| name: "shopping list",|
538
- plain_line %| contents: [|
539
- plain_line %| "milk",|
540
- plain_line %| "toast",|
541
- # plain_line %| "eggs",| # FIXME
542
- plain_line %| "eggs"|
543
- alpha_line %|- "bread"|
544
- plain_line %| ]|
545
- plain_line %| }|
536
+ plain_line %| {|
537
+ plain_line %| name: "shopping list",|
538
+ plain_line %| contents: [|
539
+ plain_line %| "milk",|
540
+ plain_line %| "toast",|
541
+ # plain_line %| "eggs",| # FIXME
542
+ plain_line %| "eggs"|
543
+ expected_line %|- "bread"|
544
+ plain_line %| ]|
545
+ plain_line %| }|
546
546
  },
547
547
  )
548
548
 
@@ -559,7 +559,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
559
559
  name: "shopping list",
560
560
  contents: a_collection_including("milk", "toast")
561
561
  }
562
- actual = {
562
+ actual = {
563
563
  name: "shopping list",
564
564
  contents: ["milk", "toast", "eggs"]
565
565
  }
@@ -576,13 +576,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
576
576
  newline_before_expectation: true,
577
577
  expectation: proc {
578
578
  line do
579
- plain " Expected "
580
- beta %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
579
+ plain %| Expected |
580
+ actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
581
581
  end
582
582
 
583
583
  line do
584
- plain "not to match "
585
- alpha %|{ name: "shopping list", contents: #<a collection including ("milk", "toast")> }|
584
+ plain %|not to match |
585
+ expected %|{ name: "shopping list", contents: #<a collection including ("milk", "toast")> }|
586
586
  end
587
587
  },
588
588
  )
@@ -594,7 +594,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
594
594
  end
595
595
  end
596
596
 
597
- context "when the corresponding actual value is not an array" do
597
+ context "when the corresponding actual value is not an array" do
598
598
  it "produces the correct failure message" do
599
599
  as_both_colored_and_uncolored do |color_enabled|
600
600
  snippet = <<~TEST.strip
@@ -602,7 +602,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
602
602
  name: "shopping list",
603
603
  contents: a_collection_including("milk", "bread")
604
604
  }
605
- actual = {
605
+ actual = {
606
606
  name: "shopping list",
607
607
  contents: nil
608
608
  }
@@ -618,24 +618,24 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
618
618
  snippet: %|expect(actual).to match(expected)|,
619
619
  expectation: proc {
620
620
  line do
621
- plain "Expected "
622
- beta %|{ name: "shopping list", contents: nil }|
621
+ plain %|Expected |
622
+ actual %|{ name: "shopping list", contents: nil }|
623
623
  end
624
624
 
625
625
  line do
626
- plain "to match "
627
- alpha %|{ name: "shopping list", contents: #<a collection including ("milk", "bread")> }|
626
+ plain %|to match |
627
+ expected %|{ name: "shopping list", contents: #<a collection including ("milk", "bread")> }|
628
628
  end
629
629
  },
630
630
  diff: proc {
631
- plain_line %! {!
632
- plain_line %! name: "shopping list",!
633
- alpha_line %!- contents: #<a collection including (!
634
- alpha_line %!- "milk",!
635
- alpha_line %!- "bread"!
636
- alpha_line %!- )>!
637
- beta_line %!+ contents: nil!
638
- plain_line %! }!
631
+ plain_line %! {!
632
+ plain_line %! name: "shopping list",!
633
+ expected_line %!- contents: #<a collection including (!
634
+ expected_line %!- "milk",!
635
+ expected_line %!- "bread"!
636
+ expected_line %!- )>!
637
+ actual_line %!+ contents: nil!
638
+ plain_line %! }!
639
639
  },
640
640
  )
641
641
 
@@ -653,7 +653,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
653
653
  as_both_colored_and_uncolored do |color_enabled|
654
654
  snippet = <<~TEST.strip
655
655
  expected = an_object_having_attributes(name: "b")
656
- actual = A.new("a")
656
+ actual = A.new("a")
657
657
  expect(actual).to match(expected)
658
658
  TEST
659
659
  program = make_plain_test_program(
@@ -666,19 +666,19 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
666
666
  snippet: %|expect(actual).to match(expected)|,
667
667
  expectation: proc {
668
668
  line do
669
- plain "Expected "
670
- beta %|#<A name: "a">|
671
- plain " to match "
672
- alpha %|#<an object having attributes (name: "b")>|
673
- plain "."
669
+ plain %|Expected |
670
+ actual %|#<A name: "a">|
671
+ plain %| to match |
672
+ expected %|#<an object having attributes (name: "b")>|
673
+ plain %|.|
674
674
  end
675
675
  },
676
676
  diff: proc {
677
- plain_line %| #<A {|
678
- # alpha_line %|- name: "b",| # FIXME
679
- alpha_line %|- name: "b"|
680
- beta_line %|+ name: "a"|
681
- plain_line %| }>|
677
+ plain_line %| #<A {|
678
+ # expected_line %|- name: "b",| # FIXME
679
+ expected_line %|- name: "b"|
680
+ actual_line %|+ name: "a"|
681
+ plain_line %| }>|
682
682
  },
683
683
  )
684
684
 
@@ -692,7 +692,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
692
692
  as_both_colored_and_uncolored do |color_enabled|
693
693
  snippet = <<~TEST.strip
694
694
  expected = an_object_having_attributes(name: "b")
695
- actual = A.new("b")
695
+ actual = A.new("b")
696
696
  expect(actual).not_to match(expected)
697
697
  TEST
698
698
  program = make_plain_test_program(
@@ -705,11 +705,11 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
705
705
  snippet: %|expect(actual).not_to match(expected)|,
706
706
  expectation: proc {
707
707
  line do
708
- plain "Expected "
709
- beta %|#<A name: "b">|
710
- plain " not to match "
711
- alpha %|#<an object having attributes (name: "b")>|
712
- plain "."
708
+ plain %|Expected |
709
+ actual %|#<A name: "b">|
710
+ plain %| not to match |
711
+ expected %|#<an object having attributes (name: "b")>|
712
+ plain %|.|
713
713
  end
714
714
  },
715
715
  )
@@ -732,7 +732,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
732
732
  state: "CA",
733
733
  something_else: "blah"
734
734
  )
735
- actual = SuperDiff::Test::ShippingAddress.new(
735
+ actual = SuperDiff::Test::ShippingAddress.new(
736
736
  line_1: "456 Ponderosa Ct.",
737
737
  line_2: nil,
738
738
  city: "Hill Valley",
@@ -751,29 +751,29 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
751
751
  snippet: %|expect(actual).to match(expected)|,
752
752
  expectation: proc {
753
753
  line do
754
- plain "Expected "
755
- beta %|#<SuperDiff::Test::ShippingAddress line_1: "456 Ponderosa Ct.", line_2: nil, city: "Hill Valley", state: "CA", zip: "90382">|
754
+ plain %|Expected |
755
+ actual %|#<SuperDiff::Test::ShippingAddress line_1: "456 Ponderosa Ct.", line_2: nil, city: "Hill Valley", state: "CA", zip: "90382">|
756
756
  end
757
757
 
758
758
  line do
759
- plain "to match "
760
- alpha %|#<an object having attributes (line_1: "123 Main St.", city: "Oakland", zip: "91234", state: "CA", something_else: "blah")>|
759
+ plain %|to match |
760
+ expected %|#<an object having attributes (line_1: "123 Main St.", city: "Oakland", zip: "91234", state: "CA", something_else: "blah")>|
761
761
  end
762
762
  },
763
763
  diff: proc {
764
- plain_line %| #<SuperDiff::Test::ShippingAddress {|
765
- alpha_line %|- line_1: "123 Main St.",|
766
- beta_line %|+ line_1: "456 Ponderosa Ct.",|
767
- plain_line %| line_2: nil,|
768
- alpha_line %|- city: "Oakland",|
769
- beta_line %|+ city: "Hill Valley",|
770
- plain_line %| state: "CA",|
771
- # alpha_line %|- zip: "91234",| # FIXME
772
- # beta_line %|+ zip: "90382",| # FIXME
773
- alpha_line %|- zip: "91234"|
774
- beta_line %|+ zip: "90382"|
775
- alpha_line %|- something_else: "blah"|
776
- plain_line %| }>|
764
+ plain_line %| #<SuperDiff::Test::ShippingAddress {|
765
+ expected_line %|- line_1: "123 Main St.",|
766
+ actual_line %|+ line_1: "456 Ponderosa Ct.",|
767
+ plain_line %| line_2: nil,|
768
+ expected_line %|- city: "Oakland",|
769
+ actual_line %|+ city: "Hill Valley",|
770
+ plain_line %| state: "CA",|
771
+ # expected_line %|- zip: "91234",| # FIXME
772
+ # actual_line %|+ zip: "90382",| # FIXME
773
+ expected_line %|- zip: "91234"|
774
+ actual_line %|+ zip: "90382"|
775
+ expected_line %|- something_else: "blah"|
776
+ plain_line %| }>|
777
777
  },
778
778
  )
779
779
 
@@ -791,7 +791,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
791
791
  city: "Oakland",
792
792
  zip: "91234"
793
793
  )
794
- actual = SuperDiff::Test::ShippingAddress.new(
794
+ actual = SuperDiff::Test::ShippingAddress.new(
795
795
  line_1: "123 Main St.",
796
796
  line_2: nil,
797
797
  city: "Oakland",
@@ -811,13 +811,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
811
811
  newline_before_expectation: true,
812
812
  expectation: proc {
813
813
  line do
814
- plain " Expected "
815
- beta %|#<SuperDiff::Test::ShippingAddress line_1: "123 Main St.", line_2: nil, city: "Oakland", state: "CA", zip: "91234">|
814
+ plain %| Expected |
815
+ actual %|#<SuperDiff::Test::ShippingAddress line_1: "123 Main St.", line_2: nil, city: "Oakland", state: "CA", zip: "91234">|
816
816
  end
817
817
 
818
818
  line do
819
- plain "not to match "
820
- alpha %|#<an object having attributes (line_1: "123 Main St.", city: "Oakland", zip: "91234")>|
819
+ plain %|not to match |
820
+ expected %|#<an object having attributes (line_1: "123 Main St.", city: "Oakland", zip: "91234")>|
821
821
  end
822
822
  },
823
823
  )
@@ -844,7 +844,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
844
844
  something_else: "blah"
845
845
  )
846
846
  }
847
- actual = {
847
+ actual = {
848
848
  name: "Marty McFly",
849
849
  shipping_address: SuperDiff::Test::ShippingAddress.new(
850
850
  line_1: "456 Ponderosa Ct.",
@@ -866,31 +866,31 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
866
866
  snippet: %|expect(actual).to match(expected)|,
867
867
  expectation: proc {
868
868
  line do
869
- plain "Expected "
870
- beta %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::ShippingAddress line_1: "456 Ponderosa Ct.", line_2: nil, city: "Hill Valley", state: "CA", zip: "90382"> }|
869
+ plain %|Expected |
870
+ actual %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::ShippingAddress line_1: "456 Ponderosa Ct.", line_2: nil, city: "Hill Valley", state: "CA", zip: "90382"> }|
871
871
  end
872
872
 
873
873
  line do
874
- plain "to match "
875
- alpha %|{ name: "Marty McFly", shipping_address: #<an object having attributes (line_1: "123 Main St.", city: "Oakland", state: "CA", zip: "91234", something_else: "blah")> }|
874
+ plain %|to match |
875
+ expected %|{ name: "Marty McFly", shipping_address: #<an object having attributes (line_1: "123 Main St.", city: "Oakland", state: "CA", zip: "91234", something_else: "blah")> }|
876
876
  end
877
877
  },
878
878
  diff: proc {
879
- plain_line %| {|
880
- plain_line %| name: "Marty McFly",|
881
- plain_line %| shipping_address: #<SuperDiff::Test::ShippingAddress {|
882
- alpha_line %|- line_1: "123 Main St.",|
883
- beta_line %|+ line_1: "456 Ponderosa Ct.",|
884
- plain_line %| line_2: nil,|
885
- alpha_line %|- city: "Oakland",|
886
- beta_line %|+ city: "Hill Valley",|
887
- plain_line %| state: "CA",|
888
- # alpha_line %|- zip: "91234",| # FIXME
889
- alpha_line %|- zip: "91234"|
890
- beta_line %|+ zip: "90382"|
891
- alpha_line %|- something_else: "blah"|
892
- plain_line %| }>|
893
- plain_line %| }|
879
+ plain_line %| {|
880
+ plain_line %| name: "Marty McFly",|
881
+ plain_line %| shipping_address: #<SuperDiff::Test::ShippingAddress {|
882
+ expected_line %|- line_1: "123 Main St.",|
883
+ actual_line %|+ line_1: "456 Ponderosa Ct.",|
884
+ plain_line %| line_2: nil,|
885
+ expected_line %|- city: "Oakland",|
886
+ actual_line %|+ city: "Hill Valley",|
887
+ plain_line %| state: "CA",|
888
+ # expected_line %|- zip: "91234",| # FIXME
889
+ expected_line %|- zip: "91234"|
890
+ actual_line %|+ zip: "90382"|
891
+ expected_line %|- something_else: "blah"|
892
+ plain_line %| }>|
893
+ plain_line %| }|
894
894
  },
895
895
  )
896
896
 
@@ -912,7 +912,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
912
912
  zip: "91234"
913
913
  )
914
914
  }
915
- actual = {
915
+ actual = {
916
916
  name: "Marty McFly",
917
917
  shipping_address: SuperDiff::Test::ShippingAddress.new(
918
918
  line_1: "123 Main St.",
@@ -935,13 +935,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
935
935
  newline_before_expectation: true,
936
936
  expectation: proc {
937
937
  line do
938
- plain " Expected "
939
- beta %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::ShippingAddress line_1: "123 Main St.", line_2: nil, city: "Oakland", state: "CA", zip: "91234"> }|
938
+ plain %| Expected |
939
+ actual %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::ShippingAddress line_1: "123 Main St.", line_2: nil, city: "Oakland", state: "CA", zip: "91234"> }|
940
940
  end
941
941
 
942
942
  line do
943
- plain "not to match "
944
- alpha %|{ name: "Marty McFly", shipping_address: #<an object having attributes (line_1: "123 Main St.", city: "Oakland", state: "CA", zip: "91234")> }|
943
+ plain %|not to match |
944
+ expected %|{ name: "Marty McFly", shipping_address: #<an object having attributes (line_1: "123 Main St.", city: "Oakland", state: "CA", zip: "91234")> }|
945
945
  end
946
946
  },
947
947
  )
@@ -959,7 +959,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
959
959
  as_both_colored_and_uncolored do |color_enabled|
960
960
  snippet = <<~TEST.strip
961
961
  expected = a_collection_containing_exactly("a")
962
- actual = ["b"]
962
+ actual = ["b"]
963
963
  expect(actual).to match(expected)
964
964
  TEST
965
965
  program = make_plain_test_program(
@@ -972,18 +972,18 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
972
972
  snippet: %|expect(actual).to match(expected)|,
973
973
  expectation: proc {
974
974
  line do
975
- plain "Expected "
976
- beta %|["b"]|
977
- plain " to match "
978
- alpha %|#<a collection containing exactly ("a")>|
979
- plain "."
975
+ plain %|Expected |
976
+ actual %|["b"]|
977
+ plain %| to match |
978
+ expected %|#<a collection containing exactly ("a")>|
979
+ plain %|.|
980
980
  end
981
981
  },
982
982
  diff: proc {
983
- plain_line %| [|
984
- plain_line %| "b",|
985
- alpha_line %|- "a"|
986
- plain_line %| ]|
983
+ plain_line %| [|
984
+ actual_line %|+ "b",|
985
+ expected_line %|- "a"|
986
+ plain_line %| ]|
987
987
  },
988
988
  )
989
989
 
@@ -997,7 +997,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
997
997
  as_both_colored_and_uncolored do |color_enabled|
998
998
  snippet = <<~TEST.strip
999
999
  expected = a_collection_containing_exactly("b")
1000
- actual = ["b"]
1000
+ actual = ["b"]
1001
1001
  expect(actual).not_to match(expected)
1002
1002
  TEST
1003
1003
  program = make_plain_test_program(
@@ -1010,11 +1010,11 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1010
1010
  snippet: %|expect(actual).not_to match(expected)|,
1011
1011
  expectation: proc {
1012
1012
  line do
1013
- plain "Expected "
1014
- beta %|["b"]|
1015
- plain " not to match "
1016
- alpha %|#<a collection containing exactly ("b")>|
1017
- plain "."
1013
+ plain %|Expected |
1014
+ actual %|["b"]|
1015
+ plain %| not to match |
1016
+ expected %|#<a collection containing exactly ("b")>|
1017
+ plain %|.|
1018
1018
  end
1019
1019
  },
1020
1020
  )
@@ -1031,7 +1031,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1031
1031
  as_both_colored_and_uncolored do |color_enabled|
1032
1032
  snippet = <<~TEST.strip
1033
1033
  expected = a_collection_containing_exactly("milk", "bread")
1034
- actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
1034
+ actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
1035
1035
  expect(actual).to match(expected)
1036
1036
  TEST
1037
1037
  program = make_plain_test_program(
@@ -1044,24 +1044,24 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1044
1044
  snippet: %|expect(actual).to match(expected)|,
1045
1045
  expectation: proc {
1046
1046
  line do
1047
- plain "Expected "
1048
- beta %|["milk", "toast", "eggs", "cheese", "English muffins"]|
1047
+ plain %|Expected |
1048
+ actual %|["milk", "toast", "eggs", "cheese", "English muffins"]|
1049
1049
  end
1050
1050
 
1051
1051
  line do
1052
- plain "to match "
1053
- alpha %|#<a collection containing exactly ("milk", "bread")>|
1052
+ plain %|to match |
1053
+ expected %|#<a collection containing exactly ("milk", "bread")>|
1054
1054
  end
1055
1055
  },
1056
1056
  diff: proc {
1057
- plain_line %| [|
1058
- plain_line %| "milk",|
1059
- plain_line %| "toast",|
1060
- plain_line %| "eggs",|
1061
- plain_line %| "cheese",|
1062
- plain_line %| "English muffins",|
1063
- alpha_line %|- "bread"|
1064
- plain_line %| ]|
1057
+ plain_line %| [|
1058
+ plain_line %| "milk",|
1059
+ actual_line %|+ "toast",|
1060
+ actual_line %|+ "eggs",|
1061
+ actual_line %|+ "cheese",|
1062
+ actual_line %|+ "English muffins",|
1063
+ expected_line %|- "bread"|
1064
+ plain_line %| ]|
1065
1065
  },
1066
1066
  )
1067
1067
 
@@ -1075,7 +1075,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1075
1075
  as_both_colored_and_uncolored do |color_enabled|
1076
1076
  snippet = <<~TEST.strip
1077
1077
  expected = a_collection_containing_exactly("milk", "eggs", "toast")
1078
- actual = ["milk", "toast", "eggs"]
1078
+ actual = ["milk", "toast", "eggs"]
1079
1079
  expect(actual).not_to match(expected)
1080
1080
  TEST
1081
1081
  program = make_plain_test_program(
@@ -1089,13 +1089,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1089
1089
  newline_before_expectation: true,
1090
1090
  expectation: proc {
1091
1091
  line do
1092
- plain " Expected "
1093
- beta %|["milk", "toast", "eggs"]|
1092
+ plain %| Expected |
1093
+ actual %|["milk", "toast", "eggs"]|
1094
1094
  end
1095
1095
 
1096
1096
  line do
1097
- plain "not to match "
1098
- alpha %|#<a collection containing exactly ("milk", "eggs", "toast")>|
1097
+ plain %|not to match |
1098
+ expected %|#<a collection containing exactly ("milk", "eggs", "toast")>|
1099
1099
  end
1100
1100
  },
1101
1101
  )
@@ -1109,7 +1109,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1109
1109
  end
1110
1110
 
1111
1111
  context "when the expected value includes a collection-containing-exactly-<something>" do
1112
- context "and the corresponding actual value is an array" do
1112
+ context "and the corresponding actual value is an array" do
1113
1113
  it "produces the correct failure message when used in the positive" do
1114
1114
  as_both_colored_and_uncolored do |color_enabled|
1115
1115
  snippet = <<~TEST.strip
@@ -1117,7 +1117,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1117
1117
  name: "shopping list",
1118
1118
  contents: a_collection_containing_exactly("milk", "bread")
1119
1119
  }
1120
- actual = {
1120
+ actual = {
1121
1121
  name: "shopping list",
1122
1122
  contents: ["milk", "toast", "eggs"]
1123
1123
  }
@@ -1133,25 +1133,25 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1133
1133
  snippet: %|expect(actual).to match(expected)|,
1134
1134
  expectation: proc {
1135
1135
  line do
1136
- plain "Expected "
1137
- beta %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
1136
+ plain %|Expected |
1137
+ actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
1138
1138
  end
1139
1139
 
1140
1140
  line do
1141
- plain "to match "
1142
- alpha %|{ name: "shopping list", contents: #<a collection containing exactly ("milk", "bread")> }|
1141
+ plain %|to match |
1142
+ expected %|{ name: "shopping list", contents: #<a collection containing exactly ("milk", "bread")> }|
1143
1143
  end
1144
1144
  },
1145
1145
  diff: proc {
1146
- plain_line %| {|
1147
- plain_line %| name: "shopping list",|
1148
- plain_line %| contents: [|
1149
- plain_line %| "milk",|
1150
- plain_line %| "toast",|
1151
- plain_line %| "eggs",|
1152
- alpha_line %|- "bread"|
1153
- plain_line %| ]|
1154
- plain_line %| }|
1146
+ plain_line %| {|
1147
+ plain_line %| name: "shopping list",|
1148
+ plain_line %| contents: [|
1149
+ plain_line %| "milk",|
1150
+ actual_line %|+ "toast",|
1151
+ actual_line %|+ "eggs",|
1152
+ expected_line %|- "bread"|
1153
+ plain_line %| ]|
1154
+ plain_line %| }|
1155
1155
  },
1156
1156
  )
1157
1157
 
@@ -1168,7 +1168,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1168
1168
  name: "shopping list",
1169
1169
  contents: a_collection_containing_exactly("milk", "eggs", "toast")
1170
1170
  }
1171
- actual = {
1171
+ actual = {
1172
1172
  name: "shopping list",
1173
1173
  contents: ["milk", "toast", "eggs"]
1174
1174
  }
@@ -1185,13 +1185,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1185
1185
  newline_before_expectation: true,
1186
1186
  expectation: proc {
1187
1187
  line do
1188
- plain " Expected "
1189
- beta %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
1188
+ plain %| Expected |
1189
+ actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
1190
1190
  end
1191
1191
 
1192
1192
  line do
1193
- plain "not to match "
1194
- alpha %|{ name: "shopping list", contents: #<a collection containing exactly ("milk", "eggs", "toast")> }|
1193
+ plain %|not to match |
1194
+ expected %|{ name: "shopping list", contents: #<a collection containing exactly ("milk", "eggs", "toast")> }|
1195
1195
  end
1196
1196
  },
1197
1197
  )
@@ -1203,7 +1203,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1203
1203
  end
1204
1204
  end
1205
1205
 
1206
- context "when the corresponding actual value is not an array" do
1206
+ context "when the corresponding actual value is not an array" do
1207
1207
  it "produces the correct failure message" do
1208
1208
  as_both_colored_and_uncolored do |color_enabled|
1209
1209
  snippet = <<~TEST.strip
@@ -1211,7 +1211,7 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1211
1211
  name: "shopping list",
1212
1212
  contents: a_collection_containing_exactly("milk", "bread")
1213
1213
  }
1214
- actual = {
1214
+ actual = {
1215
1215
  name: "shopping list",
1216
1216
  contents: nil
1217
1217
  }
@@ -1227,24 +1227,24 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
1227
1227
  snippet: %|expect(actual).to match(expected)|,
1228
1228
  expectation: proc {
1229
1229
  line do
1230
- plain "Expected "
1231
- beta %|{ name: "shopping list", contents: nil }|
1230
+ plain %|Expected |
1231
+ actual %|{ name: "shopping list", contents: nil }|
1232
1232
  end
1233
1233
 
1234
1234
  line do
1235
- plain "to match "
1236
- alpha %|{ name: "shopping list", contents: #<a collection containing exactly ("milk", "bread")> }|
1235
+ plain %|to match |
1236
+ expected %|{ name: "shopping list", contents: #<a collection containing exactly ("milk", "bread")> }|
1237
1237
  end
1238
1238
  },
1239
1239
  diff: proc {
1240
- plain_line %! {!
1241
- plain_line %! name: "shopping list",!
1242
- alpha_line %!- contents: #<a collection containing exactly (!
1243
- alpha_line %!- "milk",!
1244
- alpha_line %!- "bread"!
1245
- alpha_line %!- )>!
1246
- beta_line %!+ contents: nil!
1247
- plain_line %! }!
1240
+ plain_line %! {!
1241
+ plain_line %! name: "shopping list",!
1242
+ expected_line %!- contents: #<a collection containing exactly (!
1243
+ expected_line %!- "milk",!
1244
+ expected_line %!- "bread"!
1245
+ expected_line %!- )>!
1246
+ actual_line %!+ contents: nil!
1247
+ plain_line %! }!
1248
1248
  },
1249
1249
  )
1250
1250