super_diff 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -26
  3. data/lib/super_diff/active_record/differs/active_record_relation.rb +1 -2
  4. data/lib/super_diff/active_record/differs.rb +1 -1
  5. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_model.rb +22 -18
  6. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb +14 -7
  7. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb +2 -2
  8. data/lib/super_diff/active_record/object_inspection.rb +1 -1
  9. data/lib/super_diff/active_record/operation_tree_builders/active_record_model.rb +1 -2
  10. data/lib/super_diff/active_record/operation_tree_builders/active_record_relation.rb +1 -2
  11. data/lib/super_diff/active_record/operation_tree_builders.rb +2 -2
  12. data/lib/super_diff/active_record/operation_tree_flatteners.rb +1 -1
  13. data/lib/super_diff/active_record/operation_trees.rb +1 -1
  14. data/lib/super_diff/active_record.rb +7 -15
  15. data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +5 -6
  16. data/lib/super_diff/active_support/differs.rb +1 -1
  17. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +20 -11
  18. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/ordered_options.rb +46 -0
  19. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb +5 -1
  20. data/lib/super_diff/active_support/object_inspection.rb +1 -1
  21. data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +5 -6
  22. data/lib/super_diff/active_support/operation_tree_builders.rb +1 -1
  23. data/lib/super_diff/active_support/operation_tree_flatteners.rb +1 -1
  24. data/lib/super_diff/active_support/operation_trees.rb +1 -1
  25. data/lib/super_diff/active_support.rb +6 -10
  26. data/lib/super_diff/colorized_document_extensions.rb +2 -4
  27. data/lib/super_diff/configuration.rb +14 -8
  28. data/lib/super_diff/csi/color.rb +4 -4
  29. data/lib/super_diff/csi/colorized_document.rb +12 -16
  30. data/lib/super_diff/csi/document.rb +8 -19
  31. data/lib/super_diff/csi/eight_bit_color.rb +19 -19
  32. data/lib/super_diff/csi/four_bit_color.rb +82 -31
  33. data/lib/super_diff/csi/twenty_four_bit_color.rb +12 -11
  34. data/lib/super_diff/csi/uncolorized_document.rb +2 -6
  35. data/lib/super_diff/csi.rb +10 -14
  36. data/lib/super_diff/diff_formatters/collection.rb +35 -41
  37. data/lib/super_diff/differs/date_like.rb +15 -0
  38. data/lib/super_diff/differs/default_object.rb +1 -1
  39. data/lib/super_diff/differs/defaults.rb +2 -1
  40. data/lib/super_diff/differs/main.rb +2 -13
  41. data/lib/super_diff/differs.rb +1 -0
  42. data/lib/super_diff/equality_matchers/array.rb +10 -12
  43. data/lib/super_diff/equality_matchers/base.rb +1 -1
  44. data/lib/super_diff/equality_matchers/default.rb +2 -4
  45. data/lib/super_diff/equality_matchers/defaults.rb +1 -1
  46. data/lib/super_diff/equality_matchers/hash.rb +10 -12
  47. data/lib/super_diff/equality_matchers/multiline_string.rb +11 -13
  48. data/lib/super_diff/equality_matchers/primitive.rb +10 -12
  49. data/lib/super_diff/equality_matchers/singleline_string.rb +10 -12
  50. data/lib/super_diff/equality_matchers.rb +1 -1
  51. data/lib/super_diff/errors.rb +2 -6
  52. data/lib/super_diff/gem_version.rb +3 -3
  53. data/lib/super_diff/helpers.rb +10 -10
  54. data/lib/super_diff/implementation_checks.rb +2 -2
  55. data/lib/super_diff/line.rb +3 -3
  56. data/lib/super_diff/object_inspection/inspection_tree.rb +64 -73
  57. data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +29 -14
  58. data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +17 -13
  59. data/lib/super_diff/object_inspection/inspection_tree_builders/date_like.rb +51 -0
  60. data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +43 -27
  61. data/lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb +2 -1
  62. data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +35 -18
  63. data/lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb +3 -5
  64. data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +30 -36
  65. data/lib/super_diff/object_inspection/inspection_tree_builders.rb +13 -9
  66. data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +11 -22
  67. data/lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb +1 -5
  68. data/lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb +1 -5
  69. data/lib/super_diff/object_inspection/nodes/as_single_line.rb +3 -7
  70. data/lib/super_diff/object_inspection/nodes/base.rb +9 -14
  71. data/lib/super_diff/object_inspection/nodes/inspection.rb +26 -34
  72. data/lib/super_diff/object_inspection/nodes/nesting.rb +1 -1
  73. data/lib/super_diff/object_inspection/nodes/only_when.rb +2 -6
  74. data/lib/super_diff/object_inspection/nodes/text.rb +1 -5
  75. data/lib/super_diff/object_inspection/nodes/when_empty.rb +2 -6
  76. data/lib/super_diff/object_inspection/nodes/when_non_empty.rb +2 -6
  77. data/lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb +1 -1
  78. data/lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb +1 -5
  79. data/lib/super_diff/object_inspection/nodes.rb +7 -7
  80. data/lib/super_diff/object_inspection.rb +3 -3
  81. data/lib/super_diff/operation_tree_builders/array.rb +12 -11
  82. data/lib/super_diff/operation_tree_builders/base.rb +17 -15
  83. data/lib/super_diff/operation_tree_builders/custom_object.rb +8 -6
  84. data/lib/super_diff/operation_tree_builders/date_like.rb +15 -0
  85. data/lib/super_diff/operation_tree_builders/default_object.rb +29 -21
  86. data/lib/super_diff/operation_tree_builders/defaults.rb +1 -1
  87. data/lib/super_diff/operation_tree_builders/hash.rb +23 -24
  88. data/lib/super_diff/operation_tree_builders/main.rb +4 -11
  89. data/lib/super_diff/operation_tree_builders/multiline_string.rb +3 -3
  90. data/lib/super_diff/operation_tree_builders/time_like.rb +1 -11
  91. data/lib/super_diff/operation_tree_builders.rb +2 -1
  92. data/lib/super_diff/operation_tree_flatteners/base.rb +1 -5
  93. data/lib/super_diff/operation_tree_flatteners/collection.rb +13 -16
  94. data/lib/super_diff/operation_tree_flatteners/default_object.rb +1 -2
  95. data/lib/super_diff/operation_tree_flatteners/hash.rb +2 -10
  96. data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +2 -1
  97. data/lib/super_diff/operation_tree_flatteners.rb +3 -3
  98. data/lib/super_diff/operation_trees/base.rb +3 -5
  99. data/lib/super_diff/operation_trees/default_object.rb +1 -3
  100. data/lib/super_diff/operations/binary_operation.rb +2 -2
  101. data/lib/super_diff/operations/unary_operation.rb +1 -1
  102. data/lib/super_diff/rails.rb +2 -1
  103. data/lib/super_diff/recursion_guard.rb +5 -4
  104. data/lib/super_diff/rspec/augmented_matcher.rb +4 -5
  105. data/lib/super_diff/rspec/differ.rb +6 -13
  106. data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +3 -2
  107. data/lib/super_diff/rspec/differs/collection_including.rb +1 -1
  108. data/lib/super_diff/rspec/differs/hash_including.rb +1 -1
  109. data/lib/super_diff/rspec/differs.rb +3 -3
  110. data/lib/super_diff/rspec/matcher_text_builders/base.rb +13 -15
  111. data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +5 -7
  112. data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +3 -5
  113. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +2 -10
  114. data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +2 -6
  115. data/lib/super_diff/rspec/matcher_text_builders.rb +5 -8
  116. data/lib/super_diff/rspec/matcher_text_template.rb +13 -16
  117. data/lib/super_diff/rspec/monkey_patches.rb +180 -123
  118. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_containing_exactly.rb +14 -7
  119. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +21 -13
  120. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +35 -36
  121. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/generic_describable_matcher.rb +19 -0
  122. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +21 -15
  123. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +11 -10
  124. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +11 -10
  125. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/object_having_attributes.rb +14 -7
  126. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb +10 -11
  127. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +13 -9
  128. data/lib/super_diff/rspec/object_inspection.rb +1 -1
  129. data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +11 -10
  130. data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +7 -6
  131. data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +11 -10
  132. data/lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb +22 -17
  133. data/lib/super_diff/rspec/operation_tree_builders.rb +4 -4
  134. data/lib/super_diff/rspec.rb +17 -18
  135. data/lib/super_diff/tiered_lines_elider.rb +87 -115
  136. data/lib/super_diff/tiered_lines_formatter.rb +5 -9
  137. data/lib/super_diff/version.rb +1 -1
  138. data/lib/super_diff.rb +13 -9
  139. data/spec/examples.txt +541 -483
  140. data/spec/integration/rails/active_record_spec.rb +3 -1
  141. data/spec/integration/rails/engines_spec.rb +25 -0
  142. data/spec/integration/rails/hash_with_indifferent_access_spec.rb +3 -1
  143. data/spec/integration/rspec/be_falsey_matcher_spec.rb +40 -35
  144. data/spec/integration/rspec/be_matcher_spec.rb +360 -320
  145. data/spec/integration/rspec/be_nil_matcher_spec.rb +38 -34
  146. data/spec/integration/rspec/be_predicate_matcher_spec.rb +376 -359
  147. data/spec/integration/rspec/be_truthy_matcher_spec.rb +38 -33
  148. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +257 -254
  149. data/spec/integration/rspec/eq_matcher_spec.rb +695 -585
  150. data/spec/integration/rspec/generic_describable_matchers_spec.rb +177 -0
  151. data/spec/integration/rspec/have_attributes_matcher_spec.rb +312 -304
  152. data/spec/integration/rspec/have_predicate_matcher_spec.rb +291 -297
  153. data/spec/integration/rspec/include_matcher_spec.rb +327 -225
  154. data/spec/integration/rspec/magic_metadata_spec.rb +51 -0
  155. data/spec/integration/rspec/match_array_matcher_spec.rb +294 -291
  156. data/spec/integration/rspec/match_matcher_spec.rb +916 -903
  157. data/spec/integration/rspec/raise_error_matcher_spec.rb +1208 -449
  158. data/spec/integration/rspec/respond_to_matcher_spec.rb +702 -697
  159. data/spec/integration/rspec/third_party_matcher_spec.rb +142 -138
  160. data/spec/integration/rspec/unhandled_errors_spec.rb +88 -84
  161. data/spec/internal/log/test.log +0 -0
  162. data/spec/spec_helper.rb +20 -20
  163. data/spec/support/command_runner.rb +34 -57
  164. data/spec/support/integration/helpers.rb +44 -32
  165. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +28 -23
  166. data/spec/support/integration/matchers.rb +34 -0
  167. data/spec/support/integration/test_programs/base.rb +17 -22
  168. data/spec/support/integration/test_programs/plain.rb +6 -0
  169. data/spec/support/integration/test_programs/rspec_active_record.rb +4 -1
  170. data/spec/support/integration/test_programs/rspec_active_support.rb +4 -1
  171. data/spec/support/integration/test_programs/rspec_rails.rb +4 -1
  172. data/spec/support/integration/test_programs/rspec_rails_engine.rb +20 -0
  173. data/spec/support/models/active_record/person.rb +6 -4
  174. data/spec/support/models/active_record/shipping_address.rb +9 -10
  175. data/spec/support/models/customer.rb +2 -4
  176. data/spec/support/models/player.rb +3 -6
  177. data/spec/support/models/shipping_address.rb +4 -13
  178. data/spec/support/shared_examples/active_record.rb +258 -240
  179. data/spec/support/shared_examples/active_support.rb +174 -51
  180. data/spec/support/shared_examples/elided_diffs.rb +447 -423
  181. data/spec/support/shared_examples/hash_with_indifferent_access.rb +500 -464
  182. data/spec/support/shared_examples/key.rb +123 -0
  183. data/spec/support/unit/helpers.rb +1 -3
  184. data/spec/support/unit/matchers/match_output.rb +12 -13
  185. data/spec/unit/active_record/object_inspection_spec.rb +222 -206
  186. data/spec/unit/active_support/object_inspection_spec.rb +170 -0
  187. data/spec/unit/equality_matchers/main_spec.rb +1049 -984
  188. data/spec/unit/helpers_spec.rb +14 -21
  189. data/spec/unit/operation_tree_flatteners/array_spec.rb +557 -524
  190. data/spec/unit/operation_tree_flatteners/custom_object_spec.rb +619 -601
  191. data/spec/unit/operation_tree_flatteners/default_object_spec.rb +619 -621
  192. data/spec/unit/operation_tree_flatteners/hash_spec.rb +595 -556
  193. data/spec/unit/operation_tree_flatteners/multiline_string_spec.rb +102 -92
  194. data/spec/unit/rspec/matchers/be_compared_to_spec.rb +3 -3
  195. data/spec/unit/rspec/matchers/be_predicate_spec.rb +3 -3
  196. data/spec/unit/rspec/matchers/contain_exactly_spec.rb +1 -1
  197. data/spec/unit/rspec/matchers/have_attributes_spec.rb +1 -1
  198. data/spec/unit/rspec/matchers/have_predicate_spec.rb +2 -2
  199. data/spec/unit/rspec/matchers/include_spec.rb +2 -2
  200. data/spec/unit/rspec/matchers/match_array_spec.rb +2 -2
  201. data/spec/unit/rspec/matchers/raise_error_spec.rb +43 -11
  202. data/spec/unit/rspec/matchers/respond_to_spec.rb +23 -16
  203. data/spec/unit/rspec/object_inspection/rspec_matcher_spec.rb +91 -0
  204. data/spec/unit/rspec/object_inspection_spec.rb +351 -326
  205. data/spec/unit/super_diff_spec.rb +1594 -1437
  206. data/spec/unit/tiered_lines_elider_spec.rb +3508 -3536
  207. data/spec/unit/tiered_lines_formatter_spec.rb +54 -116
  208. data/super_diff.gemspec +13 -12
  209. metadata +88 -75
  210. data/lib/super_diff/errors/no_diff_formatter_available_error.rb +0 -21
  211. data/lib/super_diff/errors/no_operational_sequencer_available_error.rb +0 -22
  212. data/spec/tmp/warnings_logger/all_warnings.txt +0 -2
@@ -4,51 +4,55 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
4
4
  context "when comparing two different integers" do
5
5
  it "produces the correct failure message when used in the positive" do
6
6
  as_both_colored_and_uncolored do |color_enabled|
7
- snippet = %|expect(1).to eq(42)|
7
+ snippet = "expect(1).to eq(42)"
8
8
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
9
9
 
10
- expected_output = build_expected_output(
11
- color_enabled: color_enabled,
12
- snippet: snippet,
13
- expectation: proc {
14
- line do
15
- plain %|Expected |
16
- actual %|1|
17
- plain %| to eq |
18
- expected %|42|
19
- plain %|.|
20
- end
21
- },
22
- )
10
+ expected_output =
11
+ build_expected_output(
12
+ color_enabled: color_enabled,
13
+ snippet: snippet,
14
+ expectation:
15
+ proc do
16
+ line do
17
+ plain "Expected "
18
+ actual "1"
19
+ plain " to eq "
20
+ expected "42"
21
+ plain "."
22
+ end
23
+ end
24
+ )
23
25
 
24
- expect(program).
25
- to produce_output_when_run(expected_output).
26
- in_color(color_enabled)
26
+ expect(program).to produce_output_when_run(expected_output).in_color(
27
+ color_enabled
28
+ )
27
29
  end
28
30
  end
29
31
 
30
32
  it "produces the correct failure message when used in the negative" do
31
33
  as_both_colored_and_uncolored do |color_enabled|
32
- snippet = %|expect(42).not_to eq(42)|
34
+ snippet = "expect(42).not_to eq(42)"
33
35
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
34
36
 
35
- expected_output = build_expected_output(
36
- color_enabled: color_enabled,
37
- snippet: snippet,
38
- expectation: proc {
39
- line do
40
- plain %|Expected |
41
- actual %|42|
42
- plain %| not to eq |
43
- expected %|42|
44
- plain %|.|
45
- end
46
- },
47
- )
37
+ expected_output =
38
+ build_expected_output(
39
+ color_enabled: color_enabled,
40
+ snippet: snippet,
41
+ expectation:
42
+ proc do
43
+ line do
44
+ plain "Expected "
45
+ actual "42"
46
+ plain " not to eq "
47
+ expected "42"
48
+ plain "."
49
+ end
50
+ end
51
+ )
48
52
 
49
- expect(program).
50
- to produce_output_when_run(expected_output).
51
- in_color(color_enabled)
53
+ expect(program).to produce_output_when_run(expected_output).in_color(
54
+ color_enabled
55
+ )
52
56
  end
53
57
  end
54
58
  end
@@ -56,57 +60,55 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
56
60
  context "when comparing two different symbols" do
57
61
  it "produces the correct failure message when used in the positive" do
58
62
  as_both_colored_and_uncolored do |color_enabled|
59
- snippet = %|expect(:bar).to eq(:foo)|
60
- program = make_plain_test_program(
61
- snippet,
62
- color_enabled: color_enabled,
63
- )
63
+ snippet = "expect(:bar).to eq(:foo)"
64
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
64
65
 
65
- expected_output = build_expected_output(
66
- color_enabled: color_enabled,
67
- snippet: snippet,
68
- expectation: proc {
69
- line do
70
- plain %|Expected |
71
- actual %|:bar|
72
- plain %| to eq |
73
- expected %|:foo|
74
- plain %|.|
75
- end
76
- },
77
- )
66
+ expected_output =
67
+ build_expected_output(
68
+ color_enabled: color_enabled,
69
+ snippet: snippet,
70
+ expectation:
71
+ proc do
72
+ line do
73
+ plain "Expected "
74
+ actual ":bar"
75
+ plain " to eq "
76
+ expected ":foo"
77
+ plain "."
78
+ end
79
+ end
80
+ )
78
81
 
79
- expect(program).
80
- to produce_output_when_run(expected_output).
81
- in_color(color_enabled)
82
+ expect(program).to produce_output_when_run(expected_output).in_color(
83
+ color_enabled
84
+ )
82
85
  end
83
86
  end
84
87
 
85
88
  it "produces the correct failure message when used in the negative" do
86
89
  as_both_colored_and_uncolored do |color_enabled|
87
- snippet = %|expect(:foo).not_to eq(:foo)|
88
- program = make_plain_test_program(
89
- snippet,
90
- color_enabled: color_enabled,
91
- )
90
+ snippet = "expect(:foo).not_to eq(:foo)"
91
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
92
92
 
93
- expected_output = build_expected_output(
94
- color_enabled: color_enabled,
95
- snippet: snippet,
96
- expectation: proc {
97
- line do
98
- plain %|Expected |
99
- actual %|:foo|
100
- plain %| not to eq |
101
- expected %|:foo|
102
- plain %|.|
103
- end
104
- },
105
- )
93
+ expected_output =
94
+ build_expected_output(
95
+ color_enabled: color_enabled,
96
+ snippet: snippet,
97
+ expectation:
98
+ proc do
99
+ line do
100
+ plain "Expected "
101
+ actual ":foo"
102
+ plain " not to eq "
103
+ expected ":foo"
104
+ plain "."
105
+ end
106
+ end
107
+ )
106
108
 
107
- expect(program).
108
- to produce_output_when_run(expected_output).
109
- in_color(color_enabled)
109
+ expect(program).to produce_output_when_run(expected_output).in_color(
110
+ color_enabled
111
+ )
110
112
  end
111
113
  end
112
114
  end
@@ -115,56 +117,54 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
115
117
  it "produces the correct failure message when used in the positive" do
116
118
  as_both_colored_and_uncolored do |color_enabled|
117
119
  snippet = %|expect("Jennifer").to eq("Marty")|
118
- program = make_plain_test_program(
119
- snippet,
120
- color_enabled: color_enabled,
121
- )
120
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
122
121
 
123
- expected_output = build_expected_output(
124
- color_enabled: color_enabled,
125
- snippet: %|expect("Jennifer").to eq("Marty")|,
126
- expectation: proc {
127
- line do
128
- plain %|Expected |
129
- actual %|"Jennifer"|
130
- plain %| to eq |
131
- expected %|"Marty"|
132
- plain %|.|
133
- end
134
- },
135
- )
122
+ expected_output =
123
+ build_expected_output(
124
+ color_enabled: color_enabled,
125
+ snippet: %|expect("Jennifer").to eq("Marty")|,
126
+ expectation:
127
+ proc do
128
+ line do
129
+ plain "Expected "
130
+ actual %|"Jennifer"|
131
+ plain " to eq "
132
+ expected %|"Marty"|
133
+ plain "."
134
+ end
135
+ end
136
+ )
136
137
 
137
- expect(program).
138
- to produce_output_when_run(expected_output).
139
- in_color(color_enabled)
138
+ expect(program).to produce_output_when_run(expected_output).in_color(
139
+ color_enabled
140
+ )
140
141
  end
141
142
  end
142
143
 
143
144
  it "produces the correct failure message when used in the negative" do
144
145
  as_both_colored_and_uncolored do |color_enabled|
145
146
  snippet = %|expect("Jennifer").not_to eq("Jennifer")|
146
- program = make_plain_test_program(
147
- snippet,
148
- color_enabled: color_enabled,
149
- )
147
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
150
148
 
151
- expected_output = build_expected_output(
152
- color_enabled: color_enabled,
153
- snippet: %|expect("Jennifer").not_to eq("Jennifer")|,
154
- expectation: proc {
155
- line do
156
- plain %|Expected |
157
- actual %|"Jennifer"|
158
- plain %| not to eq |
159
- expected %|"Jennifer"|
160
- plain %|.|
161
- end
162
- },
163
- )
149
+ expected_output =
150
+ build_expected_output(
151
+ color_enabled: color_enabled,
152
+ snippet: %|expect("Jennifer").not_to eq("Jennifer")|,
153
+ expectation:
154
+ proc do
155
+ line do
156
+ plain "Expected "
157
+ actual %|"Jennifer"|
158
+ plain " not to eq "
159
+ expected %|"Jennifer"|
160
+ plain "."
161
+ end
162
+ end
163
+ )
164
164
 
165
- expect(program).
166
- to produce_output_when_run(expected_output).
167
- in_color(color_enabled)
165
+ expect(program).to produce_output_when_run(expected_output).in_color(
166
+ color_enabled
167
+ )
168
168
  end
169
169
  end
170
170
  end
@@ -173,48 +173,48 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
173
173
  it "produces the correct failure message when used in the positive" do
174
174
  as_both_colored_and_uncolored do |color_enabled|
175
175
  snippet = <<~RUBY
176
- expected = Time.utc(2011, 12, 13, 14, 15, 16)
177
- actual = Time.utc(2011, 12, 13, 14, 15, 16, 500_000)
178
- expect(expected).to eq(actual)
176
+ actual = Time.utc(2011, 12, 13, 14, 15, 16)
177
+ expected = Time.utc(2011, 12, 13, 14, 15, 16, 500_000)
178
+ expect(actual).to eq(expected)
179
179
  RUBY
180
- program = make_plain_test_program(
181
- snippet,
182
- color_enabled: color_enabled,
183
- )
180
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
184
181
 
185
- expected_output = build_expected_output(
186
- color_enabled: color_enabled,
187
- snippet: %|expect(expected).to eq(actual)|,
188
- expectation: proc {
189
- line do
190
- plain %|Expected |
191
- actual %|#<Time 2011-12-13 14:15:16 +00:00 (UTC)>|
192
- end
193
-
194
- line do
195
- plain %| to eq |
196
- expected %|#<Time 2011-12-13 14:15:16+(1/2) +00:00 (UTC)>|
197
- end
198
- },
199
- diff: proc {
200
- plain_line " #<Time {"
201
- plain_line " year: 2011,"
202
- plain_line " month: 12,"
203
- plain_line " day: 13,"
204
- plain_line " hour: 14,"
205
- plain_line " min: 15,"
206
- plain_line " sec: 16,"
207
- expected_line "- subsec: (1/2),"
208
- actual_line "+ subsec: 0,"
209
- plain_line " zone: \"UTC\","
210
- plain_line " utc_offset: 0"
211
- plain_line " }>"
212
- },
213
- )
182
+ expected_output =
183
+ build_expected_output(
184
+ color_enabled: color_enabled,
185
+ snippet: "expect(actual).to eq(expected)",
186
+ expectation:
187
+ proc do
188
+ line do
189
+ plain "Expected "
190
+ actual "#<Time 2011-12-13 14:15:16 +00:00 (UTC)>"
191
+ end
192
+
193
+ line do
194
+ plain " to eq "
195
+ expected "#<Time 2011-12-13 14:15:16+(1/2) +00:00 (UTC)>"
196
+ end
197
+ end,
198
+ diff:
199
+ proc do
200
+ plain_line " #<Time {"
201
+ plain_line " year: 2011,"
202
+ plain_line " month: 12,"
203
+ plain_line " day: 13,"
204
+ plain_line " hour: 14,"
205
+ plain_line " min: 15,"
206
+ plain_line " sec: 16,"
207
+ expected_line "- subsec: (1/2),"
208
+ actual_line "+ subsec: 0,"
209
+ plain_line " zone: \"UTC\","
210
+ plain_line " utc_offset: 0"
211
+ plain_line " }>"
212
+ end
213
+ )
214
214
 
215
- expect(program).
216
- to produce_output_when_run(expected_output).
217
- in_color(color_enabled)
215
+ expect(program).to produce_output_when_run(expected_output).in_color(
216
+ color_enabled
217
+ )
218
218
  end
219
219
  end
220
220
 
@@ -224,31 +224,102 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
224
224
  time = Time.utc(2011, 12, 13, 14, 15, 16)
225
225
  expect(time).not_to eq(time)
226
226
  RUBY
227
- program = make_plain_test_program(
228
- snippet,
229
- color_enabled: color_enabled,
227
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
228
+
229
+ expected_output =
230
+ build_expected_output(
231
+ color_enabled: color_enabled,
232
+ snippet: "expect(time).not_to eq(time)",
233
+ newline_before_expectation: true,
234
+ expectation:
235
+ proc do
236
+ line do
237
+ plain " Expected "
238
+ actual "#<Time 2011-12-13 14:15:16 +00:00 (UTC)>"
239
+ end
240
+
241
+ line do
242
+ plain "not to eq "
243
+ expected "#<Time 2011-12-13 14:15:16 +00:00 (UTC)>"
244
+ end
245
+ end
246
+ )
247
+
248
+ expect(program).to produce_output_when_run(expected_output).in_color(
249
+ color_enabled
230
250
  )
251
+ end
252
+ end
253
+ end
254
+
255
+ context "when comparing two different Date instances" do
256
+ it "produces the correct failure message when used in the positive" do
257
+ as_both_colored_and_uncolored do |color_enabled|
258
+ snippet = <<~RUBY
259
+ actual = Date.new(2023, 10, 14)
260
+ expected = Date.new(2023, 10, 31)
261
+ expect(actual).to eq(expected)
262
+ RUBY
263
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
231
264
 
232
- expected_output = build_expected_output(
233
- color_enabled: color_enabled,
234
- snippet: %|expect(time).not_to eq(time)|,
235
- newline_before_expectation: true,
236
- expectation: proc {
237
- line do
238
- plain %| Expected |
239
- actual %|#<Time 2011-12-13 14:15:16 +00:00 (UTC)>|
240
- end
241
-
242
- line do
243
- plain %|not to eq |
244
- expected %|#<Time 2011-12-13 14:15:16 +00:00 (UTC)>|
245
- end
246
- },
265
+ expected_output =
266
+ build_expected_output(
267
+ color_enabled: color_enabled,
268
+ snippet: "expect(actual).to eq(expected)",
269
+ expectation:
270
+ proc do
271
+ line do
272
+ plain "Expected "
273
+ actual "#<Date 2023-10-14>"
274
+ plain " to eq "
275
+ expected "#<Date 2023-10-31>"
276
+ plain "."
277
+ end
278
+ end,
279
+ diff:
280
+ proc do
281
+ plain_line " #<Date {"
282
+ plain_line " year: 2023,"
283
+ plain_line " month: 10,"
284
+ expected_line "- day: 31"
285
+ actual_line "+ day: 14"
286
+ plain_line " }>"
287
+ end
288
+ )
289
+
290
+ expect(program).to produce_output_when_run(expected_output).in_color(
291
+ color_enabled
247
292
  )
293
+ end
294
+ end
248
295
 
249
- expect(program).
250
- to produce_output_when_run(expected_output).
251
- in_color(color_enabled)
296
+ it "produces the correct failure message when used in the negative" do
297
+ as_both_colored_and_uncolored do |color_enabled|
298
+ snippet = <<~RUBY
299
+ date = Date.new(2023, 10, 14)
300
+ expect(date).not_to eq(date)
301
+ RUBY
302
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
303
+
304
+ expected_output =
305
+ build_expected_output(
306
+ color_enabled: color_enabled,
307
+ snippet: "expect(date).not_to eq(date)",
308
+ expectation:
309
+ proc do
310
+ line do
311
+ plain "Expected "
312
+ actual "#<Date 2023-10-14>"
313
+ plain " not to eq "
314
+ expected "#<Date 2023-10-14>"
315
+ plain "."
316
+ end
317
+ end
318
+ )
319
+
320
+ expect(program).to produce_output_when_run(expected_output).in_color(
321
+ color_enabled
322
+ )
252
323
  end
253
324
  end
254
325
  end
@@ -257,34 +328,37 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
257
328
  it "produces the correct failure message" do
258
329
  as_both_colored_and_uncolored do |color_enabled|
259
330
  snippet = <<~TEST.strip
331
+ actual = "This is a line\\nAnd that's another line\\n"
260
332
  expected = "Something entirely different"
261
- actual = "This is a line\\nAnd that's another line\\n"
262
333
  expect(actual).to eq(expected)
263
334
  TEST
264
335
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
265
336
 
266
- expected_output = build_expected_output(
267
- color_enabled: color_enabled,
268
- snippet: %|expect(actual).to eq(expected)|,
269
- expectation: proc {
270
- line do
271
- plain %|Expected |
272
- actual %|"This is a line\\nAnd that's another line\\n"|
273
- plain %| to eq |
274
- expected %|"Something entirely different"|
275
- plain %|.|
276
- end
277
- },
278
- diff: proc {
279
- expected_line %|- Something entirely different|
280
- actual_line %|+ This is a line\\n|
281
- actual_line %|+ And that's another line\\n|
282
- },
283
- )
337
+ expected_output =
338
+ build_expected_output(
339
+ color_enabled: color_enabled,
340
+ snippet: "expect(actual).to eq(expected)",
341
+ expectation:
342
+ proc do
343
+ line do
344
+ plain "Expected "
345
+ actual %|"This is a line\\nAnd that's another line\\n"|
346
+ plain " to eq "
347
+ expected %|"Something entirely different"|
348
+ plain "."
349
+ end
350
+ end,
351
+ diff:
352
+ proc do
353
+ expected_line "- Something entirely different"
354
+ actual_line %|+ This is a line\\n|
355
+ actual_line %|+ And that's another line\\n|
356
+ end
357
+ )
284
358
 
285
- expect(program).
286
- to produce_output_when_run(expected_output).
287
- in_color(color_enabled)
359
+ expect(program).to produce_output_when_run(expected_output).in_color(
360
+ color_enabled
361
+ )
288
362
  end
289
363
  end
290
364
  end
@@ -293,34 +367,37 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
293
367
  it "produces the correct failure message" do
294
368
  as_both_colored_and_uncolored do |color_enabled|
295
369
  snippet = <<~TEST.strip
370
+ actual = "Something entirely different"
296
371
  expected = "This is a line\\nAnd that's another line\\n"
297
- actual = "Something entirely different"
298
372
  expect(actual).to eq(expected)
299
373
  TEST
300
374
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
301
375
 
302
- expected_output = build_expected_output(
303
- color_enabled: color_enabled,
304
- snippet: %|expect(actual).to eq(expected)|,
305
- expectation: proc {
306
- line do
307
- plain %|Expected |
308
- actual %|"Something entirely different"|
309
- plain %| to eq |
310
- expected %|"This is a line\\nAnd that's another line\\n"|
311
- plain %|.|
312
- end
313
- },
314
- diff: proc {
315
- expected_line %|- This is a line\\n|
316
- expected_line %|- And that's another line\\n|
317
- actual_line %|+ Something entirely different|
318
- },
319
- )
376
+ expected_output =
377
+ build_expected_output(
378
+ color_enabled: color_enabled,
379
+ snippet: "expect(actual).to eq(expected)",
380
+ expectation:
381
+ proc do
382
+ line do
383
+ plain "Expected "
384
+ actual %|"Something entirely different"|
385
+ plain " to eq "
386
+ expected %|"This is a line\\nAnd that's another line\\n"|
387
+ plain "."
388
+ end
389
+ end,
390
+ diff:
391
+ proc do
392
+ expected_line %|- This is a line\\n|
393
+ expected_line %|- And that's another line\\n|
394
+ actual_line "+ Something entirely different"
395
+ end
396
+ )
320
397
 
321
- expect(program).
322
- to produce_output_when_run(expected_output).
323
- in_color(color_enabled)
398
+ expect(program).to produce_output_when_run(expected_output).in_color(
399
+ color_enabled
400
+ )
324
401
  end
325
402
  end
326
403
  end
@@ -329,37 +406,40 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
329
406
  it "produces the correct failure message when used in the positive" do
330
407
  as_both_colored_and_uncolored do |color_enabled|
331
408
  snippet = <<~TEST.strip
409
+ actual = "This is a line\\nSomething completely different\\nAnd there's a line too\\n"
332
410
  expected = "This is a line\\nAnd that's a line\\nAnd there's a line too\\n"
333
- actual = "This is a line\\nSomething completely different\\nAnd there's a line too\\n"
334
411
  expect(actual).to eq(expected)
335
412
  TEST
336
413
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
337
414
 
338
- expected_output = build_expected_output(
339
- color_enabled: color_enabled,
340
- snippet: %|expect(actual).to eq(expected)|,
341
- expectation: proc {
342
- line do
343
- plain %|Expected |
344
- actual %|"This is a line\\nSomething completely different\\nAnd there's a line too\\n"|
345
- end
346
-
347
- line do
348
- plain %| to eq |
349
- expected %|"This is a line\\nAnd that's a line\\nAnd there's a line too\\n"|
350
- end
351
- },
352
- diff: proc {
353
- plain_line %| This is a line\\n|
354
- expected_line %|- And that's a line\\n|
355
- actual_line %|+ Something completely different\\n|
356
- plain_line %| And there's a line too\\n|
357
- },
358
- )
415
+ expected_output =
416
+ build_expected_output(
417
+ color_enabled: color_enabled,
418
+ snippet: "expect(actual).to eq(expected)",
419
+ expectation:
420
+ proc do
421
+ line do
422
+ plain "Expected "
423
+ actual %|"This is a line\\nSomething completely different\\nAnd there's a line too\\n"|
424
+ end
425
+
426
+ line do
427
+ plain " to eq "
428
+ expected %|"This is a line\\nAnd that's a line\\nAnd there's a line too\\n"|
429
+ end
430
+ end,
431
+ diff:
432
+ proc do
433
+ plain_line %| This is a line\\n|
434
+ expected_line %|- And that's a line\\n|
435
+ actual_line %|+ Something completely different\\n|
436
+ plain_line %| And there's a line too\\n|
437
+ end
438
+ )
359
439
 
360
- expect(program).
361
- to produce_output_when_run(expected_output).
362
- in_color(color_enabled)
440
+ expect(program).to produce_output_when_run(expected_output).in_color(
441
+ color_enabled
442
+ )
363
443
  end
364
444
  end
365
445
 
@@ -371,26 +451,28 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
371
451
  TEST
372
452
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
373
453
 
374
- expected_output = build_expected_output(
375
- color_enabled: color_enabled,
376
- snippet: %|expect(string).not_to eq(string)|,
377
- newline_before_expectation: true,
378
- expectation: proc {
379
- line do
380
- plain %| Expected |
381
- actual %|"This is a line\\nAnd that's a line\\nAnd there's a line too\\n"|
382
- end
383
-
384
- line do
385
- plain %|not to eq |
386
- expected %|"This is a line\\nAnd that's a line\\nAnd there's a line too\\n"|
387
- end
388
- },
389
- )
454
+ expected_output =
455
+ build_expected_output(
456
+ color_enabled: color_enabled,
457
+ snippet: "expect(string).not_to eq(string)",
458
+ newline_before_expectation: true,
459
+ expectation:
460
+ proc do
461
+ line do
462
+ plain " Expected "
463
+ actual %|"This is a line\\nAnd that's a line\\nAnd there's a line too\\n"|
464
+ end
465
+
466
+ line do
467
+ plain "not to eq "
468
+ expected %|"This is a line\\nAnd that's a line\\nAnd there's a line too\\n"|
469
+ end
470
+ end
471
+ )
390
472
 
391
- expect(program).
392
- to produce_output_when_run(expected_output).
393
- in_color(color_enabled)
473
+ expect(program).to produce_output_when_run(expected_output).in_color(
474
+ color_enabled
475
+ )
394
476
  end
395
477
  end
396
478
  end
@@ -399,20 +481,7 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
399
481
  it "produces the correct failure message when used in the positive" do
400
482
  as_both_colored_and_uncolored do |color_enabled|
401
483
  snippet = <<~TEST
402
- expected = [
403
- [
404
- :h1,
405
- [:span, [:text, "Hello world"]],
406
- {
407
- class: "header",
408
- data: {
409
- "sticky" => true,
410
- person: SuperDiff::Test::Person.new(name: "Marty", age: 60)
411
- }
412
- }
413
- ]
414
- ]
415
- actual = [
484
+ actual = [
416
485
  [
417
486
  :h2,
418
487
  [:span, [:text, "Goodbye world"]],
@@ -428,60 +497,76 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
428
497
  ],
429
498
  :br
430
499
  ]
500
+ expected = [
501
+ [
502
+ :h1,
503
+ [:span, [:text, "Hello world"]],
504
+ {
505
+ class: "header",
506
+ data: {
507
+ "sticky" => true,
508
+ person: SuperDiff::Test::Person.new(name: "Marty", age: 60)
509
+ }
510
+ }
511
+ ]
512
+ ]
431
513
  expect(actual).to eq(expected)
432
514
  TEST
433
515
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
434
516
 
435
- expected_output = build_expected_output(
436
- color_enabled: color_enabled,
437
- snippet: %|expect(actual).to eq(expected)|,
438
- expectation: proc {
439
- line do
440
- plain %|Expected |
441
- actual %|[[:h2, [:span, [:text, "Goodbye world"]], { id: "hero", class: "header", data: { "sticky" => false, :role => "deprecated", :person => #<SuperDiff::Test::Person name: "Doc", age: 60> } }], :br]|
442
- end
443
-
444
- line do
445
- plain %| to eq |
446
- expected %|[[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true, :person => #<SuperDiff::Test::Person name: "Marty", age: 60> } }]]|
447
- end
448
- },
449
- diff: proc {
450
- plain_line %| [|
451
- plain_line %| [|
452
- expected_line %|- :h1,|
453
- actual_line %|+ :h2,|
454
- plain_line %| [|
455
- plain_line %| :span,|
456
- plain_line %| [|
457
- plain_line %| :text,|
458
- expected_line %|- "Hello world"|
459
- actual_line %|+ "Goodbye world"|
460
- plain_line %| ]|
461
- plain_line %| ],|
462
- plain_line %| {|
463
- actual_line %|+ id: "hero",|
464
- plain_line %| class: "header",|
465
- plain_line %| data: {|
466
- expected_line %|- "sticky" => true,|
467
- actual_line %|+ "sticky" => false,|
468
- actual_line %|+ :role => "deprecated",|
469
- plain_line %| :person => #<SuperDiff::Test::Person {|
470
- expected_line %|- name: "Marty",|
471
- actual_line %|+ name: "Doc",|
472
- plain_line %| age: 60|
473
- plain_line %| }>|
474
- plain_line %| }|
475
- plain_line %| }|
476
- plain_line %| ],|
477
- actual_line %|+ :br|
478
- plain_line %| ]|
479
- },
480
- )
517
+ expected_output =
518
+ build_expected_output(
519
+ color_enabled: color_enabled,
520
+ snippet: "expect(actual).to eq(expected)",
521
+ expectation:
522
+ proc do
523
+ line do
524
+ plain "Expected "
525
+ actual %|[[:h2, [:span, [:text, "Goodbye world"]], { id: "hero", class: "header", data: { "sticky" => false, :role => "deprecated", :person => #<SuperDiff::Test::Person name: "Doc", age: 60> } }], :br]|
526
+ end
527
+
528
+ line do
529
+ plain " to eq "
530
+ expected %|[[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true, :person => #<SuperDiff::Test::Person name: "Marty", age: 60> } }]]|
531
+ end
532
+ end,
533
+ diff:
534
+ proc do
535
+ plain_line " ["
536
+ plain_line " ["
537
+ expected_line "- :h1,"
538
+ actual_line "+ :h2,"
539
+ plain_line " ["
540
+ plain_line " :span,"
541
+ plain_line " ["
542
+ plain_line " :text,"
543
+ expected_line %|- "Hello world"|
544
+ actual_line %|+ "Goodbye world"|
545
+ plain_line " ]"
546
+ plain_line " ],"
547
+ plain_line " {"
548
+ actual_line %|+ id: "hero",|
549
+ plain_line %| class: "header",|
550
+ plain_line " data: {"
551
+ expected_line %|- "sticky" => true,|
552
+ actual_line %|+ "sticky" => false,|
553
+ actual_line %|+ :role => "deprecated",|
554
+ plain_line " :person => #<SuperDiff::Test::Person {"
555
+ expected_line %|- name: "Marty",|
556
+ actual_line %|+ name: "Doc",|
557
+ plain_line " age: 60"
558
+ plain_line " }>"
559
+ plain_line " }"
560
+ plain_line " }"
561
+ plain_line " ],"
562
+ actual_line "+ :br"
563
+ plain_line " ]"
564
+ end
565
+ )
481
566
 
482
- expect(program).
483
- to produce_output_when_run(expected_output).
484
- in_color(color_enabled)
567
+ expect(program).to produce_output_when_run(expected_output).in_color(
568
+ color_enabled
569
+ )
485
570
  end
486
571
  end
487
572
 
@@ -505,26 +590,28 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
505
590
  TEST
506
591
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
507
592
 
508
- expected_output = build_expected_output(
509
- color_enabled: color_enabled,
510
- snippet: %|expect(value).not_to eq(value)|,
511
- newline_before_expectation: true,
512
- expectation: proc {
513
- line do
514
- plain %| Expected |
515
- actual %|[[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true, :person => #<SuperDiff::Test::Person name: "Marty", age: 60> } }]]|
516
- end
517
-
518
- line do
519
- plain %|not to eq |
520
- expected %|[[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true, :person => #<SuperDiff::Test::Person name: "Marty", age: 60> } }]]|
521
- end
522
- },
523
- )
593
+ expected_output =
594
+ build_expected_output(
595
+ color_enabled: color_enabled,
596
+ snippet: "expect(value).not_to eq(value)",
597
+ newline_before_expectation: true,
598
+ expectation:
599
+ proc do
600
+ line do
601
+ plain " Expected "
602
+ actual %|[[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true, :person => #<SuperDiff::Test::Person name: "Marty", age: 60> } }]]|
603
+ end
604
+
605
+ line do
606
+ plain "not to eq "
607
+ expected %|[[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true, :person => #<SuperDiff::Test::Person name: "Marty", age: 60> } }]]|
608
+ end
609
+ end
610
+ )
524
611
 
525
- expect(program).
526
- to produce_output_when_run(expected_output).
527
- in_color(color_enabled)
612
+ expect(program).to produce_output_when_run(expected_output).in_color(
613
+ color_enabled
614
+ )
528
615
  end
529
616
  end
530
617
  end
@@ -533,11 +620,11 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
533
620
  it "produces the correct failure message when used in the positive" do
534
621
  as_both_colored_and_uncolored do |color_enabled|
535
622
  snippet = <<~TEST.strip
536
- expected = {
623
+ actual = {
537
624
  customer: {
538
- person: SuperDiff::Test::Person.new(name: "Marty McFly", age: 17),
625
+ person: SuperDiff::Test::Person.new(name: "Marty McFly, Jr.", age: 17),
539
626
  shipping_address: {
540
- line_1: "123 Main St.",
627
+ line_1: "456 Ponderosa Ct.",
541
628
  city: "Hill Valley",
542
629
  state: "CA",
543
630
  zip: "90382"
@@ -549,14 +636,14 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
549
636
  cost: 100_000,
550
637
  options: ["red", "blue", "green"]
551
638
  },
552
- { name: "Chevy 4x4" }
639
+ { name: "Mattel Hoverboard" }
553
640
  ]
554
641
  }
555
- actual = {
642
+ expected = {
556
643
  customer: {
557
- person: SuperDiff::Test::Person.new(name: "Marty McFly, Jr.", age: 17),
644
+ person: SuperDiff::Test::Person.new(name: "Marty McFly", age: 17),
558
645
  shipping_address: {
559
- line_1: "456 Ponderosa Ct.",
646
+ line_1: "123 Main St.",
560
647
  city: "Hill Valley",
561
648
  state: "CA",
562
649
  zip: "90382"
@@ -568,65 +655,68 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
568
655
  cost: 100_000,
569
656
  options: ["red", "blue", "green"]
570
657
  },
571
- { name: "Mattel Hoverboard" }
658
+ { name: "Chevy 4x4" }
572
659
  ]
573
660
  }
574
661
  expect(actual).to eq(expected)
575
662
  TEST
576
663
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
577
664
 
578
- expected_output = build_expected_output(
579
- color_enabled: color_enabled,
580
- snippet: %|expect(actual).to eq(expected)|,
581
- expectation: proc {
582
- line do
583
- plain %|Expected |
584
- actual %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly, Jr.", age: 17>, shipping_address: { line_1: "456 Ponderosa Ct.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Mattel Hoverboard" }] }|
585
- end
586
-
587
- line do
588
- plain %| to eq |
589
- expected %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly", age: 17>, shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] }|
590
- end
591
- },
592
- diff: proc {
593
- plain_line %| {|
594
- plain_line %| customer: {|
595
- plain_line %| person: #<SuperDiff::Test::Person {|
596
- expected_line %|- name: "Marty McFly",|
597
- actual_line %|+ name: "Marty McFly, Jr.",|
598
- plain_line %| age: 17|
599
- plain_line %| }>,|
600
- plain_line %| shipping_address: {|
601
- expected_line %|- line_1: "123 Main St.",|
602
- actual_line %|+ line_1: "456 Ponderosa Ct.",|
603
- plain_line %| city: "Hill Valley",|
604
- plain_line %| state: "CA",|
605
- plain_line %| zip: "90382"|
606
- plain_line %| }|
607
- plain_line %| },|
608
- plain_line %| items: [|
609
- plain_line %| {|
610
- plain_line %| name: "Fender Stratocaster",|
611
- plain_line %| cost: 100000,|
612
- plain_line %| options: [|
613
- plain_line %| "red",|
614
- plain_line %| "blue",|
615
- plain_line %| "green"|
616
- plain_line %| ]|
617
- plain_line %| },|
618
- plain_line %| {|
619
- expected_line %|- name: "Chevy 4x4"|
620
- actual_line %|+ name: "Mattel Hoverboard"|
621
- plain_line %| }|
622
- plain_line %| ]|
623
- plain_line %| }|
624
- },
625
- )
665
+ expected_output =
666
+ build_expected_output(
667
+ color_enabled: color_enabled,
668
+ snippet: "expect(actual).to eq(expected)",
669
+ expectation:
670
+ proc do
671
+ line do
672
+ plain "Expected "
673
+ actual %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly, Jr.", age: 17>, shipping_address: { line_1: "456 Ponderosa Ct.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Mattel Hoverboard" }] }|
674
+ end
675
+
676
+ line do
677
+ plain " to eq "
678
+ expected %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly", age: 17>, shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] }|
679
+ end
680
+ end,
681
+ diff:
682
+ proc do
683
+ plain_line " {"
684
+ plain_line " customer: {"
685
+ plain_line " person: #<SuperDiff::Test::Person {"
686
+ expected_line %|- name: "Marty McFly",|
687
+ actual_line %|+ name: "Marty McFly, Jr.",|
688
+ plain_line " age: 17"
689
+ plain_line " }>,"
690
+ plain_line " shipping_address: {"
691
+ expected_line %|- line_1: "123 Main St.",|
692
+ actual_line %|+ line_1: "456 Ponderosa Ct.",|
693
+ plain_line %| city: "Hill Valley",|
694
+ plain_line %| state: "CA",|
695
+ plain_line %| zip: "90382"|
696
+ plain_line " }"
697
+ plain_line " },"
698
+ plain_line " items: ["
699
+ plain_line " {"
700
+ plain_line %| name: "Fender Stratocaster",|
701
+ plain_line " cost: 100000,"
702
+ plain_line " options: ["
703
+ plain_line %| "red",|
704
+ plain_line %| "blue",|
705
+ plain_line %| "green"|
706
+ plain_line " ]"
707
+ plain_line " },"
708
+ plain_line " {"
709
+ expected_line %|- name: "Chevy 4x4"|
710
+ actual_line %|+ name: "Mattel Hoverboard"|
711
+ plain_line " }"
712
+ plain_line " ]"
713
+ plain_line " }"
714
+ end
715
+ )
626
716
 
627
- expect(program).
628
- to produce_output_when_run(expected_output).
629
- in_color(color_enabled)
717
+ expect(program).to produce_output_when_run(expected_output).in_color(
718
+ color_enabled
719
+ )
630
720
  end
631
721
  end
632
722
 
@@ -656,26 +746,28 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
656
746
  TEST
657
747
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
658
748
 
659
- expected_output = build_expected_output(
660
- color_enabled: color_enabled,
661
- snippet: %|expect(value).not_to eq(value)|,
662
- newline_before_expectation: true,
663
- expectation: proc {
664
- line do
665
- plain %| Expected |
666
- actual %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly", age: 17>, shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] }|
667
- end
668
-
669
- line do
670
- plain %|not to eq |
671
- expected %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly", age: 17>, shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] }|
672
- end
673
- },
674
- )
749
+ expected_output =
750
+ build_expected_output(
751
+ color_enabled: color_enabled,
752
+ snippet: "expect(value).not_to eq(value)",
753
+ newline_before_expectation: true,
754
+ expectation:
755
+ proc do
756
+ line do
757
+ plain " Expected "
758
+ actual %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly", age: 17>, shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] }|
759
+ end
760
+
761
+ line do
762
+ plain "not to eq "
763
+ expected %|{ customer: { person: #<SuperDiff::Test::Person name: "Marty McFly", age: 17>, shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] }|
764
+ end
765
+ end
766
+ )
675
767
 
676
- expect(program).
677
- to produce_output_when_run(expected_output).
678
- in_color(color_enabled)
768
+ expect(program).to produce_output_when_run(expected_output).in_color(
769
+ color_enabled
770
+ )
679
771
  end
680
772
  end
681
773
  end
@@ -684,39 +776,41 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
684
776
  it "produces the correct failure message when used in the positive" do
685
777
  as_both_colored_and_uncolored do |color_enabled|
686
778
  snippet = <<~TEST.strip
687
- expected = SuperDiff::Test::Person.new(
688
- name: "Marty",
689
- age: 31,
690
- )
691
- actual = SuperDiff::Test::Customer.new(
779
+ actual = SuperDiff::Test::Customer.new(
692
780
  name: "Doc",
693
781
  shipping_address: :some_shipping_address,
694
782
  phone: "1234567890",
695
783
  )
784
+ expected = SuperDiff::Test::Person.new(
785
+ name: "Marty",
786
+ age: 31,
787
+ )
696
788
  expect(actual).to eq(expected)
697
789
  TEST
698
790
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
699
791
 
700
- expected_output = build_expected_output(
701
- color_enabled: color_enabled,
702
- snippet: %|expect(actual).to eq(expected)|,
703
- newline_before_expectation: true,
704
- expectation: proc {
705
- line do
706
- plain %|Expected |
707
- actual %|#<SuperDiff::Test::Customer name: "Doc", shipping_address: :some_shipping_address, phone: "1234567890">|
708
- end
709
-
710
- line do
711
- plain %| to eq |
712
- expected %|#<SuperDiff::Test::Person name: "Marty", age: 31>|
713
- end
714
- },
715
- )
792
+ expected_output =
793
+ build_expected_output(
794
+ color_enabled: color_enabled,
795
+ snippet: "expect(actual).to eq(expected)",
796
+ newline_before_expectation: true,
797
+ expectation:
798
+ proc do
799
+ line do
800
+ plain "Expected "
801
+ actual %|#<SuperDiff::Test::Customer name: "Doc", shipping_address: :some_shipping_address, phone: "1234567890">|
802
+ end
803
+
804
+ line do
805
+ plain " to eq "
806
+ expected %|#<SuperDiff::Test::Person name: "Marty", age: 31>|
807
+ end
808
+ end
809
+ )
716
810
 
717
- expect(program).
718
- to produce_output_when_run(expected_output).
719
- in_color(color_enabled)
811
+ expect(program).to produce_output_when_run(expected_output).in_color(
812
+ color_enabled
813
+ )
720
814
  end
721
815
  end
722
816
 
@@ -731,26 +825,28 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
731
825
  TEST
732
826
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
733
827
 
734
- expected_output = build_expected_output(
735
- color_enabled: color_enabled,
736
- snippet: %|expect(value).not_to eq(value)|,
737
- newline_before_expectation: true,
738
- expectation: proc {
739
- line do
740
- plain %| Expected |
741
- actual %|#<SuperDiff::Test::Person name: "Marty", age: 31>|
742
- end
743
-
744
- line do
745
- plain %|not to eq |
746
- expected %|#<SuperDiff::Test::Person name: "Marty", age: 31>|
747
- end
748
- },
749
- )
828
+ expected_output =
829
+ build_expected_output(
830
+ color_enabled: color_enabled,
831
+ snippet: "expect(value).not_to eq(value)",
832
+ newline_before_expectation: true,
833
+ expectation:
834
+ proc do
835
+ line do
836
+ plain " Expected "
837
+ actual %|#<SuperDiff::Test::Person name: "Marty", age: 31>|
838
+ end
839
+
840
+ line do
841
+ plain "not to eq "
842
+ expected %|#<SuperDiff::Test::Person name: "Marty", age: 31>|
843
+ end
844
+ end
845
+ )
750
846
 
751
- expect(program).
752
- to produce_output_when_run(expected_output).
753
- in_color(color_enabled)
847
+ expect(program).to produce_output_when_run(expected_output).in_color(
848
+ color_enabled
849
+ )
754
850
  end
755
851
  end
756
852
  end
@@ -759,11 +855,7 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
759
855
  it "produces the correct failure message when used in the positive" do
760
856
  as_both_colored_and_uncolored do |color_enabled|
761
857
  snippet = <<~TEST.strip
762
- expected = SuperDiff::Test::Item.new(
763
- name: "camera",
764
- quantity: 3,
765
- )
766
- actual = SuperDiff::Test::Player.new(
858
+ actual = SuperDiff::Test::Player.new(
767
859
  handle: "mcmire",
768
860
  character: "Jon",
769
861
  inventory: ["sword"],
@@ -771,31 +863,36 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
771
863
  health: 4,
772
864
  ultimate: true,
773
865
  )
866
+ expected = SuperDiff::Test::Item.new(
867
+ name: "camera",
868
+ quantity: 3,
869
+ )
774
870
  expect(actual).to eq(expected)
775
871
  TEST
776
872
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
777
873
 
778
- expected_output = build_expected_output(
779
- color_enabled: color_enabled,
780
- snippet: %|expect(actual).to eq(expected)|,
781
- newline_before_expectation: true,
782
- expectation: proc {
783
- line do
784
- plain %|Expected |
785
- actual %|#<SuperDiff::Test::Player @character="Jon", @handle="mcmire", @health=4, @inventory=["sword"], @shields=11.4, @ultimate=true>|
786
- end
787
-
788
- line do
789
- plain %| to eq |
790
- expected %|#<SuperDiff::Test::Item @name="camera", @quantity=3>|
791
- end
792
- },
793
- )
874
+ expected_output =
875
+ build_expected_output(
876
+ color_enabled: color_enabled,
877
+ snippet: "expect(actual).to eq(expected)",
878
+ newline_before_expectation: true,
879
+ expectation:
880
+ proc do
881
+ line do
882
+ plain "Expected "
883
+ actual %|#<SuperDiff::Test::Player @character="Jon", @handle="mcmire", @health=4, @inventory=["sword"], @shields=11.4, @ultimate=true>|
884
+ end
885
+
886
+ line do
887
+ plain " to eq "
888
+ expected %|#<SuperDiff::Test::Item @name="camera", @quantity=3>|
889
+ end
890
+ end
891
+ )
794
892
 
795
- expect(program).
796
- to produce_output_when_run(expected_output).
797
- in_color(color_enabled).
798
- removing_object_ids
893
+ expect(program).to produce_output_when_run(expected_output).in_color(
894
+ color_enabled
895
+ ).removing_object_ids
799
896
  end
800
897
  end
801
898
 
@@ -810,27 +907,28 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
810
907
  TEST
811
908
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
812
909
 
813
- expected_output = build_expected_output(
814
- color_enabled: color_enabled,
815
- snippet: %|expect(value).not_to eq(value)|,
816
- newline_before_expectation: true,
817
- expectation: proc {
818
- line do
819
- plain %| Expected |
820
- actual %|#<SuperDiff::Test::Item @name="camera", @quantity=3>|
821
- end
822
-
823
- line do
824
- plain %|not to eq |
825
- expected %|#<SuperDiff::Test::Item @name="camera", @quantity=3>|
826
- end
827
- },
828
- )
910
+ expected_output =
911
+ build_expected_output(
912
+ color_enabled: color_enabled,
913
+ snippet: "expect(value).not_to eq(value)",
914
+ newline_before_expectation: true,
915
+ expectation:
916
+ proc do
917
+ line do
918
+ plain " Expected "
919
+ actual %|#<SuperDiff::Test::Item @name="camera", @quantity=3>|
920
+ end
921
+
922
+ line do
923
+ plain "not to eq "
924
+ expected %|#<SuperDiff::Test::Item @name="camera", @quantity=3>|
925
+ end
926
+ end
927
+ )
829
928
 
830
- expect(program).
831
- to produce_output_when_run(expected_output).
832
- in_color(color_enabled).
833
- removing_object_ids
929
+ expect(program).to produce_output_when_run(expected_output).in_color(
930
+ color_enabled
931
+ ).removing_object_ids
834
932
  end
835
933
  end
836
934
  end
@@ -839,36 +937,39 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
839
937
  it "formats the array correctly in the diff" do
840
938
  as_both_colored_and_uncolored do |color_enabled|
841
939
  snippet = <<~TEST.strip
940
+ actual = { foo: [] }
842
941
  expected = { foo: nil }
843
- actual = { foo: [] }
844
942
  expect(actual).to eq(expected)
845
943
  TEST
846
944
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
847
945
 
848
- expected_output = build_expected_output(
849
- color_enabled: color_enabled,
850
- snippet: %|expect(actual).to eq(expected)|,
851
- newline_before_expectation: true,
852
- expectation: proc {
853
- line do
854
- plain %|Expected |
855
- actual %|{ foo: [] }|
856
- plain %| to eq |
857
- expected %|{ foo: nil }|
858
- plain %|.|
859
- end
860
- },
861
- diff: proc {
862
- plain_line %| {|
863
- expected_line %|- foo: nil|
864
- actual_line %|+ foo: []|
865
- plain_line %| }|
866
- }
867
- )
946
+ expected_output =
947
+ build_expected_output(
948
+ color_enabled: color_enabled,
949
+ snippet: "expect(actual).to eq(expected)",
950
+ newline_before_expectation: true,
951
+ expectation:
952
+ proc do
953
+ line do
954
+ plain "Expected "
955
+ actual "{ foo: [] }"
956
+ plain " to eq "
957
+ expected "{ foo: nil }"
958
+ plain "."
959
+ end
960
+ end,
961
+ diff:
962
+ proc do
963
+ plain_line " {"
964
+ expected_line "- foo: nil"
965
+ actual_line "+ foo: []"
966
+ plain_line " }"
967
+ end
968
+ )
868
969
 
869
- expect(program).
870
- to produce_output_when_run(expected_output).
871
- in_color(color_enabled)
970
+ expect(program).to produce_output_when_run(expected_output).in_color(
971
+ color_enabled
972
+ )
872
973
  end
873
974
  end
874
975
  end
@@ -877,36 +978,39 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
877
978
  it "formats the hash correctly in the diff" do
878
979
  as_both_colored_and_uncolored do |color_enabled|
879
980
  snippet = <<~TEST.strip
981
+ actual = { foo: {} }
880
982
  expected = { foo: nil }
881
- actual = { foo: {} }
882
983
  expect(actual).to eq(expected)
883
984
  TEST
884
985
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
885
986
 
886
- expected_output = build_expected_output(
887
- color_enabled: color_enabled,
888
- snippet: %|expect(actual).to eq(expected)|,
889
- newline_before_expectation: true,
890
- expectation: proc {
891
- line do
892
- plain %|Expected |
893
- actual %|{ foo: {} }|
894
- plain %| to eq |
895
- expected %|{ foo: nil }|
896
- plain %|.|
897
- end
898
- },
899
- diff: proc {
900
- plain_line %| {|
901
- expected_line %|- foo: nil|
902
- actual_line %|+ foo: {}|
903
- plain_line %| }|
904
- }
905
- )
987
+ expected_output =
988
+ build_expected_output(
989
+ color_enabled: color_enabled,
990
+ snippet: "expect(actual).to eq(expected)",
991
+ newline_before_expectation: true,
992
+ expectation:
993
+ proc do
994
+ line do
995
+ plain "Expected "
996
+ actual "{ foo: {} }"
997
+ plain " to eq "
998
+ expected "{ foo: nil }"
999
+ plain "."
1000
+ end
1001
+ end,
1002
+ diff:
1003
+ proc do
1004
+ plain_line " {"
1005
+ expected_line "- foo: nil"
1006
+ actual_line "+ foo: {}"
1007
+ plain_line " }"
1008
+ end
1009
+ )
906
1010
 
907
- expect(program).
908
- to produce_output_when_run(expected_output).
909
- in_color(color_enabled)
1011
+ expect(program).to produce_output_when_run(expected_output).in_color(
1012
+ color_enabled
1013
+ )
910
1014
  end
911
1015
  end
912
1016
  end
@@ -915,37 +1019,39 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
915
1019
  it "formats the object correctly in the diff" do
916
1020
  as_both_colored_and_uncolored do |color_enabled|
917
1021
  snippet = <<~TEST.strip
1022
+ actual = { foo: SuperDiff::Test::EmptyClass.new }
918
1023
  expected = { foo: nil }
919
- actual = { foo: SuperDiff::Test::EmptyClass.new }
920
1024
  expect(actual).to eq(expected)
921
1025
  TEST
922
1026
  program = make_plain_test_program(snippet, color_enabled: color_enabled)
923
1027
 
924
- expected_output = build_expected_output(
925
- color_enabled: color_enabled,
926
- snippet: %|expect(actual).to eq(expected)|,
927
- newline_before_expectation: true,
928
- expectation: proc {
929
- line do
930
- plain %|Expected |
931
- actual %|{ foo: #<SuperDiff::Test::EmptyClass> }|
932
- plain %| to eq |
933
- expected %|{ foo: nil }|
934
- plain %|.|
935
- end
936
- },
937
- diff: proc {
938
- plain_line %| {|
939
- expected_line %|- foo: nil|
940
- actual_line %|+ foo: #<SuperDiff::Test::EmptyClass>|
941
- plain_line %| }|
942
- }
943
- )
1028
+ expected_output =
1029
+ build_expected_output(
1030
+ color_enabled: color_enabled,
1031
+ snippet: "expect(actual).to eq(expected)",
1032
+ newline_before_expectation: true,
1033
+ expectation:
1034
+ proc do
1035
+ line do
1036
+ plain "Expected "
1037
+ actual "{ foo: #<SuperDiff::Test::EmptyClass> }"
1038
+ plain " to eq "
1039
+ expected "{ foo: nil }"
1040
+ plain "."
1041
+ end
1042
+ end,
1043
+ diff:
1044
+ proc do
1045
+ plain_line " {"
1046
+ expected_line "- foo: nil"
1047
+ actual_line "+ foo: #<SuperDiff::Test::EmptyClass>"
1048
+ plain_line " }"
1049
+ end
1050
+ )
944
1051
 
945
- expect(program).
946
- to produce_output_when_run(expected_output).
947
- in_color(color_enabled).
948
- removing_object_ids
1052
+ expect(program).to produce_output_when_run(expected_output).in_color(
1053
+ color_enabled
1054
+ ).removing_object_ids
949
1055
  end
950
1056
  end
951
1057
  end
@@ -953,4 +1059,8 @@ RSpec.describe "Integration with RSpec's #eq matcher", type: :integration do
953
1059
  it_behaves_like "a matcher that supports elided diffs" do
954
1060
  let(:matcher) { :eq }
955
1061
  end
1062
+
1063
+ it_behaves_like "a matcher that supports a toggleable key" do
1064
+ let(:matcher) { :eq }
1065
+ end
956
1066
  end