super_diff 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_model.rb +24 -12
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb +15 -6
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +23 -8
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/ordered_options.rb +46 -0
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb +4 -0
- data/lib/super_diff/active_support.rb +2 -1
- data/lib/super_diff/differs/date_like.rb +15 -0
- data/lib/super_diff/differs/defaults.rb +1 -0
- data/lib/super_diff/differs.rb +1 -0
- data/lib/super_diff/errors.rb +0 -4
- data/lib/super_diff/object_inspection/inspection_tree.rb +25 -20
- data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +31 -12
- data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +19 -9
- data/lib/super_diff/object_inspection/inspection_tree_builders/date_like.rb +51 -0
- data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +46 -21
- data/lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb +1 -0
- data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +39 -14
- data/lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb +3 -5
- data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +31 -20
- data/lib/super_diff/object_inspection/inspection_tree_builders.rb +4 -0
- data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +3 -2
- data/lib/super_diff/operation_tree_builders/date_like.rb +15 -0
- data/lib/super_diff/operation_tree_builders/defaults.rb +1 -1
- data/lib/super_diff/operation_tree_builders.rb +1 -0
- data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +3 -7
- data/lib/super_diff/rspec/monkey_patches.rb +59 -8
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_containing_exactly.rb +14 -7
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +19 -13
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +30 -26
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/generic_describable_matcher.rb +19 -0
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +19 -14
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +9 -10
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +9 -10
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/object_having_attributes.rb +14 -7
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb +10 -11
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +4 -0
- data/lib/super_diff/rspec.rb +10 -9
- data/lib/super_diff/version.rb +1 -1
- data/lib/super_diff.rb +9 -0
- data/spec/examples.txt +543 -493
- data/spec/integration/rails/engines_spec.rb +8 -3
- data/spec/integration/rspec/contain_exactly_matcher_spec.rb +19 -19
- data/spec/integration/rspec/eq_matcher_spec.rb +111 -39
- data/spec/integration/rspec/generic_describable_matchers_spec.rb +177 -0
- data/spec/integration/rspec/have_attributes_matcher_spec.rb +25 -25
- data/spec/integration/rspec/include_matcher_spec.rb +23 -23
- data/spec/integration/rspec/magic_metadata_spec.rb +51 -0
- data/spec/integration/rspec/match_array_matcher_spec.rb +30 -30
- data/spec/integration/rspec/match_matcher_spec.rb +93 -93
- data/spec/integration/rspec/raise_error_matcher_spec.rb +813 -69
- data/spec/internal/log/test.log +0 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/integration/helpers.rb +15 -10
- data/spec/support/integration/matchers.rb +34 -0
- data/spec/support/integration/test_programs/base.rb +6 -6
- data/spec/support/integration/test_programs/rspec_rails_engine.rb +3 -13
- data/spec/support/shared_examples/active_record.rb +33 -33
- data/spec/support/shared_examples/active_support.rb +125 -4
- data/spec/support/shared_examples/elided_diffs.rb +48 -48
- data/spec/support/shared_examples/hash_with_indifferent_access.rb +88 -88
- data/spec/support/shared_examples/key.rb +10 -10
- data/spec/unit/active_support/object_inspection_spec.rb +170 -0
- data/spec/unit/rspec/matchers/raise_error_spec.rb +43 -11
- data/spec/unit/rspec/object_inspection/rspec_matcher_spec.rb +91 -0
- data/spec/unit/rspec/object_inspection_spec.rb +2 -2
- data/spec/unit/super_diff_spec.rb +64 -0
- metadata +17 -4
- data/lib/super_diff/errors/no_diff_formatter_available_error.rb +0 -21
- data/lib/super_diff/errors/no_operational_sequencer_available_error.rb +0 -22
@@ -6,8 +6,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
6
6
|
it "produces the correct failure message when used in the positive" do
|
7
7
|
as_both_colored_and_uncolored do |color_enabled|
|
8
8
|
snippet = <<~TEST.strip
|
9
|
-
expected = a_hash_including(city: "Hill Valley")
|
10
9
|
actual = { city: "Burbank" }
|
10
|
+
expected = a_hash_including(city: "Hill Valley")
|
11
11
|
expect(actual).to match(expected)
|
12
12
|
TEST
|
13
13
|
program =
|
@@ -45,8 +45,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
45
45
|
it "produces the correct failure message when used in the negative" do
|
46
46
|
as_both_colored_and_uncolored do |color_enabled|
|
47
47
|
snippet = <<~TEST.strip
|
48
|
-
expected = a_hash_including(city: "Burbank")
|
49
48
|
actual = { city: "Burbank" }
|
49
|
+
expected = a_hash_including(city: "Burbank")
|
50
50
|
expect(actual).not_to match(expected)
|
51
51
|
TEST
|
52
52
|
program =
|
@@ -79,16 +79,16 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
79
79
|
it "produces the correct failure message when used in the positive" do
|
80
80
|
as_both_colored_and_uncolored do |color_enabled|
|
81
81
|
snippet = <<~TEST.strip
|
82
|
-
expected = a_hash_including(
|
83
|
-
city: "Hill Valley",
|
84
|
-
zip: "90382"
|
85
|
-
)
|
86
82
|
actual = {
|
87
83
|
line_1: "123 Main St.",
|
88
84
|
city: "Burbank",
|
89
85
|
state: "CA",
|
90
86
|
zip: "90210"
|
91
87
|
}
|
88
|
+
expected = a_hash_including(
|
89
|
+
city: "Hill Valley",
|
90
|
+
zip: "90382"
|
91
|
+
)
|
92
92
|
expect(actual).to match(expected)
|
93
93
|
TEST
|
94
94
|
program =
|
@@ -132,16 +132,16 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
132
132
|
it "produces the correct failure message when used in the negative" do
|
133
133
|
as_both_colored_and_uncolored do |color_enabled|
|
134
134
|
snippet = <<~TEST.strip
|
135
|
-
expected = a_hash_including(
|
136
|
-
city: "Burbank",
|
137
|
-
zip: "90210"
|
138
|
-
)
|
139
135
|
actual = {
|
140
136
|
line_1: "123 Main St.",
|
141
137
|
city: "Burbank",
|
142
138
|
state: "CA",
|
143
139
|
zip: "90210"
|
144
140
|
}
|
141
|
+
expected = a_hash_including(
|
142
|
+
city: "Burbank",
|
143
|
+
zip: "90210"
|
144
|
+
)
|
145
145
|
expect(actual).not_to match(expected)
|
146
146
|
TEST
|
147
147
|
program =
|
@@ -179,13 +179,6 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
179
179
|
it "produces the correct failure message when used in the positive" do
|
180
180
|
as_both_colored_and_uncolored do |color_enabled|
|
181
181
|
snippet = <<~TEST.strip
|
182
|
-
expected = {
|
183
|
-
name: "Marty McFly",
|
184
|
-
address: a_hash_including(
|
185
|
-
city: "Hill Valley",
|
186
|
-
zip: "90382"
|
187
|
-
)
|
188
|
-
}
|
189
182
|
actual = {
|
190
183
|
name: "Marty McFly",
|
191
184
|
address: {
|
@@ -195,6 +188,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
195
188
|
zip: "90210"
|
196
189
|
}
|
197
190
|
}
|
191
|
+
expected = {
|
192
|
+
name: "Marty McFly",
|
193
|
+
address: a_hash_including(
|
194
|
+
city: "Hill Valley",
|
195
|
+
zip: "90382"
|
196
|
+
)
|
197
|
+
}
|
198
198
|
expect(actual).to match(expected)
|
199
199
|
TEST
|
200
200
|
program =
|
@@ -241,13 +241,6 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
241
241
|
it "produces the correct failure message when used in the negative" do
|
242
242
|
as_both_colored_and_uncolored do |color_enabled|
|
243
243
|
snippet = <<~TEST.strip
|
244
|
-
expected = {
|
245
|
-
name: "Marty McFly",
|
246
|
-
address: a_hash_including(
|
247
|
-
city: "Burbank",
|
248
|
-
zip: "90210"
|
249
|
-
)
|
250
|
-
}
|
251
244
|
actual = {
|
252
245
|
name: "Marty McFly",
|
253
246
|
address: {
|
@@ -257,6 +250,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
257
250
|
zip: "90210"
|
258
251
|
}
|
259
252
|
}
|
253
|
+
expected = {
|
254
|
+
name: "Marty McFly",
|
255
|
+
address: a_hash_including(
|
256
|
+
city: "Burbank",
|
257
|
+
zip: "90210"
|
258
|
+
)
|
259
|
+
}
|
260
260
|
expect(actual).not_to match(expected)
|
261
261
|
TEST
|
262
262
|
program =
|
@@ -292,6 +292,10 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
292
292
|
it "produces the correct failure message" do
|
293
293
|
as_both_colored_and_uncolored do |color_enabled|
|
294
294
|
snippet = <<~TEST.strip
|
295
|
+
actual = {
|
296
|
+
name: "Marty McFly",
|
297
|
+
address: nil
|
298
|
+
}
|
295
299
|
expected = {
|
296
300
|
name: "Marty McFly",
|
297
301
|
address: a_hash_including(
|
@@ -299,10 +303,6 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
299
303
|
zip: "90382"
|
300
304
|
)
|
301
305
|
}
|
302
|
-
actual = {
|
303
|
-
name: "Marty McFly",
|
304
|
-
address: nil
|
305
|
-
}
|
306
306
|
expect(actual).to match(expected)
|
307
307
|
TEST
|
308
308
|
program =
|
@@ -351,8 +351,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
351
351
|
it "produces the correct failure message" do
|
352
352
|
as_both_colored_and_uncolored do |color_enabled|
|
353
353
|
snippet = <<~TEST.strip
|
354
|
-
expected = hash_including(city: "Hill Valley")
|
355
354
|
actual = { city: "Burbank" }
|
355
|
+
expected = hash_including(city: "Hill Valley")
|
356
356
|
expect(actual).to match(expected)
|
357
357
|
TEST
|
358
358
|
program = make_plain_test_program(snippet, color_enabled: color_enabled)
|
@@ -392,8 +392,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
392
392
|
it "produces the correct failure message when used in the positive" do
|
393
393
|
as_both_colored_and_uncolored do |color_enabled|
|
394
394
|
snippet = <<~TEST.strip
|
395
|
-
expected = a_collection_including("a")
|
396
395
|
actual = ["b"]
|
396
|
+
expected = a_collection_including("a")
|
397
397
|
expect(actual).to match(expected)
|
398
398
|
TEST
|
399
399
|
program =
|
@@ -432,8 +432,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
432
432
|
it "produces the correct failure message when used in the negative" do
|
433
433
|
as_both_colored_and_uncolored do |color_enabled|
|
434
434
|
snippet = <<~TEST.strip
|
435
|
-
expected = a_collection_including("b")
|
436
435
|
actual = ["b"]
|
436
|
+
expected = a_collection_including("b")
|
437
437
|
expect(actual).not_to match(expected)
|
438
438
|
TEST
|
439
439
|
program =
|
@@ -466,8 +466,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
466
466
|
it "produces the correct failure message when used in the positive" do
|
467
467
|
as_both_colored_and_uncolored do |color_enabled|
|
468
468
|
snippet = <<~TEST.strip
|
469
|
-
expected = a_collection_including("milk", "bread")
|
470
469
|
actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
|
470
|
+
expected = a_collection_including("milk", "bread")
|
471
471
|
expect(actual).to match(expected)
|
472
472
|
TEST
|
473
473
|
program =
|
@@ -512,8 +512,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
512
512
|
it "produces the correct failure message when used in the negative" do
|
513
513
|
as_both_colored_and_uncolored do |color_enabled|
|
514
514
|
snippet = <<~TEST.strip
|
515
|
-
expected = a_collection_including("milk", "toast")
|
516
515
|
actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
|
516
|
+
expected = a_collection_including("milk", "toast")
|
517
517
|
expect(actual).not_to match(expected)
|
518
518
|
TEST
|
519
519
|
program =
|
@@ -551,14 +551,14 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
551
551
|
it "produces the correct failure message when used in the positive" do
|
552
552
|
as_both_colored_and_uncolored do |color_enabled|
|
553
553
|
snippet = <<~TEST.strip
|
554
|
-
expected = {
|
555
|
-
name: "shopping list",
|
556
|
-
contents: a_collection_including("milk", "bread")
|
557
|
-
}
|
558
554
|
actual = {
|
559
555
|
name: "shopping list",
|
560
556
|
contents: ["milk", "toast", "eggs"]
|
561
557
|
}
|
558
|
+
expected = {
|
559
|
+
name: "shopping list",
|
560
|
+
contents: a_collection_including("milk", "bread")
|
561
|
+
}
|
562
562
|
expect(actual).to match(expected)
|
563
563
|
TEST
|
564
564
|
program =
|
@@ -604,14 +604,14 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
604
604
|
it "produces the correct failure message when used in the negative" do
|
605
605
|
as_both_colored_and_uncolored do |color_enabled|
|
606
606
|
snippet = <<~TEST.strip
|
607
|
-
expected = {
|
608
|
-
name: "shopping list",
|
609
|
-
contents: a_collection_including("milk", "toast")
|
610
|
-
}
|
611
607
|
actual = {
|
612
608
|
name: "shopping list",
|
613
609
|
contents: ["milk", "toast", "eggs"]
|
614
610
|
}
|
611
|
+
expected = {
|
612
|
+
name: "shopping list",
|
613
|
+
contents: a_collection_including("milk", "toast")
|
614
|
+
}
|
615
615
|
expect(actual).not_to match(expected)
|
616
616
|
TEST
|
617
617
|
program =
|
@@ -647,14 +647,14 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
647
647
|
it "produces the correct failure message" do
|
648
648
|
as_both_colored_and_uncolored do |color_enabled|
|
649
649
|
snippet = <<~TEST.strip
|
650
|
-
expected = {
|
651
|
-
name: "shopping list",
|
652
|
-
contents: a_collection_including("milk", "bread")
|
653
|
-
}
|
654
650
|
actual = {
|
655
651
|
name: "shopping list",
|
656
652
|
contents: nil
|
657
653
|
}
|
654
|
+
expected = {
|
655
|
+
name: "shopping list",
|
656
|
+
contents: a_collection_including("milk", "bread")
|
657
|
+
}
|
658
658
|
expect(actual).to match(expected)
|
659
659
|
TEST
|
660
660
|
program =
|
@@ -701,8 +701,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
701
701
|
it "produces the correct failure message" do
|
702
702
|
as_both_colored_and_uncolored do |color_enabled|
|
703
703
|
snippet = <<~TEST.strip
|
704
|
-
expected = array_including("a")
|
705
704
|
actual = ["b"]
|
705
|
+
expected = array_including("a")
|
706
706
|
expect(actual).to match(expected)
|
707
707
|
TEST
|
708
708
|
program = make_plain_test_program(snippet, color_enabled: color_enabled)
|
@@ -743,8 +743,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
743
743
|
it "produces the correct failure message when used in the positive" do
|
744
744
|
as_both_colored_and_uncolored do |color_enabled|
|
745
745
|
snippet = <<~TEST.strip
|
746
|
-
expected = an_object_having_attributes(name: "b")
|
747
746
|
actual = A.new("a")
|
747
|
+
expected = an_object_having_attributes(name: "b")
|
748
748
|
expect(actual).to match(expected)
|
749
749
|
TEST
|
750
750
|
program =
|
@@ -783,8 +783,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
783
783
|
it "produces the correct failure message when used in the negative" do
|
784
784
|
as_both_colored_and_uncolored do |color_enabled|
|
785
785
|
snippet = <<~TEST.strip
|
786
|
-
expected = an_object_having_attributes(name: "b")
|
787
786
|
actual = A.new("b")
|
787
|
+
expected = an_object_having_attributes(name: "b")
|
788
788
|
expect(actual).not_to match(expected)
|
789
789
|
TEST
|
790
790
|
program =
|
@@ -817,13 +817,6 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
817
817
|
it "produces the correct failure message when used in the positive" do
|
818
818
|
as_both_colored_and_uncolored do |color_enabled|
|
819
819
|
snippet = <<~TEST.strip
|
820
|
-
expected = an_object_having_attributes(
|
821
|
-
line_1: "123 Main St.",
|
822
|
-
city: "Oakland",
|
823
|
-
zip: "91234",
|
824
|
-
state: "CA",
|
825
|
-
something_else: "blah"
|
826
|
-
)
|
827
820
|
actual = SuperDiff::Test::ShippingAddress.new(
|
828
821
|
line_1: "456 Ponderosa Ct.",
|
829
822
|
line_2: nil,
|
@@ -831,6 +824,13 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
831
824
|
state: "CA",
|
832
825
|
zip: "90382"
|
833
826
|
)
|
827
|
+
expected = an_object_having_attributes(
|
828
|
+
line_1: "123 Main St.",
|
829
|
+
city: "Oakland",
|
830
|
+
zip: "91234",
|
831
|
+
state: "CA",
|
832
|
+
something_else: "blah"
|
833
|
+
)
|
834
834
|
expect(actual).to match(expected)
|
835
835
|
TEST
|
836
836
|
program =
|
@@ -880,11 +880,6 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
880
880
|
it "produces the correct failure message when used in the negative" do
|
881
881
|
as_both_colored_and_uncolored do |color_enabled|
|
882
882
|
snippet = <<~TEST.strip
|
883
|
-
expected = an_object_having_attributes(
|
884
|
-
line_1: "123 Main St.",
|
885
|
-
city: "Oakland",
|
886
|
-
zip: "91234"
|
887
|
-
)
|
888
883
|
actual = SuperDiff::Test::ShippingAddress.new(
|
889
884
|
line_1: "123 Main St.",
|
890
885
|
line_2: nil,
|
@@ -892,6 +887,11 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
892
887
|
zip: "91234",
|
893
888
|
state: "CA"
|
894
889
|
)
|
890
|
+
expected = an_object_having_attributes(
|
891
|
+
line_1: "123 Main St.",
|
892
|
+
city: "Oakland",
|
893
|
+
zip: "91234"
|
894
|
+
)
|
895
895
|
expect(actual).not_to match(expected)
|
896
896
|
TEST
|
897
897
|
program =
|
@@ -928,16 +928,6 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
928
928
|
it "produces the correct failure message when used in the positive" do
|
929
929
|
as_both_colored_and_uncolored do |color_enabled|
|
930
930
|
snippet = <<~TEST.strip
|
931
|
-
expected = {
|
932
|
-
name: "Marty McFly",
|
933
|
-
shipping_address: an_object_having_attributes(
|
934
|
-
line_1: "123 Main St.",
|
935
|
-
city: "Oakland",
|
936
|
-
state: "CA",
|
937
|
-
zip: "91234",
|
938
|
-
something_else: "blah"
|
939
|
-
)
|
940
|
-
}
|
941
931
|
actual = {
|
942
932
|
name: "Marty McFly",
|
943
933
|
shipping_address: SuperDiff::Test::ShippingAddress.new(
|
@@ -948,6 +938,16 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
948
938
|
zip: "90382"
|
949
939
|
)
|
950
940
|
}
|
941
|
+
expected = {
|
942
|
+
name: "Marty McFly",
|
943
|
+
shipping_address: an_object_having_attributes(
|
944
|
+
line_1: "123 Main St.",
|
945
|
+
city: "Oakland",
|
946
|
+
state: "CA",
|
947
|
+
zip: "91234",
|
948
|
+
something_else: "blah"
|
949
|
+
)
|
950
|
+
}
|
951
951
|
expect(actual).to match(expected)
|
952
952
|
TEST
|
953
953
|
program = make_plain_test_program(snippet, color_enabled: color_enabled)
|
@@ -998,23 +998,23 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
998
998
|
it "produces the correct failure message when used the negative" do
|
999
999
|
as_both_colored_and_uncolored do |color_enabled|
|
1000
1000
|
snippet = <<~TEST.strip
|
1001
|
-
|
1001
|
+
actual = {
|
1002
1002
|
name: "Marty McFly",
|
1003
|
-
shipping_address:
|
1003
|
+
shipping_address: SuperDiff::Test::ShippingAddress.new(
|
1004
1004
|
line_1: "123 Main St.",
|
1005
|
+
line_2: nil,
|
1005
1006
|
city: "Oakland",
|
1006
1007
|
state: "CA",
|
1007
|
-
zip: "91234"
|
1008
|
+
zip: "91234",
|
1008
1009
|
)
|
1009
1010
|
}
|
1010
|
-
|
1011
|
+
expected = {
|
1011
1012
|
name: "Marty McFly",
|
1012
|
-
shipping_address:
|
1013
|
+
shipping_address: an_object_having_attributes(
|
1013
1014
|
line_1: "123 Main St.",
|
1014
|
-
line_2: nil,
|
1015
1015
|
city: "Oakland",
|
1016
1016
|
state: "CA",
|
1017
|
-
zip: "91234"
|
1017
|
+
zip: "91234"
|
1018
1018
|
)
|
1019
1019
|
}
|
1020
1020
|
expect(actual).not_to match(expected)
|
@@ -1052,8 +1052,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
1052
1052
|
it "produces the correct failure message when used in the positive" do
|
1053
1053
|
as_both_colored_and_uncolored do |color_enabled|
|
1054
1054
|
snippet = <<~TEST.strip
|
1055
|
-
expected = a_collection_containing_exactly("a")
|
1056
1055
|
actual = ["b"]
|
1056
|
+
expected = a_collection_containing_exactly("a")
|
1057
1057
|
expect(actual).to match(expected)
|
1058
1058
|
TEST
|
1059
1059
|
program =
|
@@ -1092,8 +1092,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
1092
1092
|
it "produces the correct failure message when used in the negative" do
|
1093
1093
|
as_both_colored_and_uncolored do |color_enabled|
|
1094
1094
|
snippet = <<~TEST.strip
|
1095
|
-
expected = a_collection_containing_exactly("b")
|
1096
1095
|
actual = ["b"]
|
1096
|
+
expected = a_collection_containing_exactly("b")
|
1097
1097
|
expect(actual).not_to match(expected)
|
1098
1098
|
TEST
|
1099
1099
|
program =
|
@@ -1126,8 +1126,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
1126
1126
|
it "produces the correct failure message when used in the positive" do
|
1127
1127
|
as_both_colored_and_uncolored do |color_enabled|
|
1128
1128
|
snippet = <<~TEST.strip
|
1129
|
-
expected = a_collection_containing_exactly("milk", "bread")
|
1130
1129
|
actual = ["milk", "toast", "eggs", "cheese", "English muffins"]
|
1130
|
+
expected = a_collection_containing_exactly("milk", "bread")
|
1131
1131
|
expect(actual).to match(expected)
|
1132
1132
|
TEST
|
1133
1133
|
program =
|
@@ -1172,8 +1172,8 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
1172
1172
|
it "produces the correct failure message when used in the negative" do
|
1173
1173
|
as_both_colored_and_uncolored do |color_enabled|
|
1174
1174
|
snippet = <<~TEST.strip
|
1175
|
-
expected = a_collection_containing_exactly("milk", "eggs", "toast")
|
1176
1175
|
actual = ["milk", "toast", "eggs"]
|
1176
|
+
expected = a_collection_containing_exactly("milk", "eggs", "toast")
|
1177
1177
|
expect(actual).not_to match(expected)
|
1178
1178
|
TEST
|
1179
1179
|
program =
|
@@ -1211,14 +1211,14 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
1211
1211
|
it "produces the correct failure message when used in the positive" do
|
1212
1212
|
as_both_colored_and_uncolored do |color_enabled|
|
1213
1213
|
snippet = <<~TEST.strip
|
1214
|
-
expected = {
|
1215
|
-
name: "shopping list",
|
1216
|
-
contents: a_collection_containing_exactly("milk", "bread")
|
1217
|
-
}
|
1218
1214
|
actual = {
|
1219
1215
|
name: "shopping list",
|
1220
1216
|
contents: ["milk", "toast", "eggs"]
|
1221
1217
|
}
|
1218
|
+
expected = {
|
1219
|
+
name: "shopping list",
|
1220
|
+
contents: a_collection_containing_exactly("milk", "bread")
|
1221
|
+
}
|
1222
1222
|
expect(actual).to match(expected)
|
1223
1223
|
TEST
|
1224
1224
|
program =
|
@@ -1264,14 +1264,14 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
1264
1264
|
it "produces the correct failure message when used in the negative" do
|
1265
1265
|
as_both_colored_and_uncolored do |color_enabled|
|
1266
1266
|
snippet = <<~TEST.strip
|
1267
|
-
expected = {
|
1268
|
-
name: "shopping list",
|
1269
|
-
contents: a_collection_containing_exactly("milk", "eggs", "toast")
|
1270
|
-
}
|
1271
1267
|
actual = {
|
1272
1268
|
name: "shopping list",
|
1273
1269
|
contents: ["milk", "toast", "eggs"]
|
1274
1270
|
}
|
1271
|
+
expected = {
|
1272
|
+
name: "shopping list",
|
1273
|
+
contents: a_collection_containing_exactly("milk", "eggs", "toast")
|
1274
|
+
}
|
1275
1275
|
expect(actual).not_to match(expected)
|
1276
1276
|
TEST
|
1277
1277
|
program =
|
@@ -1307,14 +1307,14 @@ RSpec.describe "Integration with RSpec's #match matcher", type: :integration do
|
|
1307
1307
|
it "produces the correct failure message" do
|
1308
1308
|
as_both_colored_and_uncolored do |color_enabled|
|
1309
1309
|
snippet = <<~TEST.strip
|
1310
|
-
expected = {
|
1311
|
-
name: "shopping list",
|
1312
|
-
contents: a_collection_containing_exactly("milk", "bread")
|
1313
|
-
}
|
1314
1310
|
actual = {
|
1315
1311
|
name: "shopping list",
|
1316
1312
|
contents: nil
|
1317
1313
|
}
|
1314
|
+
expected = {
|
1315
|
+
name: "shopping list",
|
1316
|
+
contents: a_collection_containing_exactly("milk", "bread")
|
1317
|
+
}
|
1318
1318
|
expect(actual).to match(expected)
|
1319
1319
|
TEST
|
1320
1320
|
program =
|