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.
- checksums.yaml +4 -4
- data/README.md +46 -19
- data/lib/super_diff.rb +1 -7
- data/lib/super_diff/colorized_document_extensions.rb +4 -4
- data/lib/super_diff/configuration.rb +32 -22
- data/lib/super_diff/csi.rb +2 -1
- data/lib/super_diff/diff_formatters/collection.rb +1 -1
- data/lib/super_diff/diff_formatters/multiline_string.rb +4 -4
- data/lib/super_diff/equality_matchers/array.rb +2 -2
- data/lib/super_diff/equality_matchers/default.rb +2 -2
- data/lib/super_diff/equality_matchers/hash.rb +2 -2
- data/lib/super_diff/equality_matchers/multiline_string.rb +2 -2
- data/lib/super_diff/equality_matchers/primitive.rb +2 -2
- data/lib/super_diff/equality_matchers/singleline_string.rb +2 -2
- data/lib/super_diff/gem_version.rb +45 -0
- data/lib/super_diff/rspec.rb +4 -0
- data/lib/super_diff/rspec/matcher_text_builders/base.rb +7 -7
- data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +6 -6
- data/lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb +1 -1
- data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +4 -4
- data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -1
- data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +5 -5
- data/lib/super_diff/rspec/monkey_patches.rb +22 -13
- data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +12 -1
- data/lib/super_diff/version.rb +1 -1
- data/spec/examples.txt +393 -5
- data/spec/integration/rspec/be_falsey_matcher_spec.rb +10 -10
- data/spec/integration/rspec/be_matcher_spec.rb +100 -100
- data/spec/integration/rspec/be_nil_matcher_spec.rb +10 -10
- data/spec/integration/rspec/be_predicate_matcher_spec.rb +103 -103
- data/spec/integration/rspec/be_truthy_matcher_spec.rb +10 -10
- data/spec/integration/rspec/contain_exactly_matcher_spec.rb +107 -107
- data/spec/integration/rspec/eq_matcher_spec.rb +230 -230
- data/spec/integration/rspec/have_attributes_matcher_spec.rb +129 -129
- data/spec/integration/rspec/have_predicate_matcher_spec.rb +65 -65
- data/spec/integration/rspec/include_matcher_spec.rb +73 -73
- data/spec/integration/rspec/match_array_matcher_spec.rb +119 -119
- data/spec/integration/rspec/match_matcher_spec.rb +274 -274
- data/spec/integration/rspec/raise_error_matcher_spec.rb +86 -86
- data/spec/integration/rspec/respond_to_matcher_spec.rb +240 -240
- data/spec/integration/rspec/third_party_matcher_spec.rb +8 -8
- data/spec/integration/rspec/unhandled_errors_spec.rb +5 -5
- data/spec/spec_helper.rb +22 -13
- data/spec/support/integration/helpers.rb +6 -2
- data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +1 -1
- data/spec/support/integration/test_programs/base.rb +2 -0
- data/spec/support/integration/test_programs/rspec_active_record.rb +1 -1
- data/spec/support/integration/test_programs/rspec_active_support.rb +17 -0
- data/spec/support/integration/test_programs/rspec_rails.rb +1 -1
- data/spec/support/shared_examples/active_record.rb +108 -108
- data/spec/support/shared_examples/hash_with_indifferent_access.rb +196 -232
- data/spec/tmp/integration_spec.rb +15 -0
- data/spec/unit/equality_matchers/main_spec.rb +403 -403
- data/super_diff.gemspec +1 -1
- metadata +11 -3
@@ -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
|
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
|
24
|
-
|
25
|
-
plain
|
26
|
-
|
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
|
-
|
33
|
-
|
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
|
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
|
62
|
-
|
63
|
-
plain
|
64
|
-
|
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
|
104
|
-
|
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
|
109
|
-
|
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
|
115
|
-
|
116
|
-
|
117
|
-
plain_line
|
118
|
-
|
119
|
-
|
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
|
157
|
-
|
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
|
162
|
-
|
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
|
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
|
209
|
-
|
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
|
214
|
-
|
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
|
220
|
-
plain_line
|
221
|
-
plain_line
|
222
|
-
|
223
|
-
|
224
|
-
plain_line
|
225
|
-
|
226
|
-
|
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
|
271
|
-
|
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
|
276
|
-
|
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
|
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
|
316
|
-
|
315
|
+
plain %|Expected |
|
316
|
+
actual %|{ name: "Marty McFly", address: nil }|
|
317
317
|
end
|
318
318
|
|
319
319
|
line do
|
320
|
-
plain
|
321
|
-
|
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
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
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
|
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
|
364
|
-
|
365
|
-
plain
|
366
|
-
|
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
|
373
|
-
#
|
374
|
-
|
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
|
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
|
403
|
-
|
404
|
-
plain
|
405
|
-
|
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
|
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
|
437
|
-
|
436
|
+
plain %|Expected |
|
437
|
+
actual %|["milk", "toast", "eggs", "cheese", "English muffins"]|
|
438
438
|
end
|
439
439
|
|
440
440
|
line do
|
441
|
-
plain
|
442
|
-
|
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
|
448
|
-
plain_line
|
449
|
-
plain_line
|
450
|
-
plain_line
|
451
|
-
# plain_line
|
452
|
-
plain_line
|
453
|
-
|
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
|
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
|
483
|
-
|
482
|
+
plain %| Expected |
|
483
|
+
actual %|["milk", "toast", "eggs", "cheese", "English muffins"]|
|
484
484
|
end
|
485
485
|
|
486
486
|
line do
|
487
|
-
plain
|
488
|
-
|
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
|
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
|
527
|
-
|
526
|
+
plain %|Expected |
|
527
|
+
actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
|
528
528
|
end
|
529
529
|
|
530
530
|
line do
|
531
|
-
plain
|
532
|
-
|
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
|
538
|
-
plain_line
|
539
|
-
plain_line
|
540
|
-
plain_line
|
541
|
-
# plain_line
|
542
|
-
plain_line
|
543
|
-
|
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
|
580
|
-
|
579
|
+
plain %| Expected |
|
580
|
+
actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
|
581
581
|
end
|
582
582
|
|
583
583
|
line do
|
584
|
-
plain
|
585
|
-
|
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
|
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
|
622
|
-
|
621
|
+
plain %|Expected |
|
622
|
+
actual %|{ name: "shopping list", contents: nil }|
|
623
623
|
end
|
624
624
|
|
625
625
|
line do
|
626
|
-
plain
|
627
|
-
|
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
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
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
|
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
|
670
|
-
|
671
|
-
plain
|
672
|
-
|
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
|
678
|
-
#
|
679
|
-
|
680
|
-
|
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
|
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
|
709
|
-
|
710
|
-
plain
|
711
|
-
|
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
|
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
|
755
|
-
|
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
|
760
|
-
|
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
|
765
|
-
|
766
|
-
|
767
|
-
plain_line
|
768
|
-
|
769
|
-
|
770
|
-
plain_line
|
771
|
-
#
|
772
|
-
#
|
773
|
-
|
774
|
-
|
775
|
-
|
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
|
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
|
815
|
-
|
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
|
820
|
-
|
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
|
870
|
-
|
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
|
875
|
-
|
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
|
881
|
-
plain_line
|
882
|
-
|
883
|
-
|
884
|
-
plain_line
|
885
|
-
|
886
|
-
|
887
|
-
plain_line
|
888
|
-
#
|
889
|
-
|
890
|
-
|
891
|
-
|
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
|
939
|
-
|
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
|
944
|
-
|
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
|
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
|
976
|
-
|
977
|
-
plain
|
978
|
-
|
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
|
-
|
985
|
-
|
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
|
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
|
1014
|
-
|
1015
|
-
plain
|
1016
|
-
|
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
|
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
|
1048
|
-
|
1047
|
+
plain %|Expected |
|
1048
|
+
actual %|["milk", "toast", "eggs", "cheese", "English muffins"]|
|
1049
1049
|
end
|
1050
1050
|
|
1051
1051
|
line do
|
1052
|
-
plain
|
1053
|
-
|
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
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
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
|
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
|
1093
|
-
|
1092
|
+
plain %| Expected |
|
1093
|
+
actual %|["milk", "toast", "eggs"]|
|
1094
1094
|
end
|
1095
1095
|
|
1096
1096
|
line do
|
1097
|
-
plain
|
1098
|
-
|
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
|
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
|
1137
|
-
|
1136
|
+
plain %|Expected |
|
1137
|
+
actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
|
1138
1138
|
end
|
1139
1139
|
|
1140
1140
|
line do
|
1141
|
-
plain
|
1142
|
-
|
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
|
1148
|
-
plain_line
|
1149
|
-
plain_line
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
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
|
1189
|
-
|
1188
|
+
plain %| Expected |
|
1189
|
+
actual %|{ name: "shopping list", contents: ["milk", "toast", "eggs"] }|
|
1190
1190
|
end
|
1191
1191
|
|
1192
1192
|
line do
|
1193
|
-
plain
|
1194
|
-
|
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
|
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
|
1231
|
-
|
1230
|
+
plain %|Expected |
|
1231
|
+
actual %|{ name: "shopping list", contents: nil }|
|
1232
1232
|
end
|
1233
1233
|
|
1234
1234
|
line do
|
1235
|
-
plain
|
1236
|
-
|
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
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
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
|
|