super_diff 0.5.3 → 0.8.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.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -20
  3. data/lib/super_diff.rb +46 -7
  4. data/lib/super_diff/active_record.rb +7 -7
  5. data/lib/super_diff/active_record/differs/active_record_relation.rb +3 -13
  6. data/lib/super_diff/active_record/object_inspection.rb +2 -6
  7. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb +16 -0
  8. data/lib/super_diff/active_record/object_inspection/{inspectors → inspection_tree_builders}/active_record_model.rb +19 -20
  9. data/lib/super_diff/active_record/object_inspection/{inspectors → inspection_tree_builders}/active_record_relation.rb +9 -8
  10. data/lib/super_diff/active_record/operation_tree_flatteners.rb +10 -0
  11. data/lib/super_diff/active_record/operation_tree_flatteners/active_record_relation.rb +17 -0
  12. data/lib/super_diff/active_record/operation_trees/active_record_relation.rb +8 -7
  13. data/lib/super_diff/active_support.rb +8 -8
  14. data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +3 -13
  15. data/lib/super_diff/active_support/object_inspection.rb +2 -6
  16. data/lib/super_diff/active_support/object_inspection/{inspectors.rb → inspection_tree_builders.rb} +2 -2
  17. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +37 -0
  18. data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +17 -0
  19. data/lib/super_diff/active_support/operation_tree_flatteners.rb +10 -0
  20. data/lib/super_diff/active_support/operation_tree_flatteners/hash_with_indifferent_access.rb +17 -0
  21. data/lib/super_diff/active_support/operation_trees/hash_with_indifferent_access.rb +4 -7
  22. data/lib/super_diff/colorized_document_extensions.rb +9 -6
  23. data/lib/super_diff/configuration.rb +102 -19
  24. data/lib/super_diff/csi.rb +1 -1
  25. data/lib/super_diff/csi/four_bit_color.rb +0 -2
  26. data/lib/super_diff/diff_formatters/collection.rb +2 -2
  27. data/lib/super_diff/diff_formatters/multiline_string.rb +4 -4
  28. data/lib/super_diff/differs/array.rb +1 -1
  29. data/lib/super_diff/differs/base.rb +3 -21
  30. data/lib/super_diff/differs/custom_object.rb +1 -1
  31. data/lib/super_diff/differs/default_object.rb +1 -1
  32. data/lib/super_diff/differs/hash.rb +1 -1
  33. data/lib/super_diff/differs/main.rb +1 -7
  34. data/lib/super_diff/differs/multiline_string.rb +1 -1
  35. data/lib/super_diff/differs/time_like.rb +1 -1
  36. data/lib/super_diff/equality_matchers/array.rb +4 -4
  37. data/lib/super_diff/equality_matchers/default.rb +4 -4
  38. data/lib/super_diff/equality_matchers/hash.rb +4 -4
  39. data/lib/super_diff/equality_matchers/multiline_string.rb +4 -4
  40. data/lib/super_diff/equality_matchers/primitive.rb +6 -9
  41. data/lib/super_diff/equality_matchers/singleline_string.rb +4 -4
  42. data/lib/super_diff/gem_version.rb +45 -0
  43. data/lib/super_diff/helpers.rb +52 -2
  44. data/lib/super_diff/line.rb +83 -0
  45. data/lib/super_diff/object_inspection.rb +12 -9
  46. data/lib/super_diff/object_inspection/inspection_tree.rb +183 -81
  47. data/lib/super_diff/object_inspection/inspection_tree_builders.rb +44 -0
  48. data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +38 -0
  49. data/lib/super_diff/object_inspection/inspection_tree_builders/base.rb +27 -0
  50. data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +37 -0
  51. data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +63 -0
  52. data/lib/super_diff/object_inspection/{inspectors → inspection_tree_builders}/defaults.rb +1 -2
  53. data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +46 -0
  54. data/lib/super_diff/object_inspection/{inspectors → inspection_tree_builders}/main.rb +5 -10
  55. data/lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb +21 -0
  56. data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +64 -0
  57. data/lib/super_diff/object_inspection/nodes.rb +33 -32
  58. data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +97 -0
  59. data/lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb +27 -0
  60. data/lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb +27 -0
  61. data/lib/super_diff/object_inspection/nodes/as_single_line.rb +33 -0
  62. data/lib/super_diff/object_inspection/nodes/base.rb +55 -20
  63. data/lib/super_diff/object_inspection/nodes/inspection.rb +47 -7
  64. data/lib/super_diff/object_inspection/nodes/nesting.rb +16 -5
  65. data/lib/super_diff/object_inspection/nodes/only_when.rb +54 -0
  66. data/lib/super_diff/object_inspection/nodes/text.rb +16 -2
  67. data/lib/super_diff/object_inspection/nodes/when_empty.rb +21 -6
  68. data/lib/super_diff/object_inspection/nodes/when_non_empty.rb +20 -5
  69. data/lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb +27 -0
  70. data/lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb +27 -0
  71. data/lib/super_diff/object_inspection/prefix_for_next_node.rb +6 -0
  72. data/lib/super_diff/object_inspection/prelude_for_next_node.rb +6 -0
  73. data/lib/super_diff/operation_tree_builders/array.rb +7 -10
  74. data/lib/super_diff/operation_tree_builders/base.rb +6 -6
  75. data/lib/super_diff/operation_tree_builders/custom_object.rb +5 -2
  76. data/lib/super_diff/operation_tree_builders/default_object.rb +1 -1
  77. data/lib/super_diff/operation_tree_builders/defaults.rb +1 -1
  78. data/lib/super_diff/operation_tree_builders/hash.rb +1 -8
  79. data/lib/super_diff/operation_tree_builders/multiline_string.rb +2 -6
  80. data/lib/super_diff/operation_tree_builders/time_like.rb +2 -2
  81. data/lib/super_diff/operation_tree_flatteners.rb +20 -0
  82. data/lib/super_diff/operation_tree_flatteners/array.rb +15 -0
  83. data/lib/super_diff/operation_tree_flatteners/base.rb +54 -0
  84. data/lib/super_diff/operation_tree_flatteners/collection.rb +139 -0
  85. data/lib/super_diff/operation_tree_flatteners/custom_object.rb +28 -0
  86. data/lib/super_diff/operation_tree_flatteners/default_object.rb +32 -0
  87. data/lib/super_diff/operation_tree_flatteners/hash.rb +41 -0
  88. data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +17 -0
  89. data/lib/super_diff/operation_trees/array.rb +4 -7
  90. data/lib/super_diff/operation_trees/base.rb +39 -16
  91. data/lib/super_diff/operation_trees/custom_object.rb +4 -8
  92. data/lib/super_diff/operation_trees/default_object.rb +28 -13
  93. data/lib/super_diff/operation_trees/hash.rb +4 -7
  94. data/lib/super_diff/operation_trees/main.rb +1 -1
  95. data/lib/super_diff/operation_trees/multiline_string.rb +4 -7
  96. data/lib/super_diff/operations/binary_operation.rb +1 -6
  97. data/lib/super_diff/operations/unary_operation.rb +2 -30
  98. data/lib/super_diff/recursion_guard.rb +3 -3
  99. data/lib/super_diff/rspec.rb +41 -13
  100. data/lib/super_diff/rspec/differs/collection_including.rb +4 -2
  101. data/lib/super_diff/rspec/differs/hash_including.rb +4 -2
  102. data/lib/super_diff/rspec/matcher_text_builders/base.rb +7 -7
  103. data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +6 -6
  104. data/lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb +1 -1
  105. data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +4 -4
  106. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -1
  107. data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +5 -5
  108. data/lib/super_diff/rspec/monkey_patches.rb +353 -306
  109. data/lib/super_diff/rspec/object_inspection.rb +4 -1
  110. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +44 -0
  111. data/lib/super_diff/rspec/object_inspection/{inspectors → inspection_tree_builders}/collection_containing_exactly.rb +9 -8
  112. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +34 -0
  113. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +103 -0
  114. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +36 -0
  115. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +26 -0
  116. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +26 -0
  117. data/lib/super_diff/rspec/object_inspection/{inspectors → inspection_tree_builders}/object_having_attributes.rb +10 -12
  118. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/primitive.rb +10 -0
  119. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb +33 -0
  120. data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +12 -4
  121. data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +10 -3
  122. data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +10 -3
  123. data/lib/super_diff/tiered_lines.rb +4 -0
  124. data/lib/super_diff/tiered_lines_elider.rb +490 -0
  125. data/lib/super_diff/tiered_lines_formatter.rb +79 -0
  126. data/lib/super_diff/version.rb +1 -1
  127. data/spec/examples.txt +407 -5
  128. data/spec/integration/rails/active_support_spec.rb +19 -0
  129. data/spec/integration/rspec/be_falsey_matcher_spec.rb +10 -10
  130. data/spec/integration/rspec/be_matcher_spec.rb +100 -100
  131. data/spec/integration/rspec/be_nil_matcher_spec.rb +10 -10
  132. data/spec/integration/rspec/be_predicate_matcher_spec.rb +103 -103
  133. data/spec/integration/rspec/be_truthy_matcher_spec.rb +10 -10
  134. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +113 -107
  135. data/spec/integration/rspec/eq_matcher_spec.rb +223 -277
  136. data/spec/integration/rspec/have_attributes_matcher_spec.rb +138 -129
  137. data/spec/integration/rspec/have_predicate_matcher_spec.rb +65 -65
  138. data/spec/integration/rspec/include_matcher_spec.rb +73 -73
  139. data/spec/integration/rspec/match_array_matcher_spec.rb +126 -119
  140. data/spec/integration/rspec/match_matcher_spec.rb +362 -274
  141. data/spec/integration/rspec/raise_error_matcher_spec.rb +86 -86
  142. data/spec/integration/rspec/respond_to_matcher_spec.rb +240 -240
  143. data/spec/integration/rspec/third_party_matcher_spec.rb +8 -8
  144. data/spec/integration/rspec/unhandled_errors_spec.rb +5 -5
  145. data/spec/spec_helper.rb +33 -13
  146. data/spec/support/command_runner.rb +15 -25
  147. data/spec/support/helpers.rb +21 -0
  148. data/spec/support/integration/helpers.rb +8 -2
  149. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +4 -4
  150. data/spec/support/integration/test_programs/base.rb +38 -10
  151. data/spec/support/integration/test_programs/rspec_active_record.rb +1 -1
  152. data/spec/support/integration/test_programs/rspec_active_support.rb +17 -0
  153. data/spec/support/integration/test_programs/rspec_rails.rb +1 -1
  154. data/spec/support/shared_examples/active_record.rb +109 -108
  155. data/spec/support/shared_examples/active_support.rb +65 -0
  156. data/spec/support/shared_examples/elided_diffs.rb +914 -0
  157. data/spec/support/shared_examples/hash_with_indifferent_access.rb +196 -232
  158. data/spec/support/unit/helpers.rb +15 -0
  159. data/spec/support/unit/matchers/match_output.rb +41 -0
  160. data/spec/unit/active_record/object_inspection_spec.rb +273 -0
  161. data/spec/unit/equality_matchers/main_spec.rb +445 -465
  162. data/spec/unit/helpers_spec.rb +61 -0
  163. data/spec/unit/operation_tree_flatteners/array_spec.rb +604 -0
  164. data/spec/unit/operation_tree_flatteners/custom_object_spec.rb +667 -0
  165. data/spec/unit/operation_tree_flatteners/default_object_spec.rb +687 -0
  166. data/spec/unit/operation_tree_flatteners/hash_spec.rb +632 -0
  167. data/spec/unit/operation_tree_flatteners/multiline_string_spec.rb +121 -0
  168. data/spec/unit/rspec/object_inspection_spec.rb +446 -0
  169. data/spec/unit/super_diff_spec.rb +1958 -0
  170. data/spec/unit/tiered_lines_elider_spec.rb +6356 -0
  171. data/spec/unit/tiered_lines_formatter_spec.rb +193 -0
  172. data/super_diff.gemspec +1 -1
  173. metadata +95 -50
  174. data/lib/super_diff/active_record/diff_formatters.rb +0 -10
  175. data/lib/super_diff/active_record/diff_formatters/active_record_relation.rb +0 -23
  176. data/lib/super_diff/active_record/object_inspection/inspectors.rb +0 -16
  177. data/lib/super_diff/active_support/diff_formatters.rb +0 -10
  178. data/lib/super_diff/active_support/diff_formatters/hash_with_indifferent_access.rb +0 -36
  179. data/lib/super_diff/active_support/object_inspection/inspectors/hash_with_indifferent_access.rb +0 -28
  180. data/lib/super_diff/diff_formatters.rb +0 -14
  181. data/lib/super_diff/diff_formatters/array.rb +0 -21
  182. data/lib/super_diff/diff_formatters/base.rb +0 -33
  183. data/lib/super_diff/diff_formatters/custom_object.rb +0 -30
  184. data/lib/super_diff/diff_formatters/default_object.rb +0 -46
  185. data/lib/super_diff/diff_formatters/defaults.rb +0 -10
  186. data/lib/super_diff/diff_formatters/hash.rb +0 -34
  187. data/lib/super_diff/diff_formatters/main.rb +0 -41
  188. data/lib/super_diff/object_inspection/inspectors.rb +0 -23
  189. data/lib/super_diff/object_inspection/inspectors/array.rb +0 -32
  190. data/lib/super_diff/object_inspection/inspectors/base.rb +0 -36
  191. data/lib/super_diff/object_inspection/inspectors/custom_object.rb +0 -37
  192. data/lib/super_diff/object_inspection/inspectors/default_object.rb +0 -61
  193. data/lib/super_diff/object_inspection/inspectors/hash.rb +0 -32
  194. data/lib/super_diff/object_inspection/inspectors/primitive.rb +0 -28
  195. data/lib/super_diff/object_inspection/inspectors/string.rb +0 -23
  196. data/lib/super_diff/object_inspection/inspectors/time_like.rb +0 -23
  197. data/lib/super_diff/object_inspection/nodes/break.rb +0 -15
  198. data/lib/super_diff/object_inspection/nodes/when_multiline.rb +0 -22
  199. data/lib/super_diff/object_inspection/nodes/when_singleline.rb +0 -24
  200. data/lib/super_diff/rspec/object_inspection/inspectors.rb +0 -40
  201. data/lib/super_diff/rspec/object_inspection/inspectors/collection_including.rb +0 -28
  202. data/lib/super_diff/rspec/object_inspection/inspectors/hash_including.rb +0 -31
  203. data/lib/super_diff/rspec/object_inspection/inspectors/instance_of.rb +0 -23
  204. data/lib/super_diff/rspec/object_inspection/inspectors/kind_of.rb +0 -23
  205. data/lib/super_diff/rspec/object_inspection/inspectors/primitive.rb +0 -13
  206. data/lib/super_diff/rspec/object_inspection/inspectors/value_within.rb +0 -29
  207. data/spec/support/object_id.rb +0 -27
  208. data/spec/support/ruby_versions.rb +0 -11
  209. data/spec/unit/object_inspection_spec.rb +0 -1168
@@ -7,7 +7,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
7
7
  as_both_colored_and_uncolored do |color_enabled|
8
8
  snippet = <<~TEST.strip
9
9
  expected = ["Marty", "Einie"]
10
- actual = ["Marty", "Jennifer", "Doc"]
10
+ actual = ["Marty", "Jennifer", "Doc"]
11
11
  expect(actual).to include(*expected)
12
12
  TEST
13
13
  program = make_plain_test_program(
@@ -20,21 +20,21 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
20
20
  snippet: %|expect(actual).to include(*expected)|,
21
21
  expectation: proc {
22
22
  line do
23
- plain "Expected "
24
- beta %|["Marty", "Jennifer", "Doc"]|
25
- plain " to include "
26
- alpha %|"Einie"|
27
- plain "."
23
+ plain %|Expected |
24
+ actual %|["Marty", "Jennifer", "Doc"]|
25
+ plain %| to include |
26
+ expected %|"Einie"|
27
+ plain %|.|
28
28
  end
29
29
  },
30
30
  diff: proc {
31
- plain_line %| [|
32
- plain_line %| "Marty",|
33
- plain_line %| "Jennifer",|
34
- # plain_line %| "Doc",| # FIXME
35
- plain_line %| "Doc"|
36
- alpha_line %|- "Einie"|
37
- plain_line %| ]|
31
+ plain_line %| [|
32
+ plain_line %| "Marty",|
33
+ plain_line %| "Jennifer",|
34
+ # plain_line %| "Doc",| # FIXME
35
+ plain_line %| "Doc"|
36
+ expected_line %|- "Einie"|
37
+ plain_line %| ]|
38
38
  },
39
39
  )
40
40
 
@@ -60,11 +60,11 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
60
60
  snippet: %|expect(values).not_to include(*values)|,
61
61
  expectation: proc {
62
62
  line do
63
- plain "Expected "
64
- beta %|["Marty", "Einie"]|
65
- plain " not to include "
66
- alpha %|"Marty" and "Einie"|
67
- plain "."
63
+ plain %|Expected |
64
+ actual %|["Marty", "Einie"]|
65
+ plain %| not to include |
66
+ expected %|"Marty" and "Einie"|
67
+ plain %|.|
68
68
  end
69
69
  },
70
70
  )
@@ -88,7 +88,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
88
88
  "George McFly",
89
89
  "Lorraine McFly"
90
90
  ]
91
- actual = [
91
+ actual = [
92
92
  "Marty McFly",
93
93
  "Doc Brown",
94
94
  "Einie",
@@ -106,25 +106,25 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
106
106
  snippet: %|expect(actual).to include(*expected)|,
107
107
  expectation: proc {
108
108
  line do
109
- plain " Expected "
110
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
109
+ plain %| Expected |
110
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
111
111
  end
112
112
 
113
113
  line do
114
- plain "to include "
115
- alpha %|"Biff Tannen" and "George McFly"|
114
+ plain %|to include |
115
+ expected %|"Biff Tannen" and "George McFly"|
116
116
  end
117
117
  },
118
118
  diff: proc {
119
- plain_line %| [|
120
- plain_line %| "Marty McFly",|
121
- plain_line %| "Doc Brown",|
122
- plain_line %| "Einie",|
123
- # plain_line %| "Lorraine McFly",| # FIXME
124
- plain_line %| "Lorraine McFly"|
125
- alpha_line %|- "Biff Tannen",|
126
- alpha_line %|- "George McFly"|
127
- plain_line %| ]|
119
+ plain_line %| [|
120
+ plain_line %| "Marty McFly",|
121
+ plain_line %| "Doc Brown",|
122
+ plain_line %| "Einie",|
123
+ # plain_line %| "Lorraine McFly",| # FIXME
124
+ plain_line %| "Lorraine McFly"|
125
+ expected_line %|- "Biff Tannen",|
126
+ expected_line %|- "George McFly"|
127
+ plain_line %| ]|
128
128
  },
129
129
  )
130
130
 
@@ -143,7 +143,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
143
143
  "Einie",
144
144
  "Lorraine McFly"
145
145
  ]
146
- actual = [
146
+ actual = [
147
147
  "Marty McFly",
148
148
  "Doc Brown",
149
149
  "Einie",
@@ -164,13 +164,13 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
164
164
  newline_before_expectation: true,
165
165
  expectation: proc {
166
166
  line do
167
- plain " Expected "
168
- beta %|["Marty McFly", "Doc Brown", "Einie", "Biff Tannen", "George McFly", "Lorraine McFly"]|
167
+ plain %| Expected |
168
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Biff Tannen", "George McFly", "Lorraine McFly"]|
169
169
  end
170
170
 
171
171
  line do
172
- plain "not to include "
173
- alpha %|"Marty McFly", "Doc Brown", "Einie", and "Lorraine McFly"|
172
+ plain %|not to include |
173
+ expected %|"Marty McFly", "Doc Brown", "Einie", and "Lorraine McFly"|
174
174
  end
175
175
  },
176
176
  )
@@ -189,7 +189,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
189
189
  as_both_colored_and_uncolored do |color_enabled|
190
190
  snippet = <<~TEST.strip
191
191
  expected = { city: "Hill Valley", state: "CA" }
192
- actual = { city: "Burbank", zip: "90210" }
192
+ actual = { city: "Burbank", zip: "90210" }
193
193
  expect(actual).to include(expected)
194
194
  TEST
195
195
  program = make_plain_test_program(
@@ -202,22 +202,22 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
202
202
  snippet: %|expect(actual).to include(expected)|,
203
203
  expectation: proc {
204
204
  line do
205
- plain "Expected "
206
- beta %|{ city: "Burbank", zip: "90210" }|
207
- plain " to include "
208
- alpha %|(city: "Hill Valley", state: "CA")|
209
- plain "."
205
+ plain %|Expected |
206
+ actual %|{ city: "Burbank", zip: "90210" }|
207
+ plain %| to include |
208
+ expected %|(city: "Hill Valley", state: "CA")|
209
+ plain %|.|
210
210
  end
211
211
  },
212
212
  diff: proc {
213
- plain_line %| {|
214
- alpha_line %|- city: "Hill Valley",|
215
- beta_line %|+ city: "Burbank",|
213
+ plain_line %| {|
214
+ expected_line %|- city: "Hill Valley",|
215
+ actual_line %|+ city: "Burbank",|
216
216
  # FIXME
217
- # alpha_line %|- state: "CA",|
218
- alpha_line %|- state: "CA"|
219
- plain_line %| zip: "90210"|
220
- plain_line %| }|
217
+ # expected_line %|- state: "CA",|
218
+ expected_line %|- state: "CA"|
219
+ plain_line %| zip: "90210"|
220
+ plain_line %| }|
221
221
  },
222
222
  )
223
223
 
@@ -231,7 +231,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
231
231
  as_both_colored_and_uncolored do |color_enabled|
232
232
  snippet = <<~TEST.strip
233
233
  expected = { city: "Burbank" }
234
- actual = { city: "Burbank", zip: "90210" }
234
+ actual = { city: "Burbank", zip: "90210" }
235
235
  expect(actual).not_to include(expected)
236
236
  TEST
237
237
  program = make_plain_test_program(
@@ -244,11 +244,11 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
244
244
  snippet: %|expect(actual).not_to include(expected)|,
245
245
  expectation: proc {
246
246
  line do
247
- plain "Expected "
248
- beta %|{ city: "Burbank", zip: "90210" }|
249
- plain " not to include "
250
- alpha %|(city: "Burbank")|
251
- plain "."
247
+ plain %|Expected |
248
+ actual %|{ city: "Burbank", zip: "90210" }|
249
+ plain %| not to include |
250
+ expected %|(city: "Burbank")|
251
+ plain %|.|
252
252
  end
253
253
  },
254
254
  )
@@ -268,7 +268,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
268
268
  city: "Hill Valley",
269
269
  zip: "90382"
270
270
  }
271
- actual = {
271
+ actual = {
272
272
  city: "Burbank",
273
273
  state: "CA",
274
274
  zip: "90210"
@@ -285,23 +285,23 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
285
285
  snippet: %|expect(actual).to include(expected)|,
286
286
  expectation: proc {
287
287
  line do
288
- plain " Expected "
289
- beta %|{ city: "Burbank", state: "CA", zip: "90210" }|
288
+ plain %| Expected |
289
+ actual %|{ city: "Burbank", state: "CA", zip: "90210" }|
290
290
  end
291
291
 
292
292
  line do
293
- plain "to include "
294
- alpha %|(city: "Hill Valley", zip: "90382")|
293
+ plain %|to include |
294
+ expected %|(city: "Hill Valley", zip: "90382")|
295
295
  end
296
296
  },
297
297
  diff: proc {
298
- plain_line %| {|
299
- alpha_line %|- city: "Hill Valley",|
300
- beta_line %|+ city: "Burbank",|
301
- plain_line %| state: "CA",|
302
- alpha_line %|- zip: "90382"|
303
- beta_line %|+ zip: "90210"|
304
- plain_line %| }|
298
+ plain_line %| {|
299
+ expected_line %|- city: "Hill Valley",|
300
+ actual_line %|+ city: "Burbank",|
301
+ plain_line %| state: "CA",|
302
+ expected_line %|- zip: "90382"|
303
+ actual_line %|+ zip: "90210"|
304
+ plain_line %| }|
305
305
  },
306
306
  )
307
307
 
@@ -315,7 +315,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
315
315
  as_both_colored_and_uncolored do |color_enabled|
316
316
  snippet = <<~TEST.strip
317
317
  expected = { city: "Hill Valley", state: "CA" }
318
- actual = { city: "Hill Valley", state: "CA", zip: "90210" }
318
+ actual = { city: "Hill Valley", state: "CA", zip: "90210" }
319
319
  expect(actual).not_to include(expected)
320
320
  TEST
321
321
  program = make_plain_test_program(
@@ -329,13 +329,13 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d
329
329
  newline_before_expectation: true,
330
330
  expectation: proc {
331
331
  line do
332
- plain " Expected "
333
- beta %|{ city: "Hill Valley", state: "CA", zip: "90210" }|
332
+ plain %| Expected |
333
+ actual %|{ city: "Hill Valley", state: "CA", zip: "90210" }|
334
334
  end
335
335
 
336
336
  line do
337
- plain "not to include "
338
- alpha %|(city: "Hill Valley", state: "CA")|
337
+ plain %|not to include |
338
+ expected %|(city: "Hill Valley", state: "CA")|
339
339
  end
340
340
  },
341
341
  )
@@ -6,7 +6,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
6
6
  as_both_colored_and_uncolored do |color_enabled|
7
7
  snippet = <<~TEST.strip
8
8
  expected = ["Einie", "Marty"]
9
- actual = ["Marty", "Jennifer", "Doc"]
9
+ actual = ["Marty", "Jennifer", "Doc"]
10
10
  expect(actual).to match_array(expected)
11
11
  TEST
12
12
  program = make_plain_test_program(
@@ -19,22 +19,23 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
19
19
  snippet: %|expect(actual).to match_array(expected)|,
20
20
  expectation: proc {
21
21
  line do
22
- plain "Expected "
23
- beta %|["Marty", "Jennifer", "Doc"]|
24
- plain " to match array with "
25
- alpha %|"Einie"|
26
- plain " and "
27
- alpha %|"Marty"|
28
- plain "."
22
+ plain %|Expected |
23
+ actual %|["Marty", "Jennifer", "Doc"]|
24
+ plain %| to match array with |
25
+ expected %|"Einie"|
26
+ plain %| and |
27
+ expected %|"Marty"|
28
+ plain %|.|
29
29
  end
30
30
  },
31
31
  diff: proc {
32
- plain_line %| [|
33
- plain_line %| "Marty",|
34
- plain_line %| "Jennifer",|
35
- plain_line %| "Doc",|
36
- alpha_line %|- "Einie"|
37
- plain_line %| ]|
32
+ plain_line %| [|
33
+ plain_line %| "Marty",|
34
+ actual_line %|+ "Jennifer",|
35
+ actual_line %|+ "Doc",|
36
+ # expected_line %|- "Einie"| # TODO
37
+ expected_line %|- "Einie",|
38
+ plain_line %| ]|
38
39
  },
39
40
  )
40
41
 
@@ -60,13 +61,13 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
60
61
  snippet: %|expect(values).not_to match_array(values)|,
61
62
  expectation: proc {
62
63
  line do
63
- plain "Expected "
64
- beta %|["Einie", "Marty"]|
65
- plain " not to match array with "
66
- alpha %|"Einie"|
67
- plain " and "
68
- alpha %|"Marty"|
69
- plain "."
64
+ plain %|Expected |
65
+ actual %|["Einie", "Marty"]|
66
+ plain %| not to match array with |
67
+ expected %|"Einie"|
68
+ plain %| and |
69
+ expected %|"Marty"|
70
+ plain %|.|
70
71
  end
71
72
  },
72
73
  )
@@ -90,7 +91,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
90
91
  "George McFly",
91
92
  "Lorraine McFly"
92
93
  ]
93
- actual = [
94
+ actual = [
94
95
  "Marty McFly",
95
96
  "Doc Brown",
96
97
  "Einie",
@@ -108,32 +109,33 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
108
109
  snippet: %|expect(actual).to match_array(expected)|,
109
110
  expectation: proc {
110
111
  line do
111
- plain " Expected "
112
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
112
+ plain %| Expected |
113
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
113
114
  end
114
115
 
115
116
  line do
116
- plain "to match array with "
117
- alpha %|"Doc Brown"|
118
- plain ", "
119
- alpha %|"Marty McFly"|
120
- plain ", "
121
- alpha %|"Biff Tannen"|
122
- plain ", "
123
- alpha %|"George McFly"|
124
- plain " and "
125
- alpha %|"Lorraine McFly"|
117
+ plain %|to match array with |
118
+ expected %|"Doc Brown"|
119
+ plain %|, |
120
+ expected %|"Marty McFly"|
121
+ plain %|, |
122
+ expected %|"Biff Tannen"|
123
+ plain %|, |
124
+ expected %|"George McFly"|
125
+ plain %| and |
126
+ expected %|"Lorraine McFly"|
126
127
  end
127
128
  },
128
129
  diff: proc {
129
- plain_line %| [|
130
- plain_line %| "Marty McFly",|
131
- plain_line %| "Doc Brown",|
132
- plain_line %| "Einie",|
133
- plain_line %| "Lorraine McFly",|
134
- alpha_line %|- "Biff Tannen",|
135
- alpha_line %|- "George McFly"|
136
- plain_line %| ]|
130
+ plain_line %| [|
131
+ plain_line %| "Marty McFly",|
132
+ plain_line %| "Doc Brown",|
133
+ plain_line %| "Lorraine McFly",|
134
+ actual_line %|+ "Einie",|
135
+ expected_line %|- "Biff Tannen",|
136
+ # expected_line %|- "George McFly"| # TODO
137
+ expected_line %|- "George McFly",|
138
+ plain_line %| ]|
137
139
  },
138
140
  )
139
141
 
@@ -165,19 +167,19 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
165
167
  newline_before_expectation: true,
166
168
  expectation: proc {
167
169
  line do
168
- plain " Expected "
169
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
170
+ plain %| Expected |
171
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
170
172
  end
171
173
 
172
174
  line do
173
- plain "not to match array with "
174
- alpha %|"Marty McFly"|
175
- plain ", "
176
- alpha %|"Doc Brown"|
177
- plain ", "
178
- alpha %|"Einie"|
179
- plain " and "
180
- alpha %|"Lorraine McFly"|
175
+ plain %|not to match array with |
176
+ expected %|"Marty McFly"|
177
+ plain %|, |
178
+ expected %|"Doc Brown"|
179
+ plain %|, |
180
+ expected %|"Einie"|
181
+ plain %| and |
182
+ expected %|"Lorraine McFly"|
181
183
  end
182
184
  },
183
185
  )
@@ -200,7 +202,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
200
202
  /Georg McFly/,
201
203
  /Lorrain McFly/
202
204
  ]
203
- actual = [
205
+ actual = [
204
206
  "Marty McFly",
205
207
  "Doc Brown",
206
208
  "Einie",
@@ -218,33 +220,34 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
218
220
  snippet: %|expect(actual).to match_array(expected)|,
219
221
  expectation: proc {
220
222
  line do
221
- plain " Expected "
222
- beta %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
223
+ plain %| Expected |
224
+ actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
223
225
  end
224
226
 
225
227
  line do
226
- plain "to match array with "
227
- alpha %|/ Brown$/|
228
- plain ", "
229
- alpha %|"Marty McFly"|
230
- plain ", "
231
- alpha %|"Biff Tannen"|
232
- plain ", "
233
- alpha %|/Georg McFly/|
234
- plain " and "
235
- alpha %|/Lorrain McFly/|
228
+ plain %|to match array with |
229
+ expected %|/ Brown$/|
230
+ plain %|, |
231
+ expected %|"Marty McFly"|
232
+ plain %|, |
233
+ expected %|"Biff Tannen"|
234
+ plain %|, |
235
+ expected %|/Georg McFly/|
236
+ plain %| and |
237
+ expected %|/Lorrain McFly/|
236
238
  end
237
239
  },
238
240
  diff: proc {
239
- plain_line %| [|
240
- plain_line %| "Marty McFly",|
241
- plain_line %| "Doc Brown",|
242
- plain_line %| "Einie",|
243
- plain_line %| "Lorraine McFly",|
244
- alpha_line %|- "Biff Tannen",|
245
- alpha_line %|- /Georg McFly/,|
246
- alpha_line %|- /Lorrain McFly/|
247
- plain_line %| ]|
241
+ plain_line %| [|
242
+ plain_line %| "Marty McFly",|
243
+ plain_line %| "Doc Brown",|
244
+ actual_line %|+ "Einie",|
245
+ actual_line %|+ "Lorraine McFly",|
246
+ expected_line %|- "Biff Tannen",|
247
+ expected_line %|- /Georg McFly/,|
248
+ # expected_line %|- /Lorrain McFly/| # TODO
249
+ expected_line %|- /Lorrain McFly/,|
250
+ plain_line %| ]|
248
251
  },
249
252
  )
250
253
 
@@ -277,23 +280,23 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
277
280
  newline_before_expectation: true,
278
281
  expectation: proc {
279
282
  line do
280
- plain " Expected "
283
+ plain %| Expected |
281
284
  # rubocop:disable Metrics/LineLength
282
- beta %|[/ Brown$/, "Marty McFly", "Biff Tannen", /Georg McFly/, /Lorrain McFly/]|
285
+ actual %|[/ Brown$/, "Marty McFly", "Biff Tannen", /Georg McFly/, /Lorrain McFly/]|
283
286
  # rubocop:enable Metrics/LineLength
284
287
  end
285
288
 
286
289
  line do
287
- plain "not to match array with "
288
- alpha %|/ Brown$/|
289
- plain ", "
290
- alpha %|"Marty McFly"|
291
- plain ", "
292
- alpha %|"Biff Tannen"|
293
- plain ", "
294
- alpha %|/Georg McFly/|
295
- plain " and "
296
- alpha %|/Lorrain McFly/|
290
+ plain %|not to match array with |
291
+ expected %|/ Brown$/|
292
+ plain %|, |
293
+ expected %|"Marty McFly"|
294
+ plain %|, |
295
+ expected %|"Biff Tannen"|
296
+ plain %|, |
297
+ expected %|/Georg McFly/|
298
+ plain %| and |
299
+ expected %|/Lorrain McFly/|
297
300
  end
298
301
  },
299
302
  )
@@ -314,7 +317,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
314
317
  a_collection_containing_exactly("zing"),
315
318
  an_object_having_attributes(baz: "qux"),
316
319
  ]
317
- actual = [
320
+ actual = [
318
321
  { foo: "bar" },
319
322
  double(baz: "qux"),
320
323
  { blargh: "riddle" }
@@ -331,34 +334,37 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
331
334
  snippet: %|expect(actual).to match_array(expected)|,
332
335
  expectation: proc {
333
336
  line do
334
- plain " Expected "
337
+ plain %| Expected |
335
338
  # rubocop:disable Metrics/LineLength
336
- beta %|[{ foo: "bar" }, #<Double (anonymous)>, { blargh: "riddle" }]|
339
+ actual %|[{ foo: "bar" }, #<Double (anonymous) baz: "qux">, { blargh: "riddle" }]|
337
340
  # rubocop:enable Metrics/LineLength
338
341
  end
339
342
 
340
343
  line do
341
- plain "to match array with "
342
- alpha %|#<a hash including (foo: "bar")>|
343
- plain ", "
344
- alpha %|#<a collection containing exactly ("zing")>|
345
- plain " and "
346
- alpha %|#<an object having attributes (baz: "qux")>|
344
+ plain %|to match array with |
345
+ expected %|#<a hash including (foo: "bar")>|
346
+ plain %|, |
347
+ expected %|#<a collection containing exactly ("zing")>|
348
+ plain %| and |
349
+ expected %|#<an object having attributes (baz: "qux")>|
347
350
  end
348
351
  },
349
352
  diff: proc {
350
- plain_line %| [|
351
- plain_line %| {|
352
- plain_line %| foo: "bar"|
353
- plain_line %| },|
354
- plain_line %| #<Double (anonymous)>,|
355
- plain_line %| {|
356
- plain_line %| blargh: "riddle"|
357
- plain_line %| },|
358
- alpha_line %|- #<a collection containing exactly (|
359
- alpha_line %|- "zing"|
360
- alpha_line %|- )>|
361
- plain_line %| ]|
353
+ plain_line %| [|
354
+ plain_line %| {|
355
+ plain_line %| foo: "bar"|
356
+ plain_line %| },|
357
+ plain_line %| #<Double (anonymous) {|
358
+ plain_line %| baz: "qux"|
359
+ plain_line %| }>,|
360
+ actual_line %|+ {|
361
+ actual_line %|+ blargh: "riddle"|
362
+ actual_line %|+ },|
363
+ expected_line %|- #<a collection containing exactly (|
364
+ expected_line %|- "zing"|
365
+ # expected_line %|- )>| # TODO
366
+ expected_line %|- )>,|
367
+ plain_line %| ]|
362
368
  },
363
369
  )
364
370
 
@@ -375,7 +381,7 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
375
381
  as_both_colored_and_uncolored do |color_enabled|
376
382
  snippet = <<~TEST.strip
377
383
  expected = "Einie"
378
- actual = ["Marty", "Jennifer", "Doc"]
384
+ actual = ["Marty", "Jennifer", "Doc"]
379
385
  expect(actual).to match_array(expected)
380
386
  TEST
381
387
  program = make_plain_test_program(
@@ -388,20 +394,21 @@ RSpec.describe "Integration with RSpec's #match_array matcher", type: :integrati
388
394
  snippet: %|expect(actual).to match_array(expected)|,
389
395
  expectation: proc {
390
396
  line do
391
- plain "Expected "
392
- beta %|["Marty", "Jennifer", "Doc"]|
393
- plain " to match array with "
394
- alpha %|"Einie"|
395
- plain "."
397
+ plain %|Expected |
398
+ actual %|["Marty", "Jennifer", "Doc"]|
399
+ plain %| to match array with |
400
+ expected %|"Einie"|
401
+ plain %|.|
396
402
  end
397
403
  },
398
404
  diff: proc {
399
- plain_line %| [|
400
- plain_line %| "Marty",|
401
- plain_line %| "Jennifer",|
402
- plain_line %| "Doc",|
403
- alpha_line %|- "Einie"|
404
- plain_line %| ]|
405
+ plain_line %| [|
406
+ actual_line %|+ "Marty",|
407
+ actual_line %|+ "Jennifer",|
408
+ actual_line %|+ "Doc",|
409
+ # expected_line %|- "Einie"| # TODO
410
+ expected_line %|- "Einie",|
411
+ plain_line %| ]|
405
412
  },
406
413
  )
407
414