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
@@ -11,11 +11,11 @@ RSpec.describe "Integration with RSpec's #be_falsey matcher", type: :integration
|
|
11
11
|
snippet: snippet,
|
12
12
|
expectation: proc {
|
13
13
|
line do
|
14
|
-
plain
|
15
|
-
|
16
|
-
plain
|
17
|
-
|
18
|
-
plain
|
14
|
+
plain %|Expected |
|
15
|
+
actual %|:foo|
|
16
|
+
plain %| to be |
|
17
|
+
expected %|falsey|
|
18
|
+
plain %|.|
|
19
19
|
end
|
20
20
|
},
|
21
21
|
)
|
@@ -36,11 +36,11 @@ RSpec.describe "Integration with RSpec's #be_falsey matcher", type: :integration
|
|
36
36
|
snippet: snippet,
|
37
37
|
expectation: proc {
|
38
38
|
line do
|
39
|
-
plain
|
40
|
-
|
41
|
-
plain
|
42
|
-
|
43
|
-
plain
|
39
|
+
plain %|Expected |
|
40
|
+
actual %|false|
|
41
|
+
plain %| not to be |
|
42
|
+
expected %|falsey|
|
43
|
+
plain %|.|
|
44
44
|
end
|
45
45
|
},
|
46
46
|
)
|
@@ -15,11 +15,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
15
15
|
snippet: %|expect(true).to be(false)|,
|
16
16
|
expectation: proc {
|
17
17
|
line do
|
18
|
-
plain
|
19
|
-
|
20
|
-
plain
|
21
|
-
|
22
|
-
plain
|
18
|
+
plain %|Expected |
|
19
|
+
actual %|true|
|
20
|
+
plain %| to equal |
|
21
|
+
expected %|false|
|
22
|
+
plain %|.|
|
23
23
|
end
|
24
24
|
},
|
25
25
|
)
|
@@ -42,11 +42,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
42
42
|
snippet: %|expect(false).not_to be(false)|,
|
43
43
|
expectation: proc {
|
44
44
|
line do
|
45
|
-
plain
|
46
|
-
|
47
|
-
plain
|
48
|
-
|
49
|
-
plain
|
45
|
+
plain %|Expected |
|
46
|
+
actual %|false|
|
47
|
+
plain %| not to equal |
|
48
|
+
expected %|false|
|
49
|
+
plain %|.|
|
50
50
|
end
|
51
51
|
},
|
52
52
|
)
|
@@ -71,11 +71,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
71
71
|
snippet: %|expect(false).to be(true)|,
|
72
72
|
expectation: proc {
|
73
73
|
line do
|
74
|
-
plain
|
75
|
-
|
76
|
-
plain
|
77
|
-
|
78
|
-
plain
|
74
|
+
plain %|Expected |
|
75
|
+
actual %|false|
|
76
|
+
plain %| to equal |
|
77
|
+
expected %|true|
|
78
|
+
plain %|.|
|
79
79
|
end
|
80
80
|
},
|
81
81
|
)
|
@@ -98,11 +98,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
98
98
|
snippet: %|expect(true).not_to be(true)|,
|
99
99
|
expectation: proc {
|
100
100
|
line do
|
101
|
-
plain
|
102
|
-
|
103
|
-
plain
|
104
|
-
|
105
|
-
plain
|
101
|
+
plain %|Expected |
|
102
|
+
actual %|true|
|
103
|
+
plain %| not to equal |
|
104
|
+
expected %|true|
|
105
|
+
plain %|.|
|
106
106
|
end
|
107
107
|
},
|
108
108
|
)
|
@@ -128,11 +128,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
128
128
|
snippet: %|expect(nil).to be|,
|
129
129
|
expectation: proc {
|
130
130
|
line do
|
131
|
-
plain
|
132
|
-
|
133
|
-
plain
|
134
|
-
|
135
|
-
plain
|
131
|
+
plain %|Expected |
|
132
|
+
actual %|nil|
|
133
|
+
plain %| to be |
|
134
|
+
expected %|truthy|
|
135
|
+
plain %|.|
|
136
136
|
end
|
137
137
|
},
|
138
138
|
)
|
@@ -155,11 +155,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
155
155
|
snippet: %|expect(:something).not_to be|,
|
156
156
|
expectation: proc {
|
157
157
|
line do
|
158
|
-
plain
|
159
|
-
|
160
|
-
plain
|
161
|
-
|
162
|
-
plain
|
158
|
+
plain %|Expected |
|
159
|
+
actual %|:something|
|
160
|
+
plain %| not to be |
|
161
|
+
expected %|truthy|
|
162
|
+
plain %|.|
|
163
163
|
end
|
164
164
|
},
|
165
165
|
)
|
@@ -184,11 +184,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
184
184
|
snippet: %|expect(nil).to be == :foo|,
|
185
185
|
expectation: proc {
|
186
186
|
line do
|
187
|
-
plain
|
188
|
-
|
189
|
-
plain
|
190
|
-
|
191
|
-
plain
|
187
|
+
plain %|Expected |
|
188
|
+
actual %|nil|
|
189
|
+
plain %| to == |
|
190
|
+
expected %|:foo|
|
191
|
+
plain %|.|
|
192
192
|
end
|
193
193
|
},
|
194
194
|
)
|
@@ -211,11 +211,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
211
211
|
snippet: %|expect(:foo).not_to be == :foo|,
|
212
212
|
expectation: proc {
|
213
213
|
line do
|
214
|
-
plain
|
215
|
-
|
216
|
-
plain
|
217
|
-
|
218
|
-
plain
|
214
|
+
plain %|Expected |
|
215
|
+
actual %|:foo|
|
216
|
+
plain %| not to == |
|
217
|
+
expected %|:foo|
|
218
|
+
plain %|.|
|
219
219
|
end
|
220
220
|
},
|
221
221
|
)
|
@@ -240,11 +240,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
240
240
|
snippet: %|expect(1).to be < 1|,
|
241
241
|
expectation: proc {
|
242
242
|
line do
|
243
|
-
plain
|
244
|
-
|
245
|
-
plain
|
246
|
-
|
247
|
-
plain
|
243
|
+
plain %|Expected |
|
244
|
+
actual %|1|
|
245
|
+
plain %| to be < |
|
246
|
+
expected %|1|
|
247
|
+
plain %|.|
|
248
248
|
end
|
249
249
|
},
|
250
250
|
)
|
@@ -267,11 +267,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
267
267
|
snippet: %|expect(0).not_to be < 1|,
|
268
268
|
expectation: proc {
|
269
269
|
line do
|
270
|
-
plain
|
271
|
-
|
272
|
-
plain
|
273
|
-
|
274
|
-
plain
|
270
|
+
plain %|Expected |
|
271
|
+
actual %|0|
|
272
|
+
plain %| not to be < |
|
273
|
+
expected %|1|
|
274
|
+
plain %|.|
|
275
275
|
end
|
276
276
|
},
|
277
277
|
)
|
@@ -296,11 +296,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
296
296
|
snippet: %|expect(1).to be <= 0|,
|
297
297
|
expectation: proc {
|
298
298
|
line do
|
299
|
-
plain
|
300
|
-
|
301
|
-
plain
|
302
|
-
|
303
|
-
plain
|
299
|
+
plain %|Expected |
|
300
|
+
actual %|1|
|
301
|
+
plain %| to be <= |
|
302
|
+
expected %|0|
|
303
|
+
plain %|.|
|
304
304
|
end
|
305
305
|
},
|
306
306
|
)
|
@@ -323,11 +323,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
323
323
|
snippet: %|expect(0).not_to be <= 0|,
|
324
324
|
expectation: proc {
|
325
325
|
line do
|
326
|
-
plain
|
327
|
-
|
328
|
-
plain
|
329
|
-
|
330
|
-
plain
|
326
|
+
plain %|Expected |
|
327
|
+
actual %|0|
|
328
|
+
plain %| not to be <= |
|
329
|
+
expected %|0|
|
330
|
+
plain %|.|
|
331
331
|
end
|
332
332
|
},
|
333
333
|
)
|
@@ -352,11 +352,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
352
352
|
snippet: %|expect(1).to be >= 2|,
|
353
353
|
expectation: proc {
|
354
354
|
line do
|
355
|
-
plain
|
356
|
-
|
357
|
-
plain
|
358
|
-
|
359
|
-
plain
|
355
|
+
plain %|Expected |
|
356
|
+
actual %|1|
|
357
|
+
plain %| to be >= |
|
358
|
+
expected %|2|
|
359
|
+
plain %|.|
|
360
360
|
end
|
361
361
|
},
|
362
362
|
)
|
@@ -379,11 +379,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
379
379
|
snippet: %|expect(2).not_to be >= 2|,
|
380
380
|
expectation: proc {
|
381
381
|
line do
|
382
|
-
plain
|
383
|
-
|
384
|
-
plain
|
385
|
-
|
386
|
-
plain
|
382
|
+
plain %|Expected |
|
383
|
+
actual %|2|
|
384
|
+
plain %| not to be >= |
|
385
|
+
expected %|2|
|
386
|
+
plain %|.|
|
387
387
|
end
|
388
388
|
},
|
389
389
|
)
|
@@ -408,11 +408,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
408
408
|
snippet: %|expect(1).to be > 2|,
|
409
409
|
expectation: proc {
|
410
410
|
line do
|
411
|
-
plain
|
412
|
-
|
413
|
-
plain
|
414
|
-
|
415
|
-
plain
|
411
|
+
plain %|Expected |
|
412
|
+
actual %|1|
|
413
|
+
plain %| to be > |
|
414
|
+
expected %|2|
|
415
|
+
plain %|.|
|
416
416
|
end
|
417
417
|
},
|
418
418
|
)
|
@@ -435,11 +435,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
435
435
|
snippet: %|expect(3).not_to be > 2|,
|
436
436
|
expectation: proc {
|
437
437
|
line do
|
438
|
-
plain
|
439
|
-
|
440
|
-
plain
|
441
|
-
|
442
|
-
plain
|
438
|
+
plain %|Expected |
|
439
|
+
actual %|3|
|
440
|
+
plain %| not to be > |
|
441
|
+
expected %|2|
|
442
|
+
plain %|.|
|
443
443
|
end
|
444
444
|
},
|
445
445
|
)
|
@@ -464,11 +464,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
464
464
|
snippet: %|expect(String).to be === :foo|,
|
465
465
|
expectation: proc {
|
466
466
|
line do
|
467
|
-
plain
|
468
|
-
|
469
|
-
plain
|
470
|
-
|
471
|
-
plain
|
467
|
+
plain %|Expected |
|
468
|
+
actual %|String|
|
469
|
+
plain %| to === |
|
470
|
+
expected %|:foo|
|
471
|
+
plain %|.|
|
472
472
|
end
|
473
473
|
},
|
474
474
|
)
|
@@ -491,11 +491,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
491
491
|
snippet: %|expect(String).not_to be === "foo"|,
|
492
492
|
expectation: proc {
|
493
493
|
line do
|
494
|
-
plain
|
495
|
-
|
496
|
-
plain
|
497
|
-
|
498
|
-
plain
|
494
|
+
plain %|Expected |
|
495
|
+
actual %|String|
|
496
|
+
plain %| not to === |
|
497
|
+
expected %|"foo"|
|
498
|
+
plain %|.|
|
499
499
|
end
|
500
500
|
},
|
501
501
|
)
|
@@ -520,11 +520,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
520
520
|
snippet: %|expect("foo").to be =~ /bar/|,
|
521
521
|
expectation: proc {
|
522
522
|
line do
|
523
|
-
plain
|
524
|
-
|
525
|
-
plain
|
526
|
-
|
527
|
-
plain
|
523
|
+
plain %|Expected |
|
524
|
+
actual %|"foo"|
|
525
|
+
plain %| to =~ |
|
526
|
+
expected %|/bar/|
|
527
|
+
plain %|.|
|
528
528
|
end
|
529
529
|
},
|
530
530
|
)
|
@@ -547,11 +547,11 @@ RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
|
547
547
|
snippet: %|expect("bar").not_to be =~ /bar/|,
|
548
548
|
expectation: proc {
|
549
549
|
line do
|
550
|
-
plain
|
551
|
-
|
552
|
-
plain
|
553
|
-
|
554
|
-
plain
|
550
|
+
plain %|Expected |
|
551
|
+
actual %|"bar"|
|
552
|
+
plain %| not to =~ |
|
553
|
+
expected %|/bar/|
|
554
|
+
plain %|.|
|
555
555
|
end
|
556
556
|
},
|
557
557
|
)
|
@@ -11,11 +11,11 @@ RSpec.describe "Integration with RSpec's #be_nil matcher", type: :integration do
|
|
11
11
|
snippet: %|expect(:foo).to be_nil|,
|
12
12
|
expectation: proc {
|
13
13
|
line do
|
14
|
-
plain
|
15
|
-
|
16
|
-
plain
|
17
|
-
|
18
|
-
plain
|
14
|
+
plain %|Expected |
|
15
|
+
actual %|:foo|
|
16
|
+
plain %| to be |
|
17
|
+
expected %|nil|
|
18
|
+
plain %|.|
|
19
19
|
end
|
20
20
|
},
|
21
21
|
)
|
@@ -36,11 +36,11 @@ RSpec.describe "Integration with RSpec's #be_nil matcher", type: :integration do
|
|
36
36
|
snippet: %|expect(nil).not_to be_nil|,
|
37
37
|
expectation: proc {
|
38
38
|
line do
|
39
|
-
plain
|
40
|
-
|
41
|
-
plain
|
42
|
-
|
43
|
-
plain
|
39
|
+
plain %|Expected |
|
40
|
+
actual %|nil|
|
41
|
+
plain %| not to be |
|
42
|
+
expected %|nil|
|
43
|
+
plain %|.|
|
44
44
|
end
|
45
45
|
},
|
46
46
|
)
|
@@ -6,7 +6,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
6
6
|
# rubocop:enable Metrics/BlockLength
|
7
7
|
context "using #{prefix}_<predicate>" do
|
8
8
|
context "when the predicate method doesn't exist on the object" do
|
9
|
-
context "when the inspected version of the actual
|
9
|
+
context "when the inspected version of the actual value is short" do
|
10
10
|
it "produces the correct failure message" do
|
11
11
|
as_both_colored_and_uncolored do |color_enabled|
|
12
12
|
snippet = %|expect(:foo).to #{prefix}_strong|
|
@@ -20,13 +20,13 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
20
20
|
snippet: snippet,
|
21
21
|
expectation: proc {
|
22
22
|
line do
|
23
|
-
plain
|
24
|
-
|
25
|
-
plain
|
26
|
-
|
27
|
-
plain
|
28
|
-
|
29
|
-
plain
|
23
|
+
plain %|Expected |
|
24
|
+
actual %|:foo|
|
25
|
+
plain %| to respond to |
|
26
|
+
expected %|strong?|
|
27
|
+
plain %| or |
|
28
|
+
expected %|strongs?|
|
29
|
+
plain %|.|
|
30
30
|
end
|
31
31
|
},
|
32
32
|
)
|
@@ -38,7 +38,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
context "when the inspected version of the actual
|
41
|
+
context "when the inspected version of the actual value is long" do
|
42
42
|
it "produces the correct failure message" do
|
43
43
|
as_both_colored_and_uncolored do |color_enabled|
|
44
44
|
snippet = <<~TEST.strip
|
@@ -56,15 +56,15 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
56
56
|
newline_before_expectation: true,
|
57
57
|
expectation: proc {
|
58
58
|
line do
|
59
|
-
plain
|
60
|
-
|
59
|
+
plain %| Expected |
|
60
|
+
actual %|{ foo: "bar", baz: "qux", blargh: "foz", fizz: "buzz", aaaaaa: "bbbbbb" }|
|
61
61
|
end
|
62
62
|
|
63
63
|
line do
|
64
|
-
plain
|
65
|
-
|
66
|
-
plain
|
67
|
-
|
64
|
+
plain %|to respond to |
|
65
|
+
expected %|strong?|
|
66
|
+
plain %| or |
|
67
|
+
expected %|strongs?|
|
68
68
|
end
|
69
69
|
},
|
70
70
|
)
|
@@ -79,7 +79,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
79
79
|
|
80
80
|
context "when the predicate method exists on the object" do
|
81
81
|
context "but is private" do
|
82
|
-
context "when the inspected version of the actual
|
82
|
+
context "when the inspected version of the actual value is short" do
|
83
83
|
it "produces the correct failure message" do
|
84
84
|
as_both_colored_and_uncolored do |color_enabled|
|
85
85
|
snippet = <<~TEST.strip
|
@@ -99,13 +99,13 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
99
99
|
snippet: %|expect(Foo.new).to #{prefix}_strong|,
|
100
100
|
expectation: proc {
|
101
101
|
line do
|
102
|
-
plain
|
103
|
-
|
104
|
-
plain
|
105
|
-
|
106
|
-
plain
|
107
|
-
|
108
|
-
plain
|
102
|
+
plain %|Expected |
|
103
|
+
actual %|#<Foo>|
|
104
|
+
plain %| to have a public method |
|
105
|
+
expected %|strong?|
|
106
|
+
plain %| or |
|
107
|
+
expected %|strongs?|
|
108
|
+
plain %|.|
|
109
109
|
end
|
110
110
|
},
|
111
111
|
)
|
@@ -118,7 +118,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
context "when the inspected version of the actual
|
121
|
+
context "when the inspected version of the actual value is long" do
|
122
122
|
it "produces the correct failure message" do
|
123
123
|
as_both_colored_and_uncolored do |color_enabled|
|
124
124
|
snippet = <<~TEST.strip
|
@@ -141,15 +141,15 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
141
141
|
newline_before_expectation: true,
|
142
142
|
expectation: proc {
|
143
143
|
line do
|
144
|
-
plain
|
145
|
-
|
144
|
+
plain %| Expected |
|
145
|
+
actual %|{ foo: "bar", baz: "qux", blargh: "foz", fizz: "buzz" }|
|
146
146
|
end
|
147
147
|
|
148
148
|
line do
|
149
|
-
plain
|
150
|
-
|
151
|
-
plain
|
152
|
-
|
149
|
+
plain %|to have a public method |
|
150
|
+
expected %|strong?|
|
151
|
+
plain %| or |
|
152
|
+
expected %|strongs?|
|
153
153
|
end
|
154
154
|
},
|
155
155
|
)
|
@@ -166,7 +166,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
166
166
|
context "and is public" do
|
167
167
|
context "and returns false" do
|
168
168
|
context "but is called #true?" do
|
169
|
-
context "when the inspected version of the actual
|
169
|
+
context "when the inspected version of the actual value is short" do
|
170
170
|
it "produces the correct failure message" do
|
171
171
|
as_both_colored_and_uncolored do |color_enabled|
|
172
172
|
snippet = <<~TEST.strip
|
@@ -187,23 +187,23 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
187
187
|
newline_before_expectation: true,
|
188
188
|
expectation: proc {
|
189
189
|
line do
|
190
|
-
plain
|
191
|
-
|
192
|
-
plain
|
193
|
-
|
194
|
-
plain
|
195
|
-
|
196
|
-
plain
|
190
|
+
plain %|Expected |
|
191
|
+
actual %|#<Foo>|
|
192
|
+
plain %| to return a truthy result for |
|
193
|
+
expected %|true?|
|
194
|
+
plain %| or |
|
195
|
+
expected %|trues?|
|
196
|
+
plain %|.|
|
197
197
|
end
|
198
198
|
|
199
199
|
newline
|
200
200
|
|
201
201
|
line do
|
202
|
-
plain
|
202
|
+
plain %|(Perhaps you want to use |
|
203
203
|
blue "be(true)"
|
204
|
-
plain
|
204
|
+
plain %| or |
|
205
205
|
blue "be_truthy"
|
206
|
-
plain
|
206
|
+
plain %| instead?)|
|
207
207
|
end
|
208
208
|
},
|
209
209
|
)
|
@@ -216,7 +216,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
219
|
-
context "when the inspected version of the actual
|
219
|
+
context "when the inspected version of the actual value is long" do
|
220
220
|
it "produces the correct failure message" do
|
221
221
|
as_both_colored_and_uncolored do |color_enabled|
|
222
222
|
snippet = <<~TEST.strip
|
@@ -244,25 +244,25 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
244
244
|
newline_before_expectation: true,
|
245
245
|
expectation: proc {
|
246
246
|
line do
|
247
|
-
plain
|
248
|
-
|
247
|
+
plain %| Expected |
|
248
|
+
actual %|{ foo: "bar", baz: "qux", blargh: "foz", fizz: "buzz" }|
|
249
249
|
end
|
250
250
|
|
251
251
|
line do
|
252
|
-
plain
|
253
|
-
|
254
|
-
plain
|
255
|
-
|
252
|
+
plain %|to return a truthy result for |
|
253
|
+
expected %|true?|
|
254
|
+
plain %| or |
|
255
|
+
expected %|trues?|
|
256
256
|
end
|
257
257
|
|
258
258
|
newline
|
259
259
|
|
260
260
|
line do
|
261
|
-
plain
|
261
|
+
plain %|(Perhaps you want to use |
|
262
262
|
blue "be(true)"
|
263
|
-
plain
|
263
|
+
plain %| or |
|
264
264
|
blue "be_truthy"
|
265
|
-
plain
|
265
|
+
plain %| instead?)|
|
266
266
|
end
|
267
267
|
},
|
268
268
|
)
|
@@ -297,13 +297,13 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
297
297
|
newline_before_expectation: true,
|
298
298
|
expectation: proc {
|
299
299
|
line do
|
300
|
-
plain
|
301
|
-
|
302
|
-
plain
|
303
|
-
|
304
|
-
plain
|
305
|
-
|
306
|
-
plain
|
300
|
+
plain %|Expected |
|
301
|
+
actual %|#<X>|
|
302
|
+
plain %| to return a truthy result for |
|
303
|
+
expected %|false?|
|
304
|
+
plain %| or |
|
305
|
+
expected %|falses?|
|
306
|
+
plain %|.|
|
307
307
|
end
|
308
308
|
},
|
309
309
|
)
|
@@ -318,7 +318,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
318
318
|
|
319
319
|
context "and is called neither #true? nor #false?" do
|
320
320
|
context "and is singular" do
|
321
|
-
context "when the inspected version of the actual
|
321
|
+
context "when the inspected version of the actual value is short" do
|
322
322
|
it "produces the correct failure message" do
|
323
323
|
as_both_colored_and_uncolored do |color_enabled|
|
324
324
|
snippet = <<~TEST.strip
|
@@ -338,13 +338,13 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
338
338
|
snippet: %|expect(X.new).to #{prefix}_y|,
|
339
339
|
expectation: proc {
|
340
340
|
line do
|
341
|
-
plain
|
342
|
-
|
343
|
-
plain
|
344
|
-
|
345
|
-
plain
|
346
|
-
|
347
|
-
plain
|
341
|
+
plain %|Expected |
|
342
|
+
actual %|#<X>|
|
343
|
+
plain %| to return a truthy result for |
|
344
|
+
expected %|y?|
|
345
|
+
plain %| or |
|
346
|
+
expected %|ys?|
|
347
|
+
plain %|.|
|
348
348
|
end
|
349
349
|
},
|
350
350
|
)
|
@@ -357,7 +357,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
357
357
|
end
|
358
358
|
end
|
359
359
|
|
360
|
-
context "when the inspected version of the actual
|
360
|
+
context "when the inspected version of the actual value is long" do
|
361
361
|
it "produces the correct failure message" do
|
362
362
|
as_both_colored_and_uncolored do |color_enabled|
|
363
363
|
snippet = <<~TEST.strip
|
@@ -386,15 +386,15 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
386
386
|
newline_before_expectation: true,
|
387
387
|
expectation: proc {
|
388
388
|
line do
|
389
|
-
plain
|
390
|
-
|
389
|
+
plain %| Expected |
|
390
|
+
actual %|{ foo: "bar", baz: "qux", blargh: "foz", fizz: "buzz", aaaaaa: "bbbbbb" }|
|
391
391
|
end
|
392
392
|
|
393
393
|
line do
|
394
|
-
plain
|
395
|
-
|
396
|
-
plain
|
397
|
-
|
394
|
+
plain %|to return a truthy result for |
|
395
|
+
expected %|y?|
|
396
|
+
plain %| or |
|
397
|
+
expected %|ys?|
|
398
398
|
end
|
399
399
|
},
|
400
400
|
)
|
@@ -409,7 +409,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
409
409
|
end
|
410
410
|
|
411
411
|
context "and is plural" do
|
412
|
-
context "when the inspected version of the actual
|
412
|
+
context "when the inspected version of the actual value is short" do
|
413
413
|
it "produces the correct failure message" do
|
414
414
|
as_both_colored_and_uncolored do |color_enabled|
|
415
415
|
snippet = <<~TEST.strip
|
@@ -429,13 +429,13 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
429
429
|
snippet: %|expect(X.new).to #{prefix}_y|,
|
430
430
|
expectation: proc {
|
431
431
|
line do
|
432
|
-
plain
|
433
|
-
|
434
|
-
plain
|
435
|
-
|
436
|
-
plain
|
437
|
-
|
438
|
-
plain
|
432
|
+
plain %|Expected |
|
433
|
+
actual %|#<X>|
|
434
|
+
plain %| to return a truthy result for |
|
435
|
+
expected %|y?|
|
436
|
+
plain %| or |
|
437
|
+
expected %|ys?|
|
438
|
+
plain %|.|
|
439
439
|
end
|
440
440
|
},
|
441
441
|
)
|
@@ -448,7 +448,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
448
448
|
end
|
449
449
|
end
|
450
450
|
|
451
|
-
context "when the inspected version of the actual
|
451
|
+
context "when the inspected version of the actual value is long" do
|
452
452
|
it "produces the correct failure message" do
|
453
453
|
as_both_colored_and_uncolored do |color_enabled|
|
454
454
|
snippet = <<~TEST.strip
|
@@ -477,15 +477,15 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
477
477
|
newline_before_expectation: true,
|
478
478
|
expectation: proc {
|
479
479
|
line do
|
480
|
-
plain
|
481
|
-
|
480
|
+
plain %| Expected |
|
481
|
+
actual %|{ foo: "bar", baz: "qux", blargh: "foz", fizz: "buzz", aaaaaa: "bbbbbb" }|
|
482
482
|
end
|
483
483
|
|
484
484
|
line do
|
485
|
-
plain
|
486
|
-
|
487
|
-
plain
|
488
|
-
|
485
|
+
plain %|to return a truthy result for |
|
486
|
+
expected %|y?|
|
487
|
+
plain %| or |
|
488
|
+
expected %|ys?|
|
489
489
|
end
|
490
490
|
},
|
491
491
|
)
|
@@ -502,7 +502,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
502
502
|
end
|
503
503
|
|
504
504
|
context "and returns true" do
|
505
|
-
context "when the inspected version of the actual
|
505
|
+
context "when the inspected version of the actual value is short" do
|
506
506
|
it "produces the correct failure message when used in the negative" do
|
507
507
|
as_both_colored_and_uncolored do |color_enabled|
|
508
508
|
snippet = <<~TEST.strip
|
@@ -522,13 +522,13 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
522
522
|
snippet: %|expect(Foo.new).not_to #{prefix}_strong|,
|
523
523
|
expectation: proc {
|
524
524
|
line do
|
525
|
-
plain
|
526
|
-
|
527
|
-
plain
|
528
|
-
|
529
|
-
plain
|
530
|
-
|
531
|
-
plain
|
525
|
+
plain %|Expected |
|
526
|
+
actual %|#<Foo>|
|
527
|
+
plain %| not to return a truthy result for |
|
528
|
+
expected %|strong?|
|
529
|
+
plain %| or |
|
530
|
+
expected %|strongs?|
|
531
|
+
plain %|.|
|
532
532
|
end
|
533
533
|
},
|
534
534
|
)
|
@@ -541,7 +541,7 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
541
541
|
end
|
542
542
|
end
|
543
543
|
|
544
|
-
context "when the inspected version of the actual
|
544
|
+
context "when the inspected version of the actual value is long" do
|
545
545
|
it "produces the correct failure message when used in the negative" do
|
546
546
|
as_both_colored_and_uncolored do |color_enabled|
|
547
547
|
snippet = <<~TEST.strip
|
@@ -570,15 +570,15 @@ RSpec.describe "Integration with RSpec's #be_<predicate> matcher", type: :integr
|
|
570
570
|
newline_before_expectation: true,
|
571
571
|
expectation: proc {
|
572
572
|
line do
|
573
|
-
plain
|
574
|
-
|
573
|
+
plain %| Expected |
|
574
|
+
actual %|{ foo: "bar", baz: "qux", blargh: "foz", fizz: "buzz", aaaaaa: "bbbbbb" }|
|
575
575
|
end
|
576
576
|
|
577
577
|
line do
|
578
|
-
plain
|
579
|
-
|
580
|
-
plain
|
581
|
-
|
578
|
+
plain %|not to return a truthy result for |
|
579
|
+
expected %|y?|
|
580
|
+
plain %| or |
|
581
|
+
expected %|ys?|
|
582
582
|
end
|
583
583
|
},
|
584
584
|
)
|