super_diff 0.10.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -166
  3. data/lib/super_diff/active_record/differs/active_record_relation.rb +1 -1
  4. data/lib/super_diff/active_record/inspection_tree_builders/active_record_model.rb +57 -0
  5. data/lib/super_diff/active_record/inspection_tree_builders/active_record_relation.rb +34 -0
  6. data/lib/super_diff/active_record/inspection_tree_builders.rb +14 -0
  7. data/lib/super_diff/active_record/monkey_patches.rb +6 -3
  8. data/lib/super_diff/active_record/object_inspection.rb +16 -4
  9. data/lib/super_diff/active_record/operation_tree_builders/active_record_model.rb +6 -2
  10. data/lib/super_diff/active_record/operation_tree_builders/active_record_relation.rb +1 -1
  11. data/lib/super_diff/active_record/operation_tree_flatteners/active_record_relation.rb +1 -1
  12. data/lib/super_diff/active_record/operation_trees/active_record_relation.rb +1 -1
  13. data/lib/super_diff/active_record.rb +12 -16
  14. data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +1 -1
  15. data/lib/super_diff/active_support/inspection_tree_builders/hash_with_indifferent_access.rb +44 -0
  16. data/lib/super_diff/active_support/inspection_tree_builders/ordered_options.rb +44 -0
  17. data/lib/super_diff/active_support/inspection_tree_builders.rb +14 -0
  18. data/lib/super_diff/active_support/object_inspection.rb +16 -4
  19. data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +1 -1
  20. data/lib/super_diff/active_support/operation_tree_flatteners/hash_with_indifferent_access.rb +1 -1
  21. data/lib/super_diff/active_support/operation_trees/hash_with_indifferent_access.rb +1 -1
  22. data/lib/super_diff/active_support.rb +11 -14
  23. data/lib/super_diff/basic/diff_formatters/collection.rb +135 -0
  24. data/lib/super_diff/basic/diff_formatters/multiline_string.rb +34 -0
  25. data/lib/super_diff/basic/diff_formatters.rb +11 -0
  26. data/lib/super_diff/basic/differs/array.rb +17 -0
  27. data/lib/super_diff/basic/differs/custom_object.rb +19 -0
  28. data/lib/super_diff/basic/differs/date_like.rb +17 -0
  29. data/lib/super_diff/basic/differs/default_object.rb +24 -0
  30. data/lib/super_diff/basic/differs/hash.rb +17 -0
  31. data/lib/super_diff/basic/differs/multiline_string.rb +18 -0
  32. data/lib/super_diff/basic/differs/time_like.rb +17 -0
  33. data/lib/super_diff/basic/differs.rb +24 -0
  34. data/lib/super_diff/basic/inspection_tree_builders/array.rb +53 -0
  35. data/lib/super_diff/basic/inspection_tree_builders/custom_object.rb +41 -0
  36. data/lib/super_diff/basic/inspection_tree_builders/date_like.rb +51 -0
  37. data/lib/super_diff/basic/inspection_tree_builders/default_object.rb +77 -0
  38. data/lib/super_diff/basic/inspection_tree_builders/hash.rb +63 -0
  39. data/lib/super_diff/basic/inspection_tree_builders/primitive.rb +19 -0
  40. data/lib/super_diff/basic/inspection_tree_builders/time_like.rb +58 -0
  41. data/lib/super_diff/basic/inspection_tree_builders.rb +20 -0
  42. data/lib/super_diff/basic/operation_tree_builders/array.rb +111 -0
  43. data/lib/super_diff/basic/operation_tree_builders/custom_object.rb +42 -0
  44. data/lib/super_diff/basic/operation_tree_builders/date_like.rb +17 -0
  45. data/lib/super_diff/basic/operation_tree_builders/default_object.rb +117 -0
  46. data/lib/super_diff/basic/operation_tree_builders/hash.rb +222 -0
  47. data/lib/super_diff/basic/operation_tree_builders/multiline_string.rb +90 -0
  48. data/lib/super_diff/basic/operation_tree_builders/time_like.rb +26 -0
  49. data/lib/super_diff/basic/operation_tree_builders.rb +34 -0
  50. data/lib/super_diff/basic/operation_tree_flatteners/array.rb +17 -0
  51. data/lib/super_diff/basic/operation_tree_flatteners/collection.rb +140 -0
  52. data/lib/super_diff/basic/operation_tree_flatteners/custom_object.rb +30 -0
  53. data/lib/super_diff/basic/operation_tree_flatteners/default_object.rb +32 -0
  54. data/lib/super_diff/basic/operation_tree_flatteners/hash.rb +35 -0
  55. data/lib/super_diff/basic/operation_tree_flatteners/multiline_string.rb +20 -0
  56. data/lib/super_diff/basic/operation_tree_flatteners.rb +24 -0
  57. data/lib/super_diff/basic/operation_trees/array.rb +17 -0
  58. data/lib/super_diff/basic/operation_trees/custom_object.rb +17 -0
  59. data/lib/super_diff/basic/operation_trees/default_object.rb +42 -0
  60. data/lib/super_diff/basic/operation_trees/hash.rb +17 -0
  61. data/lib/super_diff/basic/operation_trees/multiline_string.rb +17 -0
  62. data/lib/super_diff/basic/operation_trees.rb +25 -0
  63. data/lib/super_diff/basic.rb +48 -0
  64. data/lib/super_diff/{differs/base.rb → core/abstract_differ.rb} +2 -2
  65. data/lib/super_diff/core/abstract_inspection_tree_builder.rb +26 -0
  66. data/lib/super_diff/{operation_trees/base.rb → core/abstract_operation_tree.rb} +6 -2
  67. data/lib/super_diff/{operation_tree_builders/base.rb → core/abstract_operation_tree_builder.rb} +4 -8
  68. data/lib/super_diff/{operation_tree_flatteners/base.rb → core/abstract_operation_tree_flattener.rb} +2 -2
  69. data/lib/super_diff/{operations → core}/binary_operation.rb +1 -1
  70. data/lib/super_diff/core/colorized_document_extensions.rb +20 -0
  71. data/lib/super_diff/core/configuration.rb +192 -0
  72. data/lib/super_diff/core/differ_dispatcher.rb +31 -0
  73. data/lib/super_diff/core/gem_version.rb +47 -0
  74. data/lib/super_diff/core/helpers.rb +88 -0
  75. data/lib/super_diff/core/implementation_checks.rb +21 -0
  76. data/lib/super_diff/{object_inspection → core}/inspection_tree.rb +32 -26
  77. data/lib/super_diff/core/inspection_tree_builder_dispatcher.rb +23 -0
  78. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/as_lines_when_rendering_to_lines.rb +12 -5
  79. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/as_prefix_when_rendering_to_lines.rb +3 -3
  80. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/as_prelude_when_rendering_to_lines.rb +3 -3
  81. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/as_single_line.rb +3 -3
  82. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/base.rb +2 -2
  83. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/inspection.rb +7 -11
  84. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/nesting.rb +2 -2
  85. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/only_when.rb +2 -2
  86. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/text.rb +2 -2
  87. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/when_empty.rb +2 -2
  88. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/when_non_empty.rb +2 -2
  89. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/when_rendering_to_lines.rb +2 -2
  90. data/lib/super_diff/{object_inspection/nodes → core/inspection_tree_nodes}/when_rendering_to_string.rb +2 -2
  91. data/lib/super_diff/core/inspection_tree_nodes.rb +55 -0
  92. data/lib/super_diff/core/line.rb +85 -0
  93. data/lib/super_diff/{errors → core}/no_differ_available_error.rb +1 -1
  94. data/lib/super_diff/core/no_inspection_tree_builder_available_error.rb +21 -0
  95. data/lib/super_diff/core/no_operation_tree_available_error.rb +20 -0
  96. data/lib/super_diff/{errors/no_operational_sequencer_available_error.rb → core/no_operation_tree_builder_available_error.rb} +6 -4
  97. data/lib/super_diff/{operation_tree_builders/main.rb → core/operation_tree_builder_dispatcher.rb} +9 -13
  98. data/lib/super_diff/core/operation_tree_finder.rb +27 -0
  99. data/lib/super_diff/core/prefix_for_next_inspection_tree_node.rb +6 -0
  100. data/lib/super_diff/core/prelude_for_next_inspection_tree_node.rb +6 -0
  101. data/lib/super_diff/core/recursion_guard.rb +52 -0
  102. data/lib/super_diff/core/tiered_lines.rb +6 -0
  103. data/lib/super_diff/core/tiered_lines_elider.rb +472 -0
  104. data/lib/super_diff/core/tiered_lines_formatter.rb +77 -0
  105. data/lib/super_diff/{operations → core}/unary_operation.rb +1 -1
  106. data/lib/super_diff/core.rb +69 -0
  107. data/lib/super_diff/differs.rb +19 -11
  108. data/lib/super_diff/equality_matchers/array.rb +3 -3
  109. data/lib/super_diff/equality_matchers/default.rb +8 -3
  110. data/lib/super_diff/equality_matchers/hash.rb +3 -3
  111. data/lib/super_diff/equality_matchers/multiline_string.rb +3 -3
  112. data/lib/super_diff/equality_matchers/primitive.rb +3 -3
  113. data/lib/super_diff/equality_matchers/singleline_string.rb +2 -2
  114. data/lib/super_diff/errors.rb +12 -12
  115. data/lib/super_diff/object_inspection.rb +63 -14
  116. data/lib/super_diff/operation_tree_builders.rb +19 -14
  117. data/lib/super_diff/operation_tree_flatteners.rb +19 -16
  118. data/lib/super_diff/operation_trees.rb +19 -9
  119. data/lib/super_diff/operations.rb +12 -2
  120. data/lib/super_diff/rspec/augmented_matcher.rb +1 -1
  121. data/lib/super_diff/rspec/differ.rb +4 -5
  122. data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +1 -1
  123. data/lib/super_diff/rspec/differs/collection_including.rb +1 -1
  124. data/lib/super_diff/rspec/differs/hash_including.rb +1 -1
  125. data/lib/super_diff/rspec/differs/object_having_attributes.rb +1 -1
  126. data/lib/super_diff/rspec/inspection_tree_builders/collection_containing_exactly.rb +34 -0
  127. data/lib/super_diff/rspec/inspection_tree_builders/collection_including.rb +40 -0
  128. data/lib/super_diff/rspec/inspection_tree_builders/double.rb +100 -0
  129. data/lib/super_diff/rspec/inspection_tree_builders/generic_describable_matcher.rb +17 -0
  130. data/lib/super_diff/rspec/inspection_tree_builders/hash_including.rb +40 -0
  131. data/lib/super_diff/rspec/inspection_tree_builders/instance_of.rb +25 -0
  132. data/lib/super_diff/rspec/inspection_tree_builders/kind_of.rb +25 -0
  133. data/lib/super_diff/rspec/inspection_tree_builders/object_having_attributes.rb +34 -0
  134. data/lib/super_diff/rspec/inspection_tree_builders/primitive.rb +9 -0
  135. data/lib/super_diff/rspec/inspection_tree_builders/value_within.rb +30 -0
  136. data/lib/super_diff/rspec/inspection_tree_builders.rb +40 -0
  137. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +3 -7
  138. data/lib/super_diff/rspec/monkey_patches.rb +59 -8
  139. data/lib/super_diff/rspec/object_inspection.rb +14 -4
  140. data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +4 -4
  141. data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +1 -1
  142. data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +1 -1
  143. data/lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb +2 -2
  144. data/lib/super_diff/rspec.rb +28 -25
  145. data/lib/super_diff/version.rb +1 -1
  146. data/lib/super_diff.rb +78 -21
  147. data/spec/examples.txt +704 -493
  148. data/spec/integration/rails/engines_spec.rb +8 -3
  149. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +19 -19
  150. data/spec/integration/rspec/eq_matcher_spec.rb +111 -39
  151. data/spec/integration/rspec/generic_describable_matchers_spec.rb +177 -0
  152. data/spec/integration/rspec/have_attributes_matcher_spec.rb +25 -25
  153. data/spec/integration/rspec/include_matcher_spec.rb +23 -23
  154. data/spec/integration/rspec/magic_metadata_spec.rb +51 -0
  155. data/spec/integration/rspec/match_array_matcher_spec.rb +30 -30
  156. data/spec/integration/rspec/match_matcher_spec.rb +93 -93
  157. data/spec/integration/rspec/raise_error_matcher_spec.rb +813 -69
  158. data/spec/internal/log/test.log +0 -0
  159. data/spec/spec_helper.rb +3 -0
  160. data/spec/support/integration/helpers.rb +19 -11
  161. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +1 -1
  162. data/spec/support/integration/matchers.rb +34 -0
  163. data/spec/support/integration/test_programs/base.rb +6 -6
  164. data/spec/support/integration/test_programs/rspec_rails_engine.rb +3 -13
  165. data/spec/support/models/active_record/person.rb +8 -1
  166. data/spec/support/shared_examples/active_record.rb +38 -38
  167. data/spec/support/shared_examples/active_support.rb +125 -4
  168. data/spec/support/shared_examples/elided_diffs.rb +48 -48
  169. data/spec/support/shared_examples/hash_with_indifferent_access.rb +88 -88
  170. data/spec/support/shared_examples/key.rb +10 -10
  171. data/spec/support/unit/helpers.rb +12 -1
  172. data/spec/support/unit/matchers/be_deprecated_in_favor_of.rb +39 -0
  173. data/spec/unit/active_record/object_inspection_spec.rb +5 -5
  174. data/spec/unit/active_support/object_inspection_spec.rb +170 -0
  175. data/spec/unit/{operation_tree_flatteners → basic/operation_tree_flatteners}/array_spec.rb +8 -8
  176. data/spec/unit/{operation_tree_flatteners → basic/operation_tree_flatteners}/custom_object_spec.rb +9 -9
  177. data/spec/unit/{operation_tree_flatteners → basic/operation_tree_flatteners}/default_object_spec.rb +9 -9
  178. data/spec/unit/{operation_tree_flatteners → basic/operation_tree_flatteners}/hash_spec.rb +8 -8
  179. data/spec/unit/{operation_tree_flatteners → basic/operation_tree_flatteners}/multiline_string_spec.rb +4 -4
  180. data/spec/unit/{helpers_spec.rb → core/helpers_spec.rb} +2 -2
  181. data/spec/unit/{tiered_lines_elider_spec.rb → core/tiered_lines_elider_spec.rb} +2 -2
  182. data/spec/unit/{tiered_lines_formatter_spec.rb → core/tiered_lines_formatter_spec.rb} +1 -1
  183. data/spec/unit/deprecations_spec.rb +176 -0
  184. data/spec/unit/equality_matchers/main_spec.rb +5 -5
  185. data/spec/unit/rspec/matchers/raise_error_spec.rb +43 -11
  186. data/spec/unit/rspec/object_inspection/rspec_matcher_spec.rb +91 -0
  187. data/spec/unit/rspec/object_inspection_spec.rb +2 -2
  188. data/spec/unit/super_diff_spec.rb +64 -0
  189. data/super_diff.gemspec +6 -0
  190. metadata +137 -112
  191. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_model.rb +0 -39
  192. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb +0 -27
  193. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb +0 -16
  194. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +0 -31
  195. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb +0 -12
  196. data/lib/super_diff/colorized_document_extensions.rb +0 -18
  197. data/lib/super_diff/configuration.rb +0 -149
  198. data/lib/super_diff/diff_formatters/collection.rb +0 -132
  199. data/lib/super_diff/diff_formatters/multiline_string.rb +0 -31
  200. data/lib/super_diff/differs/array.rb +0 -15
  201. data/lib/super_diff/differs/custom_object.rb +0 -17
  202. data/lib/super_diff/differs/default_object.rb +0 -19
  203. data/lib/super_diff/differs/defaults.rb +0 -12
  204. data/lib/super_diff/differs/empty.rb +0 -13
  205. data/lib/super_diff/differs/hash.rb +0 -15
  206. data/lib/super_diff/differs/main.rb +0 -31
  207. data/lib/super_diff/differs/multiline_string.rb +0 -16
  208. data/lib/super_diff/differs/time_like.rb +0 -15
  209. data/lib/super_diff/errors/no_diff_formatter_available_error.rb +0 -21
  210. data/lib/super_diff/gem_version.rb +0 -45
  211. data/lib/super_diff/helpers.rb +0 -86
  212. data/lib/super_diff/implementation_checks.rb +0 -19
  213. data/lib/super_diff/line.rb +0 -83
  214. data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +0 -34
  215. data/lib/super_diff/object_inspection/inspection_tree_builders/base.rb +0 -27
  216. data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +0 -31
  217. data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +0 -54
  218. data/lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb +0 -14
  219. data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +0 -38
  220. data/lib/super_diff/object_inspection/inspection_tree_builders/main.rb +0 -30
  221. data/lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb +0 -21
  222. data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +0 -47
  223. data/lib/super_diff/object_inspection/inspection_tree_builders.rb +0 -44
  224. data/lib/super_diff/object_inspection/nodes.rb +0 -50
  225. data/lib/super_diff/object_inspection/prefix_for_next_node.rb +0 -6
  226. data/lib/super_diff/object_inspection/prelude_for_next_node.rb +0 -6
  227. data/lib/super_diff/operation_tree_builders/array.rb +0 -107
  228. data/lib/super_diff/operation_tree_builders/custom_object.rb +0 -40
  229. data/lib/super_diff/operation_tree_builders/default_object.rb +0 -119
  230. data/lib/super_diff/operation_tree_builders/defaults.rb +0 -5
  231. data/lib/super_diff/operation_tree_builders/hash.rb +0 -218
  232. data/lib/super_diff/operation_tree_builders/multiline_string.rb +0 -86
  233. data/lib/super_diff/operation_tree_builders/time_like.rb +0 -24
  234. data/lib/super_diff/operation_tree_flatteners/array.rb +0 -15
  235. data/lib/super_diff/operation_tree_flatteners/collection.rb +0 -136
  236. data/lib/super_diff/operation_tree_flatteners/custom_object.rb +0 -28
  237. data/lib/super_diff/operation_tree_flatteners/default_object.rb +0 -31
  238. data/lib/super_diff/operation_tree_flatteners/hash.rb +0 -33
  239. data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +0 -18
  240. data/lib/super_diff/operation_trees/array.rb +0 -15
  241. data/lib/super_diff/operation_trees/custom_object.rb +0 -15
  242. data/lib/super_diff/operation_trees/default_object.rb +0 -40
  243. data/lib/super_diff/operation_trees/defaults.rb +0 -5
  244. data/lib/super_diff/operation_trees/hash.rb +0 -15
  245. data/lib/super_diff/operation_trees/main.rb +0 -35
  246. data/lib/super_diff/operation_trees/multiline_string.rb +0 -15
  247. data/lib/super_diff/recursion_guard.rb +0 -50
  248. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_containing_exactly.rb +0 -29
  249. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +0 -36
  250. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +0 -98
  251. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +0 -37
  252. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +0 -28
  253. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +0 -28
  254. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/object_having_attributes.rb +0 -29
  255. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/primitive.rb +0 -10
  256. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb +0 -33
  257. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +0 -44
  258. data/lib/super_diff/tiered_lines.rb +0 -4
  259. data/lib/super_diff/tiered_lines_elider.rb +0 -462
  260. data/lib/super_diff/tiered_lines_formatter.rb +0 -75
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
3
+ RSpec.describe SuperDiff::Basic::OperationTreeFlatteners::Array do
4
4
  context "given an empty tree" do
5
5
  it "returns a set of lines which are simply the open token and close token" do
6
6
  expect(described_class.call([])).to match(
@@ -30,7 +30,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
30
30
  it "returns a series of lines from inspecting each value, creating multiple lines upon encountering inner data structures" do
31
31
  collection = Array.new(3) { :some_value }
32
32
  operation_tree =
33
- SuperDiff::OperationTrees::Array.new(
33
+ SuperDiff::Basic::OperationTrees::Array.new(
34
34
  [
35
35
  double(
36
36
  :operation,
@@ -134,7 +134,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
134
134
  expected = Array.new(3) { :some_value }
135
135
  actual = Array.new(4) { :some_value }
136
136
  operation_tree =
137
- SuperDiff::OperationTrees::Array.new(
137
+ SuperDiff::Basic::OperationTrees::Array.new(
138
138
  [
139
139
  double(
140
140
  :operation,
@@ -266,7 +266,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
266
266
  collection = Array.new(3) { :some_value }
267
267
  subcollection = Array.new(2) { :some_value }
268
268
  operation_tree =
269
- SuperDiff::OperationTrees::Array.new(
269
+ SuperDiff::Basic::OperationTrees::Array.new(
270
270
  [
271
271
  double(
272
272
  :operation,
@@ -283,7 +283,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
283
283
  right_collection: collection,
284
284
  right_index: 1,
285
285
  children:
286
- SuperDiff::OperationTrees::Array.new(
286
+ SuperDiff::Basic::OperationTrees::Array.new(
287
287
  [
288
288
  double(
289
289
  :operation,
@@ -406,7 +406,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
406
406
  right_collection << right_collection
407
407
 
408
408
  operation_tree =
409
- SuperDiff::OperationTrees::Array.new(
409
+ SuperDiff::Basic::OperationTrees::Array.new(
410
410
  [
411
411
  double(
412
412
  :operation,
@@ -502,7 +502,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
502
502
  right_subcollection << right_subcollection
503
503
 
504
504
  operation_tree =
505
- SuperDiff::OperationTrees::Array.new(
505
+ SuperDiff::Basic::OperationTrees::Array.new(
506
506
  [
507
507
  double(
508
508
  :operation,
@@ -519,7 +519,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Array do
519
519
  right_collection: collection,
520
520
  right_index: 1,
521
521
  children:
522
- SuperDiff::OperationTrees::Array.new(
522
+ SuperDiff::Basic::OperationTrees::Array.new(
523
523
  [
524
524
  double(
525
525
  :operation,
@@ -1,10 +1,10 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
3
+ RSpec.describe SuperDiff::Basic::OperationTreeFlatteners::CustomObject do
4
4
  context "given an empty tree" do
5
5
  it "returns a set of lines which are simply the open token and close token" do
6
6
  operation_tree =
7
- SuperDiff::OperationTrees::CustomObject.new(
7
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
8
8
  [],
9
9
  underlying_object: underlying_object
10
10
  )
@@ -38,7 +38,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
38
38
  it "returns a series of lines from inspecting each value, creating multiple lines upon encountering inner data structures" do
39
39
  collection = Array.new(3) { :some_value }
40
40
  operation_tree =
41
- SuperDiff::OperationTrees::CustomObject.new(
41
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
42
42
  [
43
43
  double(
44
44
  :operation,
@@ -146,7 +146,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
146
146
  expected = Array.new(3) { :some_value }
147
147
  actual = Array.new(4) { :some_value }
148
148
  operation_tree =
149
- SuperDiff::OperationTrees::CustomObject.new(
149
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
150
150
  [
151
151
  double(
152
152
  :operation,
@@ -284,7 +284,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
284
284
  collection = Array.new(3) { :some_value }
285
285
  subcollection = Array.new(2) { :some_value }
286
286
  operation_tree =
287
- SuperDiff::OperationTrees::CustomObject.new(
287
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
288
288
  [
289
289
  double(
290
290
  :operation,
@@ -304,7 +304,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
304
304
  right_key: :baz,
305
305
  right_index: 1,
306
306
  children:
307
- SuperDiff::OperationTrees::CustomObject.new(
307
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
308
308
  [
309
309
  double(
310
310
  :operation,
@@ -435,7 +435,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
435
435
  .tap { |collection| collection << right_collection }
436
436
 
437
437
  operation_tree =
438
- SuperDiff::OperationTrees::CustomObject.new(
438
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
439
439
  [
440
440
  double(
441
441
  :operation,
@@ -536,7 +536,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
536
536
  Array.new(1) { :some_value }.tap { |coll| coll << right_subcollection }
537
537
 
538
538
  operation_tree =
539
- SuperDiff::OperationTrees::CustomObject.new(
539
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
540
540
  [
541
541
  double(
542
542
  :operation,
@@ -556,7 +556,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::CustomObject do
556
556
  right_key: :baz,
557
557
  right_index: 1,
558
558
  children:
559
- SuperDiff::OperationTrees::CustomObject.new(
559
+ SuperDiff::Basic::OperationTrees::CustomObject.new(
560
560
  [
561
561
  double(
562
562
  :operation,
@@ -1,10 +1,10 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
3
+ RSpec.describe SuperDiff::Basic::OperationTreeFlatteners::DefaultObject do
4
4
  context "given an empty tree" do
5
5
  it "returns a set of lines which are simply the open token and close token" do
6
6
  operation_tree =
7
- SuperDiff::OperationTrees::DefaultObject.new(
7
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
8
8
  [],
9
9
  underlying_object: underlying_object
10
10
  )
@@ -38,7 +38,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
38
38
  it "returns a series of lines from inspecting each value, creating multiple lines upon encountering inner data structures" do
39
39
  collection = Array.new(3) { :some_value }
40
40
  operation_tree =
41
- SuperDiff::OperationTrees::DefaultObject.new(
41
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
42
42
  [
43
43
  double(
44
44
  :operation,
@@ -146,7 +146,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
146
146
  expected = Array.new(3) { :some_value }
147
147
  actual = Array.new(4) { :some_value }
148
148
  operation_tree =
149
- SuperDiff::OperationTrees::DefaultObject.new(
149
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
150
150
  [
151
151
  double(
152
152
  :operation,
@@ -284,7 +284,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
284
284
  collection = Array.new(3) { :some_value }
285
285
  subcollection = Array.new(2) { :some_value }
286
286
  operation_tree =
287
- SuperDiff::OperationTrees::DefaultObject.new(
287
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
288
288
  [
289
289
  double(
290
290
  :operation,
@@ -304,7 +304,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
304
304
  right_key: :baz,
305
305
  right_index: 1,
306
306
  children:
307
- SuperDiff::OperationTrees::DefaultObject.new(
307
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
308
308
  [
309
309
  double(
310
310
  :operation,
@@ -435,7 +435,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
435
435
  .tap { |collection| collection << right_collection }
436
436
 
437
437
  operation_tree =
438
- SuperDiff::OperationTrees::DefaultObject.new(
438
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
439
439
  [
440
440
  double(
441
441
  :operation,
@@ -536,7 +536,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
536
536
  Array.new(1) { :some_value }.tap { |coll| coll << right_subcollection }
537
537
 
538
538
  operation_tree =
539
- SuperDiff::OperationTrees::DefaultObject.new(
539
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
540
540
  [
541
541
  double(
542
542
  :operation,
@@ -556,7 +556,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::DefaultObject do
556
556
  right_key: :baz,
557
557
  right_index: 1,
558
558
  children:
559
- SuperDiff::OperationTrees::DefaultObject.new(
559
+ SuperDiff::Basic::OperationTrees::DefaultObject.new(
560
560
  [
561
561
  double(
562
562
  :operation,
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
3
+ RSpec.describe SuperDiff::Basic::OperationTreeFlatteners::Hash do
4
4
  context "given an empty tree" do
5
5
  it "returns a set of lines which are simply the open token and close token" do
6
6
  expect(described_class.call([])).to match(
@@ -30,7 +30,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
30
30
  it "returns a series of lines from inspecting each value, creating multiple lines upon encountering inner data structures" do
31
31
  collection = Array.new(3) { :some_value }
32
32
  operation_tree =
33
- SuperDiff::OperationTrees::Hash.new(
33
+ SuperDiff::Basic::OperationTrees::Hash.new(
34
34
  [
35
35
  double(
36
36
  :operation,
@@ -140,7 +140,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
140
140
  expected = Array.new(3) { :some_value }
141
141
  actual = Array.new(4) { :some_value }
142
142
  operation_tree =
143
- SuperDiff::OperationTrees::Hash.new(
143
+ SuperDiff::Basic::OperationTrees::Hash.new(
144
144
  [
145
145
  double(
146
146
  :operation,
@@ -280,7 +280,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
280
280
  collection = Array.new(3) { :some_value }
281
281
  subcollection = Array.new(2) { :some_value }
282
282
  operation_tree =
283
- SuperDiff::OperationTrees::Hash.new(
283
+ SuperDiff::Basic::OperationTrees::Hash.new(
284
284
  [
285
285
  double(
286
286
  :operation,
@@ -300,7 +300,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
300
300
  right_key: :baz,
301
301
  right_index: 1,
302
302
  children:
303
- SuperDiff::OperationTrees::Hash.new(
303
+ SuperDiff::Basic::OperationTrees::Hash.new(
304
304
  [
305
305
  double(
306
306
  :operation,
@@ -429,7 +429,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
429
429
  .tap { |collection| collection << right_collection }
430
430
 
431
431
  operation_tree =
432
- SuperDiff::OperationTrees::Hash.new(
432
+ SuperDiff::Basic::OperationTrees::Hash.new(
433
433
  [
434
434
  double(
435
435
  :operation,
@@ -529,7 +529,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
529
529
  Array.new(1) { :some_value }.tap { |coll| coll << right_subcollection }
530
530
 
531
531
  operation_tree =
532
- SuperDiff::OperationTrees::Hash.new(
532
+ SuperDiff::Basic::OperationTrees::Hash.new(
533
533
  [
534
534
  double(
535
535
  :operation,
@@ -549,7 +549,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::Hash do
549
549
  right_key: :baz,
550
550
  right_index: 1,
551
551
  children:
552
- SuperDiff::OperationTrees::Hash.new(
552
+ SuperDiff::Basic::OperationTrees::Hash.new(
553
553
  [
554
554
  double(
555
555
  :operation,
@@ -1,9 +1,9 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::OperationTreeFlatteners::MultilineString do
3
+ RSpec.describe SuperDiff::Basic::OperationTreeFlatteners::MultilineString do
4
4
  context "given an empty tree" do
5
5
  it "returns an empty set of lines" do
6
- operation_tree = SuperDiff::OperationTrees::MultilineString.new([])
6
+ operation_tree = SuperDiff::Basic::OperationTrees::MultilineString.new([])
7
7
  flattened_operation_tree = described_class.call(operation_tree)
8
8
  expect(flattened_operation_tree).to eq([])
9
9
  end
@@ -13,7 +13,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::MultilineString do
13
13
  it "returns a series of lines from printing each value" do
14
14
  collection = Array.new(3) { :some_value }
15
15
  operation_tree =
16
- SuperDiff::OperationTrees::MultilineString.new(
16
+ SuperDiff::Basic::OperationTrees::MultilineString.new(
17
17
  [
18
18
  double(
19
19
  :operation,
@@ -73,7 +73,7 @@ RSpec.describe SuperDiff::OperationTreeFlatteners::MultilineString do
73
73
  it "returns a series of lines from printing each value" do
74
74
  collection = Array.new(3) { :some_value }
75
75
  operation_tree =
76
- SuperDiff::OperationTrees::MultilineString.new(
76
+ SuperDiff::Basic::OperationTrees::MultilineString.new(
77
77
  [
78
78
  double(
79
79
  :operation,
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::Helpers do
3
+ RSpec.describe SuperDiff::Core::Helpers do
4
4
  shared_examples "helper tests" do
5
5
  describe "with_slice_of_array_replaced" do
6
6
  context "if the given range covers the whole array" do
@@ -32,7 +32,7 @@ RSpec.describe SuperDiff::Helpers do
32
32
  end
33
33
 
34
34
  describe "object_address_for" do
35
- if SuperDiff::Helpers.ruby_version_matches?(">= 2.7.0")
35
+ if SuperDiff::Core::Helpers.ruby_version_matches?(">= 2.7.0")
36
36
  it "returns an empty string for Floats" do
37
37
  expect(helper.object_address_for(1.0)).to eq("")
38
38
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::TieredLinesElider, type: :unit do
3
+ RSpec.describe SuperDiff::Core::TieredLinesElider, type: :unit do
4
4
  context "and the gem is configured with :diff_elision_maximum" do
5
5
  context "and :diff_elision_maximum is more than 0" do
6
6
  context "and the line tree contains a section of noops that does not span more than the maximum" do
@@ -6299,7 +6299,7 @@ RSpec.describe SuperDiff::TieredLinesElider, type: :unit do
6299
6299
 
6300
6300
  def an_actual_line(**args)
6301
6301
  add_comma = args.delete(:add_comma?) { false }
6302
- SuperDiff::Line.new(**args, add_comma: add_comma)
6302
+ SuperDiff::Core::Line.new(**args, add_comma: add_comma)
6303
6303
  end
6304
6304
 
6305
6305
  def an_expected_line(type:, indentation_level:, value:, children: [], **rest)
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::TieredLinesFormatter, type: :unit do
3
+ RSpec.describe SuperDiff::Core::TieredLinesFormatter, type: :unit do
4
4
  it "formats the given lines as an array of strings with appropriate colors and indentation" do
5
5
  tiered_lines = [
6
6
  line(type: :noop, indentation_level: 0, value: "["),
@@ -0,0 +1,176 @@
1
+ require "spec_helper"
2
+
3
+ # stree-ignore
4
+ common_constant_remappings = {
5
+ "SuperDiff::ColorizedDocumentExtensions" => "SuperDiff::Core::ColorizedDocumentExtensions",
6
+ "SuperDiff::Configuration" => "SuperDiff::Core::Configuration",
7
+ # TODO: Add back?
8
+ # "SuperDiff::DiffFormatters::Collection" => "SuperDiff::Basic::DiffFormatters::Collection",
9
+ # "SuperDiff::DiffFormatters::MultilineString" => "SuperDiff::Basic::DiffFormatters::MultilineString",
10
+ "SuperDiff::Differs::Array" => "SuperDiff::Basic::Differs::Array",
11
+ "SuperDiff::Differs::Base" => "SuperDiff::Core::AbstractDiffer",
12
+ "SuperDiff::Differs::CustomObject" => "SuperDiff::Basic::Differs::CustomObject",
13
+ "SuperDiff::Differs::DateLike" => "SuperDiff::Basic::Differs::DateLike",
14
+ "SuperDiff::Differs::DefaultObject" => "SuperDiff::Basic::Differs::DefaultObject",
15
+ "SuperDiff::Differs::Hash" => "SuperDiff::Basic::Differs::Hash",
16
+ "SuperDiff::Differs::MultilineString" => "SuperDiff::Basic::Differs::MultilineString",
17
+ "SuperDiff::Differs::TimeLike" => "SuperDiff::Basic::Differs::TimeLike",
18
+ "SuperDiff::Errors::NoDifferAvailableError" => "SuperDiff::Core::NoDifferAvailableError",
19
+ "SuperDiff::GemVersion" => "SuperDiff::Core::GemVersion",
20
+ "SuperDiff::Helpers" => "SuperDiff::Core::Helpers",
21
+ "SuperDiff::ImplementationChecks" => "SuperDiff::Core::ImplementationChecks",
22
+ "SuperDiff::Line" => "SuperDiff::Core::Line",
23
+ "SuperDiff::ObjectInspection::InspectionTree" => "SuperDiff::Core::InspectionTree",
24
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::Array" => "SuperDiff::Basic::InspectionTreeBuilders::Array",
25
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::Base" => "SuperDiff::Core::AbstractInspectionTreeBuilder",
26
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::CustomObject" => "SuperDiff::Basic::InspectionTreeBuilders::CustomObject",
27
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::DateLike" => "SuperDiff::Basic::InspectionTreeBuilders::DateLike",
28
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::DefaultObject" => "SuperDiff::Basic::InspectionTreeBuilders::DefaultObject",
29
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::Hash" => "SuperDiff::Basic::InspectionTreeBuilders::Hash",
30
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::Primitive" => "SuperDiff::Basic::InspectionTreeBuilders::Primitive",
31
+ "SuperDiff::ObjectInspection::InspectionTreeBuilders::TimeLike" => "SuperDiff::Basic::InspectionTreeBuilders::TimeLike",
32
+ "SuperDiff::ObjectInspection::Nodes::AsLinesWhenRenderingToLines" => "SuperDiff::Core::InspectionTreeNodes::AsLinesWhenRenderingToLines",
33
+ "SuperDiff::ObjectInspection::Nodes::AsPrefixWhenRenderingToLines" => "SuperDiff::Core::InspectionTreeNodes::AsPrefixWhenRenderingToLines",
34
+ "SuperDiff::ObjectInspection::Nodes::AsPreludeWhenRenderingToLines" => "SuperDiff::Core::InspectionTreeNodes::AsPreludeWhenRenderingToLines",
35
+ "SuperDiff::ObjectInspection::Nodes::AsSingleLine" => "SuperDiff::Core::InspectionTreeNodes::AsSingleLine",
36
+ "SuperDiff::ObjectInspection::Nodes::Base" => "SuperDiff::Core::InspectionTreeNodes::Base",
37
+ "SuperDiff::ObjectInspection::Nodes::Inspection" => "SuperDiff::Core::InspectionTreeNodes::Inspection",
38
+ "SuperDiff::ObjectInspection::Nodes::Nesting" => "SuperDiff::Core::InspectionTreeNodes::Nesting",
39
+ "SuperDiff::ObjectInspection::Nodes::OnlyWhen" => "SuperDiff::Core::InspectionTreeNodes::OnlyWhen",
40
+ "SuperDiff::ObjectInspection::Nodes::Text" => "SuperDiff::Core::InspectionTreeNodes::Text",
41
+ "SuperDiff::ObjectInspection::Nodes::WhenEmpty" => "SuperDiff::Core::InspectionTreeNodes::WhenEmpty",
42
+ "SuperDiff::ObjectInspection::Nodes::WhenNonEmpty" => "SuperDiff::Core::InspectionTreeNodes::WhenNonEmpty",
43
+ "SuperDiff::ObjectInspection::Nodes::WhenRenderingToLines" => "SuperDiff::Core::InspectionTreeNodes::WhenRenderingToLines",
44
+ "SuperDiff::ObjectInspection::Nodes::WhenRenderingToString" => "SuperDiff::Core::InspectionTreeNodes::WhenRenderingToString",
45
+ "SuperDiff::ObjectInspection::PrefixForNextNode" => "SuperDiff::Core::PrefixForNextInspectionTreeNode",
46
+ "SuperDiff::ObjectInspection::PreludeForNextNode" => "SuperDiff::Core::PreludeForNextInspectionTreeNode",
47
+ "SuperDiff::OperationTreeBuilders::Array" => "SuperDiff::Basic::OperationTreeBuilders::Array",
48
+ "SuperDiff::OperationTreeBuilders::Base" => "SuperDiff::Core::AbstractOperationTreeBuilder",
49
+ "SuperDiff::OperationTreeBuilders::CustomObject" => "SuperDiff::Basic::OperationTreeBuilders::CustomObject",
50
+ "SuperDiff::OperationTreeBuilders::DateLike" => "SuperDiff::Basic::OperationTreeBuilders::DateLike",
51
+ "SuperDiff::OperationTreeBuilders::DefaultObject" => "SuperDiff::Basic::OperationTreeBuilders::DefaultObject",
52
+ "SuperDiff::OperationTreeBuilders::Hash" => "SuperDiff::Basic::OperationTreeBuilders::Hash",
53
+ "SuperDiff::OperationTreeBuilders::MultilineString" => "SuperDiff::Basic::OperationTreeBuilders::MultilineString",
54
+ "SuperDiff::OperationTreeBuilders::TimeLike" => "SuperDiff::Basic::OperationTreeBuilders::TimeLike",
55
+ "SuperDiff::OperationTreeFlatteners::Array" => "SuperDiff::Basic::OperationTreeFlatteners::Array",
56
+ "SuperDiff::OperationTreeFlatteners::Base" => "SuperDiff::Core::AbstractOperationTreeFlattener",
57
+ "SuperDiff::OperationTreeFlatteners::Collection" => "SuperDiff::Basic::OperationTreeFlatteners::Collection",
58
+ "SuperDiff::OperationTreeFlatteners::CustomObject" => "SuperDiff::Basic::OperationTreeFlatteners::CustomObject",
59
+ "SuperDiff::OperationTreeFlatteners::DefaultObject" => "SuperDiff::Basic::OperationTreeFlatteners::DefaultObject",
60
+ "SuperDiff::OperationTreeFlatteners::Hash" => "SuperDiff::Basic::OperationTreeFlatteners::Hash",
61
+ "SuperDiff::OperationTreeFlatteners::MultilineString" => "SuperDiff::Basic::OperationTreeFlatteners::MultilineString",
62
+ "SuperDiff::OperationTrees::Array" => "SuperDiff::Basic::OperationTrees::Array",
63
+ "SuperDiff::OperationTrees::Base" => "SuperDiff::Core::AbstractOperationTree",
64
+ "SuperDiff::OperationTrees::CustomObject" => "SuperDiff::Basic::OperationTrees::CustomObject",
65
+ "SuperDiff::OperationTrees::DefaultObject" => "SuperDiff::Basic::OperationTrees::DefaultObject",
66
+ "SuperDiff::OperationTrees::Hash" => "SuperDiff::Basic::OperationTrees::Hash",
67
+ "SuperDiff::OperationTrees::MultilineString" => "SuperDiff::Basic::OperationTrees::MultilineString",
68
+ "SuperDiff::Operations::BinaryOperation" => "SuperDiff::Core::BinaryOperation",
69
+ "SuperDiff::Operations::UnaryOperation" => "SuperDiff::Core::UnaryOperation",
70
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::CollectionContainingExactly" => "SuperDiff::RSpec::InspectionTreeBuilders::CollectionContainingExactly",
71
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::CollectionIncluding" => "SuperDiff::RSpec::InspectionTreeBuilders::CollectionIncluding",
72
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::Double" => "SuperDiff::RSpec::InspectionTreeBuilders::Double",
73
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::GenericDescribableMatcher" => "SuperDiff::RSpec::InspectionTreeBuilders::GenericDescribableMatcher",
74
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::HashIncluding" => "SuperDiff::RSpec::InspectionTreeBuilders::HashIncluding",
75
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::InstanceOf" => "SuperDiff::RSpec::InspectionTreeBuilders::InstanceOf",
76
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::KindOf" => "SuperDiff::RSpec::InspectionTreeBuilders::KindOf",
77
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::ObjectHavingAttributes" => "SuperDiff::RSpec::InspectionTreeBuilders::ObjectHavingAttributes",
78
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::Primitive" => "SuperDiff::RSpec::InspectionTreeBuilders::Primitive",
79
+ "SuperDiff::RSpec::ObjectInspection::InspectionTreeBuilders::ValueWithin" => "SuperDiff::RSpec::InspectionTreeBuilders::ValueWithin",
80
+ "SuperDiff::RecursionGuard" => "SuperDiff::Core::RecursionGuard",
81
+ "SuperDiff::TieredLines" => "SuperDiff::Core::TieredLines",
82
+ "SuperDiff::TieredLinesElider" => "SuperDiff::Core::TieredLinesElider",
83
+ "SuperDiff::TieredLinesFormatter" => "SuperDiff::Core::TieredLinesFormatter",
84
+ }
85
+
86
+ # stree-ignore
87
+ active_record_constant_remappings = {
88
+ "SuperDiff::ActiveRecord::ObjectInspection::InspectionTreeBuilders::ActiveRecordModel" => "SuperDiff::ActiveRecord::InspectionTreeBuilders::ActiveRecordModel",
89
+ "SuperDiff::ActiveRecord::ObjectInspection::InspectionTreeBuilders::ActiveRecordRelation" => "SuperDiff::ActiveRecord::InspectionTreeBuilders::ActiveRecordRelation",
90
+ }
91
+
92
+ # stree-ignore
93
+ active_support_constant_remappings = {
94
+ "SuperDiff::ActiveSupport::ObjectInspection::InspectionTreeBuilders::HashWithIndifferentAccess" => "SuperDiff::ActiveSupport::InspectionTreeBuilders::HashWithIndifferentAccess",
95
+ "SuperDiff::ActiveSupport::ObjectInspection::InspectionTreeBuilders::OrderedOptions" => "SuperDiff::ActiveSupport::InspectionTreeBuilders::OrderedOptions",
96
+ }
97
+
98
+ common_constant_remappings.each do |old_constant_name, new_constant_name|
99
+ RSpec.describe old_constant_name, type: :unit do
100
+ it "maps to #{new_constant_name}" do
101
+ capture_warnings do
102
+ expect(Object.const_get(old_constant_name)).to be(
103
+ Object.const_get(new_constant_name)
104
+ )
105
+ end
106
+ end
107
+
108
+ it "points users to #{new_constant_name} instead" do
109
+ expect(old_constant_name).to be_deprecated_in_favor_of(new_constant_name)
110
+ end
111
+ end
112
+ end
113
+
114
+ active_record_constant_remappings.each do |old_constant_name, new_constant_name|
115
+ RSpec.describe old_constant_name, type: :unit, active_record: true do
116
+ it "maps to #{new_constant_name}" do
117
+ capture_warnings do
118
+ expect(Object.const_get(old_constant_name)).to be(
119
+ Object.const_get(new_constant_name)
120
+ )
121
+ end
122
+ end
123
+
124
+ it "points users to #{new_constant_name} instead" do
125
+ expect(old_constant_name).to be_deprecated_in_favor_of(new_constant_name)
126
+ end
127
+ end
128
+ end
129
+
130
+ active_support_constant_remappings.each do |old_constant_name, new_constant_name|
131
+ RSpec.describe old_constant_name, type: :unit, active_support: true do
132
+ it "maps to #{new_constant_name}" do
133
+ capture_warnings do
134
+ expect(Object.const_get(old_constant_name)).to be(
135
+ Object.const_get(new_constant_name)
136
+ )
137
+ end
138
+ end
139
+
140
+ it "points users to #{new_constant_name} instead" do
141
+ expect(old_constant_name).to be_deprecated_in_favor_of(new_constant_name)
142
+ end
143
+ end
144
+ end
145
+
146
+ RSpec.describe "SuperDiff::Differs::Main.call", type: :unit do
147
+ it "maps to SuperDiff.diff" do
148
+ capture_warnings do
149
+ diff_before = SuperDiff::Differs::Main.call(1, 2)
150
+ diff_after = SuperDiff.diff(1, 2)
151
+ expect(diff_before).to eq(diff_after)
152
+ end
153
+ end
154
+ end
155
+
156
+ RSpec.describe "SuperDiff::OperationTreeBuilders::Main.call", type: :unit do
157
+ it "maps to SuperDiff.build_operation_tree_for" do
158
+ capture_warnings do
159
+ operation_tree_builder_before =
160
+ SuperDiff::OperationTreeBuilders::Main.call(1, 2)
161
+ operation_tree_builder_after = SuperDiff.build_operation_tree_for(1, 2)
162
+ expect(operation_tree_builder_before).to eq(operation_tree_builder_after)
163
+ end
164
+ end
165
+ end
166
+
167
+ RSpec.describe "SuperDiff::OperationTrees::Main.call", type: :unit do
168
+ it "maps to SuperDiff.find_operation_tree_for" do
169
+ capture_warnings do
170
+ operation_tree_before =
171
+ SuperDiff::OperationTrees::Main.call(%i[foo bar baz])
172
+ operation_tree_after = SuperDiff.find_operation_tree_for(%i[foo bar baz])
173
+ expect(operation_tree_before).to eq(operation_tree_after)
174
+ end
175
+ end
176
+ end
@@ -1598,8 +1598,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main, type: :unit do
1598
1598
 
1599
1599
  #{
1600
1600
  colored do
1601
- expected_line %(Expected: #<SuperDiff::Test::Player:#{SuperDiff::Helpers.object_address_for(expected)} @character="mirage", @handle="martymcfly", @health=0.3, @inventory=["flatline", "purple body shield"], @shields=0.6, @ultimate=0.8>)
1602
- actual_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Helpers.object_address_for(actual)} @character="lifeline", @handle="docbrown", @health=0.3, @inventory=["wingman", "mastiff"], @shields=0.6, @ultimate=0.8>)
1601
+ expected_line %(Expected: #<SuperDiff::Test::Player:#{SuperDiff::Core::Helpers.object_address_for(expected)} @character="mirage", @handle="martymcfly", @health=0.3, @inventory=["flatline", "purple body shield"], @shields=0.6, @ultimate=0.8>)
1602
+ actual_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Core::Helpers.object_address_for(actual)} @character="lifeline", @handle="docbrown", @health=0.3, @inventory=["wingman", "mastiff"], @shields=0.6, @ultimate=0.8>)
1603
1603
  end
1604
1604
  }
1605
1605
 
@@ -1607,7 +1607,7 @@ RSpec.describe SuperDiff::EqualityMatchers::Main, type: :unit do
1607
1607
 
1608
1608
  #{
1609
1609
  colored do
1610
- plain_line %( #<SuperDiff::Test::Player:#{SuperDiff::Helpers.object_address_for(actual)} {)
1610
+ plain_line %( #<SuperDiff::Test::Player:#{SuperDiff::Core::Helpers.object_address_for(actual)} {)
1611
1611
  expected_line %(- @character="mirage",)
1612
1612
  actual_line %(+ @character="lifeline",)
1613
1613
  expected_line %(- @handle="martymcfly",)
@@ -1677,8 +1677,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main, type: :unit do
1677
1677
 
1678
1678
  #{
1679
1679
  colored do
1680
- expected_line %(Expected: #<SuperDiff::Test::Item:#{SuperDiff::Helpers.object_address_for(expected)} @name="camera", @quantity=3>)
1681
- actual_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Helpers.object_address_for(actual)} @character="Jon", @handle="mcmire", @health=4, @inventory=["sword"], @shields=11.4, @ultimate=true>)
1680
+ expected_line %(Expected: #<SuperDiff::Test::Item:#{SuperDiff::Core::Helpers.object_address_for(expected)} @name="camera", @quantity=3>)
1681
+ actual_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Core::Helpers.object_address_for(actual)} @character="Jon", @handle="mcmire", @health=4, @inventory=["sword"], @shields=11.4, @ultimate=true>)
1682
1682
  end
1683
1683
  }
1684
1684
  STR
@@ -5,39 +5,71 @@ RSpec.describe "RSpec's `raise_error` matcher" do
5
5
  context "given only an exception class" do
6
6
  it "returns the correct output" do
7
7
  expect(raise_error(RuntimeError).description).to eq(
8
- "raise error #<RuntimeError>"
8
+ "raise a kind of RuntimeError"
9
9
  )
10
10
  end
11
11
  end
12
12
 
13
- context "with only a message (and assuming a RuntimeError)" do
13
+ context "given only a string message" do
14
14
  it "returns the correct output" do
15
15
  expect(raise_error("hell").description).to eq(
16
- %|raise error #<Exception "hell">|
16
+ %|raise a kind of Exception with message "hell"|
17
17
  )
18
18
  end
19
19
  end
20
20
 
21
- context "with regular expression as message (and assuming a RuntimeError)" do
21
+ context "given only a regexp message" do
22
22
  it "returns the correct output" do
23
- expect(raise_error(/hell/).description).to eq(
24
- "raise error #<Exception /hell/>"
23
+ expect(raise_error(/hell/i).description).to eq(
24
+ "raise a kind of Exception with message matching /hell/i"
25
25
  )
26
26
  end
27
27
  end
28
28
 
29
- context "with both an exception and a message" do
29
+ context "given both an exception and string message" do
30
30
  it "returns the correct output" do
31
31
  expect(raise_error(RuntimeError, "hell").description).to eq(
32
- %|raise error #<RuntimeError "hell">|
32
+ %|raise a kind of RuntimeError with message "hell"|
33
33
  )
34
34
  end
35
35
  end
36
36
 
37
- context "with an exception and a regular expression as message" do
37
+ context "given both an exception and regexp message" do
38
38
  it "returns the correct output" do
39
- expect(raise_error(RuntimeError, /hell/).description).to eq(
40
- "raise error #<RuntimeError /hell/>"
39
+ expect(raise_error(RuntimeError, /hell/i).description).to eq(
40
+ "raise a kind of RuntimeError with message matching /hell/i"
41
+ )
42
+ end
43
+ end
44
+
45
+ context "given a simple RSpec matcher" do
46
+ it "returns the correct output" do
47
+ expect(raise_error(a_kind_of(RuntimeError)).description).to eq(
48
+ "raise #<a kind of RuntimeError>"
49
+ )
50
+ end
51
+ end
52
+
53
+ context "given a simple RSpec matcher and string message" do
54
+ it "returns the correct output" do
55
+ expect(raise_error(a_kind_of(RuntimeError), "boo").description).to eq(
56
+ 'raise #<a kind of RuntimeError> with message "boo"'
57
+ )
58
+ end
59
+ end
60
+
61
+ context "given a simple RSpec matcher and regexp message" do
62
+ it "returns the correct output" do
63
+ expect(raise_error(a_kind_of(RuntimeError), /boo/i).description).to eq(
64
+ "raise #<a kind of RuntimeError> with message matching /boo/i"
65
+ )
66
+ end
67
+ end
68
+
69
+ context "given a compound RSpec matcher" do
70
+ it "returns the correct output" do
71
+ expect(raise_error(a_kind_of(Array).or eq(true)).description).to eq(
72
+ "raise #<a kind of Array or eq true>"
41
73
  )
42
74
  end
43
75
  end