super_diff 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -19
  3. data/lib/super_diff.rb +1 -7
  4. data/lib/super_diff/colorized_document_extensions.rb +4 -4
  5. data/lib/super_diff/configuration.rb +32 -22
  6. data/lib/super_diff/csi.rb +2 -1
  7. data/lib/super_diff/diff_formatters/collection.rb +1 -1
  8. data/lib/super_diff/diff_formatters/multiline_string.rb +4 -4
  9. data/lib/super_diff/equality_matchers/array.rb +2 -2
  10. data/lib/super_diff/equality_matchers/default.rb +2 -2
  11. data/lib/super_diff/equality_matchers/hash.rb +2 -2
  12. data/lib/super_diff/equality_matchers/multiline_string.rb +2 -2
  13. data/lib/super_diff/equality_matchers/primitive.rb +2 -2
  14. data/lib/super_diff/equality_matchers/singleline_string.rb +2 -2
  15. data/lib/super_diff/gem_version.rb +45 -0
  16. data/lib/super_diff/rspec.rb +4 -0
  17. data/lib/super_diff/rspec/matcher_text_builders/base.rb +7 -7
  18. data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +6 -6
  19. data/lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb +1 -1
  20. data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +4 -4
  21. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -1
  22. data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +5 -5
  23. data/lib/super_diff/rspec/monkey_patches.rb +22 -13
  24. data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +12 -1
  25. data/lib/super_diff/version.rb +1 -1
  26. data/spec/examples.txt +393 -5
  27. data/spec/integration/rspec/be_falsey_matcher_spec.rb +10 -10
  28. data/spec/integration/rspec/be_matcher_spec.rb +100 -100
  29. data/spec/integration/rspec/be_nil_matcher_spec.rb +10 -10
  30. data/spec/integration/rspec/be_predicate_matcher_spec.rb +103 -103
  31. data/spec/integration/rspec/be_truthy_matcher_spec.rb +10 -10
  32. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +107 -107
  33. data/spec/integration/rspec/eq_matcher_spec.rb +230 -230
  34. data/spec/integration/rspec/have_attributes_matcher_spec.rb +129 -129
  35. data/spec/integration/rspec/have_predicate_matcher_spec.rb +65 -65
  36. data/spec/integration/rspec/include_matcher_spec.rb +73 -73
  37. data/spec/integration/rspec/match_array_matcher_spec.rb +119 -119
  38. data/spec/integration/rspec/match_matcher_spec.rb +274 -274
  39. data/spec/integration/rspec/raise_error_matcher_spec.rb +86 -86
  40. data/spec/integration/rspec/respond_to_matcher_spec.rb +240 -240
  41. data/spec/integration/rspec/third_party_matcher_spec.rb +8 -8
  42. data/spec/integration/rspec/unhandled_errors_spec.rb +5 -5
  43. data/spec/spec_helper.rb +22 -13
  44. data/spec/support/integration/helpers.rb +6 -2
  45. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +1 -1
  46. data/spec/support/integration/test_programs/base.rb +2 -0
  47. data/spec/support/integration/test_programs/rspec_active_record.rb +1 -1
  48. data/spec/support/integration/test_programs/rspec_active_support.rb +17 -0
  49. data/spec/support/integration/test_programs/rspec_rails.rb +1 -1
  50. data/spec/support/shared_examples/active_record.rb +108 -108
  51. data/spec/support/shared_examples/hash_with_indifferent_access.rb +196 -232
  52. data/spec/tmp/integration_spec.rb +15 -0
  53. data/spec/unit/equality_matchers/main_spec.rb +403 -403
  54. data/super_diff.gemspec +1 -1
  55. metadata +11 -3
@@ -7,7 +7,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
7
7
  as_both_colored_and_uncolored do |color_enabled|
8
8
  snippet = <<~TEST.strip
9
9
  expected = ["Marty", "Einie"]
10
- actual = ["Marty", "Jennifer", "Doc"]
10
+ actual = ["Marty", "Jennifer", "Doc"]
11
11
  expect(actual).to include(*expected)
12
12
  TEST
13
13
  program = make_plain_test_program(
@@ -20,21 +20,21 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
20
20
  snippet: %|expect(actual).to include(*expected)|,
21
21
  expectation: proc {
22
22
  line do
23
- plain "Expected "
24
- beta %|["Marty", "Jennifer", "Doc"]|
25
- plain " to include "
26
- alpha %|"Einie"|
27
- plain "."
23
+ plain %|Expected |
24
+ actual %|["Marty", "Jennifer", "Doc"]|
25
+ plain %| to include |
26
+ expected %|"Einie"|
27
+ plain %|.|
28
28
  end
29
29
  },
30
30
  diff: proc {
31
- plain_line %| [|
32
- plain_line %| "Marty",|
33
- plain_line %| "Jennifer",|
34
- # plain_line %| "Doc",| # FIXME
35
- plain_line %| "Doc"|
36
- alpha_line %|- "Einie"|
37
- plain_line %| ]|
31
+ plain_line %| [|
32
+ plain_line %| "Marty",|
33
+ plain_line %| "Jennifer",|
34
+ # plain_line %| "Doc",| # FIXME
35
+ plain_line %| "Doc"|
36
+ expected_line %|- "Einie"|
37
+ plain_line %| ]|
38
38
  },
39
39
  )
40
40
 
@@ -60,11 +60,11 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
60
60
  snippet: %|expect(values).not_to include(*values)|,
61
61
  expectation: proc {
62
62
  line do
63
- plain "Expected "
64
- beta %|["Marty", "Einie"]|
65
- plain " not to include "
66
- alpha %|"Marty" and "Einie"|
67
- plain "."
63
+ plain %|Expected |
64
+ actual %|["Marty", "Einie"]|
65
+ plain %| not to include |
66
+ expected %|"Marty" and "Einie"|
67
+ plain %|.|
68
68
  end
69
69
  },
70
70
  )
@@ -88,7 +88,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
88
88
  "George McFly",
89
89
  "Lorraine McFly"
90
90
  ]
91
- actual = [
91
+ actual = [
92
92
  "Marty McFly",
93
93
  "Doc Brown",
94
94
  "Einie",
@@ -106,25 +106,25 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
106
106
  snippet: %|expect(actual).to include(*expected)|,
107
107
  expectation: proc {
108
108
  line do
109
- plain " Expected "
110
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
109
+ plain %| Expected |
110
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
111
111
  end
112
112
 
113
113
  line do
114
- plain "to include "
115
- alpha %|"Biff Tannen" and "George McFly"|
114
+ plain %|to include |
115
+ expected %|"Biff Tannen" and "George McFly"|
116
116
  end
117
117
  },
118
118
  diff: proc {
119
- plain_line %| [|
120
- plain_line %| "Marty McFly",|
121
- plain_line %| "Doc Brown",|
122
- plain_line %| "Einie",|
123
- # plain_line %| "Lorraine McFly",| # FIXME
124
- plain_line %| "Lorraine McFly"|
125
- alpha_line %|- "Biff Tannen",|
126
- alpha_line %|- "George McFly"|
127
- plain_line %| ]|
119
+ plain_line %| [|
120
+ plain_line %| "Marty McFly",|
121
+ plain_line %| "Doc Brown",|
122
+ plain_line %| "Einie",|
123
+ # plain_line %| "Lorraine McFly",| # FIXME
124
+ plain_line %| "Lorraine McFly"|
125
+ expected_line %|- "Biff Tannen",|
126
+ expected_line %|- "George McFly"|
127
+ plain_line %| ]|
128
128
  },
129
129
  )
130
130
 
@@ -143,7 +143,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
143
143
  "Einie",
144
144
  "Lorraine McFly"
145
145
  ]
146
- actual = [
146
+ actual = [
147
147
  "Marty McFly",
148
148
  "Doc Brown",
149
149
  "Einie",
@@ -164,13 +164,13 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
164
164
  newline_before_expectation: true,
165
165
  expectation: proc {
166
166
  line do
167
- plain " Expected "
168
- beta %|["Marty McFly", "Doc Brown", "Einie", "Biff Tannen", "George McFly", "Lorraine McFly"]|
167
+ plain %| Expected |
168
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Biff Tannen", "George McFly", "Lorraine McFly"]|
169
169
  end
170
170
 
171
171
  line do
172
- plain "not to include "
173
- alpha %|"Marty McFly", "Doc Brown", "Einie", and "Lorraine McFly"|
172
+ plain %|not to include |
173
+ expected %|"Marty McFly", "Doc Brown", "Einie", and "Lorraine McFly"|
174
174
  end
175
175
  },
176
176
  )
@@ -189,7 +189,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
189
189
  as_both_colored_and_uncolored do |color_enabled|
190
190
  snippet = <<~TEST.strip
191
191
  expected = { city: "Hill Valley", state: "CA" }
192
- actual = { city: "Burbank", zip: "90210" }
192
+ actual = { city: "Burbank", zip: "90210" }
193
193
  expect(actual).to include(expected)
194
194
  TEST
195
195
  program = make_plain_test_program(
@@ -202,22 +202,22 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
202
202
  snippet: %|expect(actual).to include(expected)|,
203
203
  expectation: proc {
204
204
  line do
205
- plain "Expected "
206
- beta %|{ city: "Burbank", zip: "90210" }|
207
- plain " to include "
208
- alpha %|(city: "Hill Valley", state: "CA")|
209
- plain "."
205
+ plain %|Expected |
206
+ actual %|{ city: "Burbank", zip: "90210" }|
207
+ plain %| to include |
208
+ expected %|(city: "Hill Valley", state: "CA")|
209
+ plain %|.|
210
210
  end
211
211
  },
212
212
  diff: proc {
213
- plain_line %| {|
214
- alpha_line %|- city: "Hill Valley",|
215
- beta_line %|+ city: "Burbank",|
213
+ plain_line %| {|
214
+ expected_line %|- city: "Hill Valley",|
215
+ actual_line %|+ city: "Burbank",|
216
216
  # FIXME
217
- # alpha_line %|- state: "CA",|
218
- alpha_line %|- state: "CA"|
219
- plain_line %| zip: "90210"|
220
- plain_line %| }|
217
+ # expected_line %|- state: "CA",|
218
+ expected_line %|- state: "CA"|
219
+ plain_line %| zip: "90210"|
220
+ plain_line %| }|
221
221
  },
222
222
  )
223
223
 
@@ -231,7 +231,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
231
231
  as_both_colored_and_uncolored do |color_enabled|
232
232
  snippet = <<~TEST.strip
233
233
  expected = { city: "Burbank" }
234
- actual = { city: "Burbank", zip: "90210" }
234
+ actual = { city: "Burbank", zip: "90210" }
235
235
  expect(actual).not_to include(expected)
236
236
  TEST
237
237
  program = make_plain_test_program(
@@ -244,11 +244,11 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
244
244
  snippet: %|expect(actual).not_to include(expected)|,
245
245
  expectation: proc {
246
246
  line do
247
- plain "Expected "
248
- beta %|{ city: "Burbank", zip: "90210" }|
249
- plain " not to include "
250
- alpha %|(city: "Burbank")|
251
- plain "."
247
+ plain %|Expected |
248
+ actual %|{ city: "Burbank", zip: "90210" }|
249
+ plain %| not to include |
250
+ expected %|(city: "Burbank")|
251
+ plain %|.|
252
252
  end
253
253
  },
254
254
  )
@@ -268,7 +268,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
268
268
  city: "Hill Valley",
269
269
  zip: "90382"
270
270
  }
271
- actual = {
271
+ actual = {
272
272
  city: "Burbank",
273
273
  state: "CA",
274
274
  zip: "90210"
@@ -285,23 +285,23 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
285
285
  snippet: %|expect(actual).to include(expected)|,
286
286
  expectation: proc {
287
287
  line do
288
- plain " Expected "
289
- beta %|{ city: "Burbank", state: "CA", zip: "90210" }|
288
+ plain %| Expected |
289
+ actual %|{ city: "Burbank", state: "CA", zip: "90210" }|
290
290
  end
291
291
 
292
292
  line do
293
- plain "to include "
294
- alpha %|(city: "Hill Valley", zip: "90382")|
293
+ plain %|to include |
294
+ expected %|(city: "Hill Valley", zip: "90382")|
295
295
  end
296
296
  },
297
297
  diff: proc {
298
- plain_line %| {|
299
- alpha_line %|- city: "Hill Valley",|
300
- beta_line %|+ city: "Burbank",|
301
- plain_line %| state: "CA",|
302
- alpha_line %|- zip: "90382"|
303
- beta_line %|+ zip: "90210"|
304
- plain_line %| }|
298
+ plain_line %| {|
299
+ expected_line %|- city: "Hill Valley",|
300
+ actual_line %|+ city: "Burbank",|
301
+ plain_line %| state: "CA",|
302
+ expected_line %|- zip: "90382"|
303
+ actual_line %|+ zip: "90210"|
304
+ plain_line %| }|
305
305
  },
306
306
  )
307
307
 
@@ -315,7 +315,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
315
315
  as_both_colored_and_uncolored do |color_enabled|
316
316
  snippet = <<~TEST.strip
317
317
  expected = { city: "Hill Valley", state: "CA" }
318
- actual = { city: "Hill Valley", state: "CA", zip: "90210" }
318
+ actual = { city: "Hill Valley", state: "CA", zip: "90210" }
319
319
  expect(actual).not_to include(expected)
320
320
  TEST
321
321
  program = make_plain_test_program(
@@ -329,13 +329,13 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
329
329
  newline_before_expectation: true,
330
330
  expectation: proc {
331
331
  line do
332
- plain " Expected "
333
- beta %|{ city: "Hill Valley", state: "CA", zip: "90210" }|
332
+ plain %| Expected |
333
+ actual %|{ city: "Hill Valley", state: "CA", zip: "90210" }|
334
334
  end
335
335
 
336
336
  line do
337
- plain "not to include "
338
- alpha %|(city: "Hill Valley", state: "CA")|
337
+ plain %|not to include |
338
+ expected %|(city: "Hill Valley", state: "CA")|
339
339
  end
340
340
  },
341
341
  )
@@ -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
 
@@ -375,7 +375,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
375
375
  as_both_colored_and_uncolored do |color_enabled|
376
376
  snippet = <<~TEST.strip
377
377
  expected = "Einie"
378
- actual = ["Marty", "Jennifer", "Doc"]
378
+ actual = ["Marty", "Jennifer", "Doc"]
379
379
  expect(actual).to match_array(expected)
380
380
  TEST
381
381
  program = make_plain_test_program(
@@ -388,20 +388,20 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
388
388
  snippet: %|expect(actual).to match_array(expected)|,
389
389
  expectation: proc {
390
390
  line do
391
- plain "Expected "
392
- beta %|["Marty", "Jennifer", "Doc"]|
393
- plain " to match array with "
394
- alpha %|"Einie"|
395
- plain "."
391
+ plain %|Expected |
392
+ actual %|["Marty", "Jennifer", "Doc"]|
393
+ plain %| to match array with |
394
+ expected %|"Einie"|
395
+ plain %|.|
396
396
  end
397
397
  },
398
398
  diff: proc {
399
- plain_line %| [|
400
- plain_line %| "Marty",|
401
- plain_line %| "Jennifer",|
402
- plain_line %| "Doc",|
403
- alpha_line %|- "Einie"|
404
- plain_line %| ]|
399
+ plain_line %| [|
400
+ actual_line %|+ "Marty",|
401
+ actual_line %|+ "Jennifer",|
402
+ actual_line %|+ "Doc",|
403
+ expected_line %|- "Einie"|
404
+ plain_line %| ]|
405
405
  },
406
406
  )
407
407