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
@@ -0,0 +1,91 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe SuperDiff, type: :unit do
4
+ describe ".inspect_object", "for RSpec matchers" do
5
+ context "given a custom matcher" do
6
+ let(:custom_matcher) do
7
+ proc do |expected, &block_arg|
8
+ declarations =
9
+ proc do
10
+ match do |actual|
11
+ actual.is_a?(Integer) && actual >= 0 &&
12
+ (Math.sqrt(actual) % 1).zero?
13
+ end
14
+ description { "be a perfect square" }
15
+ end
16
+ RSpec::Matchers::DSL::Matcher.new(
17
+ :be_a_square,
18
+ declarations,
19
+ RSpec::Matchers::DSL,
20
+ *expected,
21
+ &block_arg
22
+ )
23
+ end
24
+ end
25
+
26
+ context "given as_lines: false" do
27
+ it "returns the matcher's description string" do
28
+ string =
29
+ described_class.inspect_object(
30
+ custom_matcher.call(4),
31
+ as_lines: false
32
+ )
33
+ expect(string).to eq("#<be a perfect square>")
34
+ end
35
+ end
36
+
37
+ context "given as_lines: true" do
38
+ it "returns an inspected version of the matcher as multiple lines" do
39
+ tiered_lines =
40
+ described_class.inspect_object(
41
+ custom_matcher.call(4),
42
+ as_lines: true,
43
+ type: :delete,
44
+ indentation_level: 1
45
+ )
46
+ expect(tiered_lines).to match(
47
+ [
48
+ an_object_having_attributes(
49
+ type: :delete,
50
+ indentation_level: 1,
51
+ value: "#<be a perfect square>"
52
+ )
53
+ ]
54
+ )
55
+ end
56
+ end
57
+ end
58
+
59
+ context "given a built-in matcher" do
60
+ let(:matcher) { be_a(Numeric) }
61
+
62
+ context "given as_lines: false" do
63
+ it "returns the matcher's description string" do
64
+ string = described_class.inspect_object(matcher, as_lines: false)
65
+ expect(string).to eq("#<be a kind of Numeric>")
66
+ end
67
+ end
68
+
69
+ context "given as_lines: true" do
70
+ it "returns an inspected version of the matcher as multiple lines" do
71
+ tiered_lines =
72
+ described_class.inspect_object(
73
+ matcher,
74
+ as_lines: true,
75
+ type: :delete,
76
+ indentation_level: 1
77
+ )
78
+ expect(tiered_lines).to match(
79
+ [
80
+ an_object_having_attributes(
81
+ type: :delete,
82
+ indentation_level: 1,
83
+ value: "#<be a kind of Numeric>"
84
+ )
85
+ ]
86
+ )
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe SuperDiff, type: :unit do
4
- describe ".inspect_object", "for RSpec objects" do
4
+ describe ".inspect_object", "for RSpec aliased matchers" do
5
5
  context "given a hash-including-<something>" do
6
6
  context "given as_lines: false" do
7
7
  it "returns an inspected version of the object" do
@@ -116,7 +116,7 @@ RSpec.describe SuperDiff, type: :unit do
116
116
  end
117
117
  end
118
118
 
119
- context "given a fuzzy object" do
119
+ context "given an object-having-<something>" do
120
120
  context "given as_lines: false" do
121
121
  it "returns an inspected version of the object" do
122
122
  string =
@@ -1026,6 +1026,70 @@ RSpec.describe SuperDiff, type: :unit do
1026
1026
  end
1027
1027
  end
1028
1028
 
1029
+ context "given a Date object" do
1030
+ context "given as_lines: false" do
1031
+ it "returns a representation of the date on a single line" do
1032
+ inspection =
1033
+ described_class.inspect_object(
1034
+ Date.new(2023, 10, 14),
1035
+ as_lines: false
1036
+ )
1037
+ expect(inspection).to eq("#<Date 2023-10-14>")
1038
+ end
1039
+ end
1040
+
1041
+ context "given as_lines: true" do
1042
+ it "returns a representation of the date across multiple lines" do
1043
+ inspection =
1044
+ described_class.inspect_object(
1045
+ Date.new(2023, 10, 14),
1046
+ as_lines: true,
1047
+ type: :delete,
1048
+ indentation_level: 1
1049
+ )
1050
+ expect(inspection).to match(
1051
+ [
1052
+ an_object_having_attributes(
1053
+ type: :delete,
1054
+ indentation_level: 1,
1055
+ value: "#<Date {",
1056
+ add_comma: false,
1057
+ collection_bookend: :open
1058
+ ),
1059
+ an_object_having_attributes(
1060
+ type: :delete,
1061
+ indentation_level: 2,
1062
+ value: "year: 2023",
1063
+ add_comma: true,
1064
+ collection_bookend: nil
1065
+ ),
1066
+ an_object_having_attributes(
1067
+ type: :delete,
1068
+ indentation_level: 2,
1069
+ value: "month: 10",
1070
+ add_comma: true,
1071
+ collection_bookend: nil
1072
+ ),
1073
+ an_object_having_attributes(
1074
+ type: :delete,
1075
+ indentation_level: 2,
1076
+ value: "day: 14",
1077
+ add_comma: false,
1078
+ collection_bookend: nil
1079
+ ),
1080
+ an_object_having_attributes(
1081
+ type: :delete,
1082
+ indentation_level: 1,
1083
+ value: "}>",
1084
+ add_comma: false,
1085
+ collection_bookend: :close
1086
+ )
1087
+ ]
1088
+ )
1089
+ end
1090
+ end
1091
+ end
1092
+
1029
1093
  context "given a class" do
1030
1094
  context "given as_lines: false" do
1031
1095
  it "returns an inspected version of the object" do
data/super_diff.gemspec CHANGED
@@ -13,6 +13,12 @@ Gem::Specification.new do |s|
13
13
  SuperDiff is a gem that hooks into RSpec to intelligently display the
14
14
  differences between two data structures of any type.
15
15
  DESC
16
+ s.metadata = {
17
+ "bug_tracker_uri" => "https://github.com/mcmire/super_diff/issues",
18
+ "changelog_uri" =>
19
+ "https://github.com/mcmire/super_diff/blob/main/CHANGELOG.md",
20
+ "source_code_uri" => "https://github.com/mcmire/super_diff"
21
+ }
16
22
  s.required_ruby_version = ">= 3"
17
23
 
18
24
  s.files = %w[README.md super_diff.gemspec] + Dir["lib/**/*"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Winkler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-26 00:00:00.000000000 Z
11
+ date: 2024-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attr_extras
@@ -66,11 +66,11 @@ files:
66
66
  - lib/super_diff/active_record.rb
67
67
  - lib/super_diff/active_record/differs.rb
68
68
  - lib/super_diff/active_record/differs/active_record_relation.rb
69
+ - lib/super_diff/active_record/inspection_tree_builders.rb
70
+ - lib/super_diff/active_record/inspection_tree_builders/active_record_model.rb
71
+ - lib/super_diff/active_record/inspection_tree_builders/active_record_relation.rb
69
72
  - lib/super_diff/active_record/monkey_patches.rb
70
73
  - lib/super_diff/active_record/object_inspection.rb
71
- - lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb
72
- - lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_model.rb
73
- - lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb
74
74
  - lib/super_diff/active_record/operation_tree_builders.rb
75
75
  - lib/super_diff/active_record/operation_tree_builders/active_record_model.rb
76
76
  - lib/super_diff/active_record/operation_tree_builders/active_record_relation.rb
@@ -81,17 +81,100 @@ files:
81
81
  - lib/super_diff/active_support.rb
82
82
  - lib/super_diff/active_support/differs.rb
83
83
  - lib/super_diff/active_support/differs/hash_with_indifferent_access.rb
84
+ - lib/super_diff/active_support/inspection_tree_builders.rb
85
+ - lib/super_diff/active_support/inspection_tree_builders/hash_with_indifferent_access.rb
86
+ - lib/super_diff/active_support/inspection_tree_builders/ordered_options.rb
84
87
  - lib/super_diff/active_support/object_inspection.rb
85
- - lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb
86
- - lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb
87
88
  - lib/super_diff/active_support/operation_tree_builders.rb
88
89
  - lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb
89
90
  - lib/super_diff/active_support/operation_tree_flatteners.rb
90
91
  - lib/super_diff/active_support/operation_tree_flatteners/hash_with_indifferent_access.rb
91
92
  - lib/super_diff/active_support/operation_trees.rb
92
93
  - lib/super_diff/active_support/operation_trees/hash_with_indifferent_access.rb
93
- - lib/super_diff/colorized_document_extensions.rb
94
- - lib/super_diff/configuration.rb
94
+ - lib/super_diff/basic.rb
95
+ - lib/super_diff/basic/diff_formatters.rb
96
+ - lib/super_diff/basic/diff_formatters/collection.rb
97
+ - lib/super_diff/basic/diff_formatters/multiline_string.rb
98
+ - lib/super_diff/basic/differs.rb
99
+ - lib/super_diff/basic/differs/array.rb
100
+ - lib/super_diff/basic/differs/custom_object.rb
101
+ - lib/super_diff/basic/differs/date_like.rb
102
+ - lib/super_diff/basic/differs/default_object.rb
103
+ - lib/super_diff/basic/differs/hash.rb
104
+ - lib/super_diff/basic/differs/multiline_string.rb
105
+ - lib/super_diff/basic/differs/time_like.rb
106
+ - lib/super_diff/basic/inspection_tree_builders.rb
107
+ - lib/super_diff/basic/inspection_tree_builders/array.rb
108
+ - lib/super_diff/basic/inspection_tree_builders/custom_object.rb
109
+ - lib/super_diff/basic/inspection_tree_builders/date_like.rb
110
+ - lib/super_diff/basic/inspection_tree_builders/default_object.rb
111
+ - lib/super_diff/basic/inspection_tree_builders/hash.rb
112
+ - lib/super_diff/basic/inspection_tree_builders/primitive.rb
113
+ - lib/super_diff/basic/inspection_tree_builders/time_like.rb
114
+ - lib/super_diff/basic/operation_tree_builders.rb
115
+ - lib/super_diff/basic/operation_tree_builders/array.rb
116
+ - lib/super_diff/basic/operation_tree_builders/custom_object.rb
117
+ - lib/super_diff/basic/operation_tree_builders/date_like.rb
118
+ - lib/super_diff/basic/operation_tree_builders/default_object.rb
119
+ - lib/super_diff/basic/operation_tree_builders/hash.rb
120
+ - lib/super_diff/basic/operation_tree_builders/multiline_string.rb
121
+ - lib/super_diff/basic/operation_tree_builders/time_like.rb
122
+ - lib/super_diff/basic/operation_tree_flatteners.rb
123
+ - lib/super_diff/basic/operation_tree_flatteners/array.rb
124
+ - lib/super_diff/basic/operation_tree_flatteners/collection.rb
125
+ - lib/super_diff/basic/operation_tree_flatteners/custom_object.rb
126
+ - lib/super_diff/basic/operation_tree_flatteners/default_object.rb
127
+ - lib/super_diff/basic/operation_tree_flatteners/hash.rb
128
+ - lib/super_diff/basic/operation_tree_flatteners/multiline_string.rb
129
+ - lib/super_diff/basic/operation_trees.rb
130
+ - lib/super_diff/basic/operation_trees/array.rb
131
+ - lib/super_diff/basic/operation_trees/custom_object.rb
132
+ - lib/super_diff/basic/operation_trees/default_object.rb
133
+ - lib/super_diff/basic/operation_trees/hash.rb
134
+ - lib/super_diff/basic/operation_trees/multiline_string.rb
135
+ - lib/super_diff/core.rb
136
+ - lib/super_diff/core/abstract_differ.rb
137
+ - lib/super_diff/core/abstract_inspection_tree_builder.rb
138
+ - lib/super_diff/core/abstract_operation_tree.rb
139
+ - lib/super_diff/core/abstract_operation_tree_builder.rb
140
+ - lib/super_diff/core/abstract_operation_tree_flattener.rb
141
+ - lib/super_diff/core/binary_operation.rb
142
+ - lib/super_diff/core/colorized_document_extensions.rb
143
+ - lib/super_diff/core/configuration.rb
144
+ - lib/super_diff/core/differ_dispatcher.rb
145
+ - lib/super_diff/core/gem_version.rb
146
+ - lib/super_diff/core/helpers.rb
147
+ - lib/super_diff/core/implementation_checks.rb
148
+ - lib/super_diff/core/inspection_tree.rb
149
+ - lib/super_diff/core/inspection_tree_builder_dispatcher.rb
150
+ - lib/super_diff/core/inspection_tree_nodes.rb
151
+ - lib/super_diff/core/inspection_tree_nodes/as_lines_when_rendering_to_lines.rb
152
+ - lib/super_diff/core/inspection_tree_nodes/as_prefix_when_rendering_to_lines.rb
153
+ - lib/super_diff/core/inspection_tree_nodes/as_prelude_when_rendering_to_lines.rb
154
+ - lib/super_diff/core/inspection_tree_nodes/as_single_line.rb
155
+ - lib/super_diff/core/inspection_tree_nodes/base.rb
156
+ - lib/super_diff/core/inspection_tree_nodes/inspection.rb
157
+ - lib/super_diff/core/inspection_tree_nodes/nesting.rb
158
+ - lib/super_diff/core/inspection_tree_nodes/only_when.rb
159
+ - lib/super_diff/core/inspection_tree_nodes/text.rb
160
+ - lib/super_diff/core/inspection_tree_nodes/when_empty.rb
161
+ - lib/super_diff/core/inspection_tree_nodes/when_non_empty.rb
162
+ - lib/super_diff/core/inspection_tree_nodes/when_rendering_to_lines.rb
163
+ - lib/super_diff/core/inspection_tree_nodes/when_rendering_to_string.rb
164
+ - lib/super_diff/core/line.rb
165
+ - lib/super_diff/core/no_differ_available_error.rb
166
+ - lib/super_diff/core/no_inspection_tree_builder_available_error.rb
167
+ - lib/super_diff/core/no_operation_tree_available_error.rb
168
+ - lib/super_diff/core/no_operation_tree_builder_available_error.rb
169
+ - lib/super_diff/core/operation_tree_builder_dispatcher.rb
170
+ - lib/super_diff/core/operation_tree_finder.rb
171
+ - lib/super_diff/core/prefix_for_next_inspection_tree_node.rb
172
+ - lib/super_diff/core/prelude_for_next_inspection_tree_node.rb
173
+ - lib/super_diff/core/recursion_guard.rb
174
+ - lib/super_diff/core/tiered_lines.rb
175
+ - lib/super_diff/core/tiered_lines_elider.rb
176
+ - lib/super_diff/core/tiered_lines_formatter.rb
177
+ - lib/super_diff/core/unary_operation.rb
95
178
  - lib/super_diff/csi.rb
96
179
  - lib/super_diff/csi/bold_sequence.rb
97
180
  - lib/super_diff/csi/color.rb
@@ -103,19 +186,7 @@ files:
103
186
  - lib/super_diff/csi/reset_sequence.rb
104
187
  - lib/super_diff/csi/twenty_four_bit_color.rb
105
188
  - lib/super_diff/csi/uncolorized_document.rb
106
- - lib/super_diff/diff_formatters/collection.rb
107
- - lib/super_diff/diff_formatters/multiline_string.rb
108
189
  - lib/super_diff/differs.rb
109
- - lib/super_diff/differs/array.rb
110
- - lib/super_diff/differs/base.rb
111
- - lib/super_diff/differs/custom_object.rb
112
- - lib/super_diff/differs/default_object.rb
113
- - lib/super_diff/differs/defaults.rb
114
- - lib/super_diff/differs/empty.rb
115
- - lib/super_diff/differs/hash.rb
116
- - lib/super_diff/differs/main.rb
117
- - lib/super_diff/differs/multiline_string.rb
118
- - lib/super_diff/differs/time_like.rb
119
190
  - lib/super_diff/equality_matchers.rb
120
191
  - lib/super_diff/equality_matchers/array.rb
121
192
  - lib/super_diff/equality_matchers/base.rb
@@ -127,73 +198,12 @@ files:
127
198
  - lib/super_diff/equality_matchers/primitive.rb
128
199
  - lib/super_diff/equality_matchers/singleline_string.rb
129
200
  - lib/super_diff/errors.rb
130
- - lib/super_diff/errors/no_diff_formatter_available_error.rb
131
- - lib/super_diff/errors/no_differ_available_error.rb
132
- - lib/super_diff/errors/no_operational_sequencer_available_error.rb
133
- - lib/super_diff/gem_version.rb
134
- - lib/super_diff/helpers.rb
135
- - lib/super_diff/implementation_checks.rb
136
- - lib/super_diff/line.rb
137
201
  - lib/super_diff/object_inspection.rb
138
- - lib/super_diff/object_inspection/inspection_tree.rb
139
- - lib/super_diff/object_inspection/inspection_tree_builders.rb
140
- - lib/super_diff/object_inspection/inspection_tree_builders/array.rb
141
- - lib/super_diff/object_inspection/inspection_tree_builders/base.rb
142
- - lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb
143
- - lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb
144
- - lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb
145
- - lib/super_diff/object_inspection/inspection_tree_builders/hash.rb
146
- - lib/super_diff/object_inspection/inspection_tree_builders/main.rb
147
- - lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb
148
- - lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb
149
- - lib/super_diff/object_inspection/nodes.rb
150
- - lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb
151
- - lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb
152
- - lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb
153
- - lib/super_diff/object_inspection/nodes/as_single_line.rb
154
- - lib/super_diff/object_inspection/nodes/base.rb
155
- - lib/super_diff/object_inspection/nodes/inspection.rb
156
- - lib/super_diff/object_inspection/nodes/nesting.rb
157
- - lib/super_diff/object_inspection/nodes/only_when.rb
158
- - lib/super_diff/object_inspection/nodes/text.rb
159
- - lib/super_diff/object_inspection/nodes/when_empty.rb
160
- - lib/super_diff/object_inspection/nodes/when_non_empty.rb
161
- - lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb
162
- - lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb
163
- - lib/super_diff/object_inspection/prefix_for_next_node.rb
164
- - lib/super_diff/object_inspection/prelude_for_next_node.rb
165
202
  - lib/super_diff/operation_tree_builders.rb
166
- - lib/super_diff/operation_tree_builders/array.rb
167
- - lib/super_diff/operation_tree_builders/base.rb
168
- - lib/super_diff/operation_tree_builders/custom_object.rb
169
- - lib/super_diff/operation_tree_builders/default_object.rb
170
- - lib/super_diff/operation_tree_builders/defaults.rb
171
- - lib/super_diff/operation_tree_builders/hash.rb
172
- - lib/super_diff/operation_tree_builders/main.rb
173
- - lib/super_diff/operation_tree_builders/multiline_string.rb
174
- - lib/super_diff/operation_tree_builders/time_like.rb
175
203
  - lib/super_diff/operation_tree_flatteners.rb
176
- - lib/super_diff/operation_tree_flatteners/array.rb
177
- - lib/super_diff/operation_tree_flatteners/base.rb
178
- - lib/super_diff/operation_tree_flatteners/collection.rb
179
- - lib/super_diff/operation_tree_flatteners/custom_object.rb
180
- - lib/super_diff/operation_tree_flatteners/default_object.rb
181
- - lib/super_diff/operation_tree_flatteners/hash.rb
182
- - lib/super_diff/operation_tree_flatteners/multiline_string.rb
183
204
  - lib/super_diff/operation_trees.rb
184
- - lib/super_diff/operation_trees/array.rb
185
- - lib/super_diff/operation_trees/base.rb
186
- - lib/super_diff/operation_trees/custom_object.rb
187
- - lib/super_diff/operation_trees/default_object.rb
188
- - lib/super_diff/operation_trees/defaults.rb
189
- - lib/super_diff/operation_trees/hash.rb
190
- - lib/super_diff/operation_trees/main.rb
191
- - lib/super_diff/operation_trees/multiline_string.rb
192
205
  - lib/super_diff/operations.rb
193
- - lib/super_diff/operations/binary_operation.rb
194
- - lib/super_diff/operations/unary_operation.rb
195
206
  - lib/super_diff/rails.rb
196
- - lib/super_diff/recursion_guard.rb
197
207
  - lib/super_diff/rspec-rails.rb
198
208
  - lib/super_diff/rspec.rb
199
209
  - lib/super_diff/rspec/augmented_matcher.rb
@@ -203,6 +213,17 @@ files:
203
213
  - lib/super_diff/rspec/differs/collection_including.rb
204
214
  - lib/super_diff/rspec/differs/hash_including.rb
205
215
  - lib/super_diff/rspec/differs/object_having_attributes.rb
216
+ - lib/super_diff/rspec/inspection_tree_builders.rb
217
+ - lib/super_diff/rspec/inspection_tree_builders/collection_containing_exactly.rb
218
+ - lib/super_diff/rspec/inspection_tree_builders/collection_including.rb
219
+ - lib/super_diff/rspec/inspection_tree_builders/double.rb
220
+ - lib/super_diff/rspec/inspection_tree_builders/generic_describable_matcher.rb
221
+ - lib/super_diff/rspec/inspection_tree_builders/hash_including.rb
222
+ - lib/super_diff/rspec/inspection_tree_builders/instance_of.rb
223
+ - lib/super_diff/rspec/inspection_tree_builders/kind_of.rb
224
+ - lib/super_diff/rspec/inspection_tree_builders/object_having_attributes.rb
225
+ - lib/super_diff/rspec/inspection_tree_builders/primitive.rb
226
+ - lib/super_diff/rspec/inspection_tree_builders/value_within.rb
206
227
  - lib/super_diff/rspec/matcher_text_builders.rb
207
228
  - lib/super_diff/rspec/matcher_text_builders/base.rb
208
229
  - lib/super_diff/rspec/matcher_text_builders/be_predicate.rb
@@ -214,24 +235,11 @@ files:
214
235
  - lib/super_diff/rspec/matcher_text_template.rb
215
236
  - lib/super_diff/rspec/monkey_patches.rb
216
237
  - lib/super_diff/rspec/object_inspection.rb
217
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb
218
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_containing_exactly.rb
219
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb
220
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb
221
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb
222
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb
223
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb
224
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/object_having_attributes.rb
225
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/primitive.rb
226
- - lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb
227
238
  - lib/super_diff/rspec/operation_tree_builders.rb
228
239
  - lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb
229
240
  - lib/super_diff/rspec/operation_tree_builders/collection_including.rb
230
241
  - lib/super_diff/rspec/operation_tree_builders/hash_including.rb
231
242
  - lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb
232
- - lib/super_diff/tiered_lines.rb
233
- - lib/super_diff/tiered_lines_elider.rb
234
- - lib/super_diff/tiered_lines_formatter.rb
235
243
  - lib/super_diff/version.rb
236
244
  - spec/examples.txt
237
245
  - spec/integration/rails/active_record_spec.rb
@@ -245,15 +253,18 @@ files:
245
253
  - spec/integration/rspec/be_truthy_matcher_spec.rb
246
254
  - spec/integration/rspec/contain_exactly_matcher_spec.rb
247
255
  - spec/integration/rspec/eq_matcher_spec.rb
256
+ - spec/integration/rspec/generic_describable_matchers_spec.rb
248
257
  - spec/integration/rspec/have_attributes_matcher_spec.rb
249
258
  - spec/integration/rspec/have_predicate_matcher_spec.rb
250
259
  - spec/integration/rspec/include_matcher_spec.rb
260
+ - spec/integration/rspec/magic_metadata_spec.rb
251
261
  - spec/integration/rspec/match_array_matcher_spec.rb
252
262
  - spec/integration/rspec/match_matcher_spec.rb
253
263
  - spec/integration/rspec/raise_error_matcher_spec.rb
254
264
  - spec/integration/rspec/respond_to_matcher_spec.rb
255
265
  - spec/integration/rspec/third_party_matcher_spec.rb
256
266
  - spec/integration/rspec/unhandled_errors_spec.rb
267
+ - spec/internal/log/test.log
257
268
  - spec/spec_helper.rb
258
269
  - spec/support/colorizer.rb
259
270
  - spec/support/command_runner.rb
@@ -284,15 +295,20 @@ files:
284
295
  - spec/support/shared_examples/hash_with_indifferent_access.rb
285
296
  - spec/support/shared_examples/key.rb
286
297
  - spec/support/unit/helpers.rb
298
+ - spec/support/unit/matchers/be_deprecated_in_favor_of.rb
287
299
  - spec/support/unit/matchers/match_output.rb
288
300
  - spec/unit/active_record/object_inspection_spec.rb
301
+ - spec/unit/active_support/object_inspection_spec.rb
302
+ - spec/unit/basic/operation_tree_flatteners/array_spec.rb
303
+ - spec/unit/basic/operation_tree_flatteners/custom_object_spec.rb
304
+ - spec/unit/basic/operation_tree_flatteners/default_object_spec.rb
305
+ - spec/unit/basic/operation_tree_flatteners/hash_spec.rb
306
+ - spec/unit/basic/operation_tree_flatteners/multiline_string_spec.rb
307
+ - spec/unit/core/helpers_spec.rb
308
+ - spec/unit/core/tiered_lines_elider_spec.rb
309
+ - spec/unit/core/tiered_lines_formatter_spec.rb
310
+ - spec/unit/deprecations_spec.rb
289
311
  - spec/unit/equality_matchers/main_spec.rb
290
- - spec/unit/helpers_spec.rb
291
- - spec/unit/operation_tree_flatteners/array_spec.rb
292
- - spec/unit/operation_tree_flatteners/custom_object_spec.rb
293
- - spec/unit/operation_tree_flatteners/default_object_spec.rb
294
- - spec/unit/operation_tree_flatteners/hash_spec.rb
295
- - spec/unit/operation_tree_flatteners/multiline_string_spec.rb
296
312
  - spec/unit/rspec/matchers/be_compared_to_spec.rb
297
313
  - spec/unit/rspec/matchers/be_falsey_spec.rb
298
314
  - spec/unit/rspec/matchers/be_nil_spec.rb
@@ -308,15 +324,17 @@ files:
308
324
  - spec/unit/rspec/matchers/match_spec.rb
309
325
  - spec/unit/rspec/matchers/raise_error_spec.rb
310
326
  - spec/unit/rspec/matchers/respond_to_spec.rb
327
+ - spec/unit/rspec/object_inspection/rspec_matcher_spec.rb
311
328
  - spec/unit/rspec/object_inspection_spec.rb
312
329
  - spec/unit/super_diff_spec.rb
313
- - spec/unit/tiered_lines_elider_spec.rb
314
- - spec/unit/tiered_lines_formatter_spec.rb
315
330
  - super_diff.gemspec
316
331
  homepage: https://github.com/mcmire/super_diff
317
332
  licenses:
318
333
  - MIT
319
- metadata: {}
334
+ metadata:
335
+ bug_tracker_uri: https://github.com/mcmire/super_diff/issues
336
+ changelog_uri: https://github.com/mcmire/super_diff/blob/main/CHANGELOG.md
337
+ source_code_uri: https://github.com/mcmire/super_diff
320
338
  post_install_message:
321
339
  rdoc_options: []
322
340
  require_paths:
@@ -349,15 +367,18 @@ test_files:
349
367
  - spec/integration/rspec/be_truthy_matcher_spec.rb
350
368
  - spec/integration/rspec/contain_exactly_matcher_spec.rb
351
369
  - spec/integration/rspec/eq_matcher_spec.rb
370
+ - spec/integration/rspec/generic_describable_matchers_spec.rb
352
371
  - spec/integration/rspec/have_attributes_matcher_spec.rb
353
372
  - spec/integration/rspec/have_predicate_matcher_spec.rb
354
373
  - spec/integration/rspec/include_matcher_spec.rb
374
+ - spec/integration/rspec/magic_metadata_spec.rb
355
375
  - spec/integration/rspec/match_array_matcher_spec.rb
356
376
  - spec/integration/rspec/match_matcher_spec.rb
357
377
  - spec/integration/rspec/raise_error_matcher_spec.rb
358
378
  - spec/integration/rspec/respond_to_matcher_spec.rb
359
379
  - spec/integration/rspec/third_party_matcher_spec.rb
360
380
  - spec/integration/rspec/unhandled_errors_spec.rb
381
+ - spec/internal/log/test.log
361
382
  - spec/spec_helper.rb
362
383
  - spec/support/colorizer.rb
363
384
  - spec/support/command_runner.rb
@@ -388,15 +409,20 @@ test_files:
388
409
  - spec/support/shared_examples/hash_with_indifferent_access.rb
389
410
  - spec/support/shared_examples/key.rb
390
411
  - spec/support/unit/helpers.rb
412
+ - spec/support/unit/matchers/be_deprecated_in_favor_of.rb
391
413
  - spec/support/unit/matchers/match_output.rb
392
414
  - spec/unit/active_record/object_inspection_spec.rb
415
+ - spec/unit/active_support/object_inspection_spec.rb
416
+ - spec/unit/basic/operation_tree_flatteners/array_spec.rb
417
+ - spec/unit/basic/operation_tree_flatteners/custom_object_spec.rb
418
+ - spec/unit/basic/operation_tree_flatteners/default_object_spec.rb
419
+ - spec/unit/basic/operation_tree_flatteners/hash_spec.rb
420
+ - spec/unit/basic/operation_tree_flatteners/multiline_string_spec.rb
421
+ - spec/unit/core/helpers_spec.rb
422
+ - spec/unit/core/tiered_lines_elider_spec.rb
423
+ - spec/unit/core/tiered_lines_formatter_spec.rb
424
+ - spec/unit/deprecations_spec.rb
393
425
  - spec/unit/equality_matchers/main_spec.rb
394
- - spec/unit/helpers_spec.rb
395
- - spec/unit/operation_tree_flatteners/array_spec.rb
396
- - spec/unit/operation_tree_flatteners/custom_object_spec.rb
397
- - spec/unit/operation_tree_flatteners/default_object_spec.rb
398
- - spec/unit/operation_tree_flatteners/hash_spec.rb
399
- - spec/unit/operation_tree_flatteners/multiline_string_spec.rb
400
426
  - spec/unit/rspec/matchers/be_compared_to_spec.rb
401
427
  - spec/unit/rspec/matchers/be_falsey_spec.rb
402
428
  - spec/unit/rspec/matchers/be_nil_spec.rb
@@ -412,7 +438,6 @@ test_files:
412
438
  - spec/unit/rspec/matchers/match_spec.rb
413
439
  - spec/unit/rspec/matchers/raise_error_spec.rb
414
440
  - spec/unit/rspec/matchers/respond_to_spec.rb
441
+ - spec/unit/rspec/object_inspection/rspec_matcher_spec.rb
415
442
  - spec/unit/rspec/object_inspection_spec.rb
416
443
  - spec/unit/super_diff_spec.rb
417
- - spec/unit/tiered_lines_elider_spec.rb
418
- - spec/unit/tiered_lines_formatter_spec.rb
@@ -1,39 +0,0 @@
1
- module SuperDiff
2
- module ActiveRecord
3
- module ObjectInspection
4
- module InspectionTreeBuilders
5
- class ActiveRecordModel < SuperDiff::ObjectInspection::InspectionTreeBuilders::Base
6
- def self.applies_to?(value)
7
- value.is_a?(::ActiveRecord::Base)
8
- end
9
-
10
- def call
11
- SuperDiff::ObjectInspection::InspectionTree.new do
12
- as_lines_when_rendering_to_lines(collection_bookend: :open) do
13
- add_text { |object| "#<#{object.class} " }
14
-
15
- when_rendering_to_lines { add_text "{" }
16
- end
17
-
18
- nested do |object|
19
- insert_separated_list(
20
- ["id"] + (object.attributes.keys.sort - ["id"])
21
- ) do |name|
22
- as_prefix_when_rendering_to_lines { add_text "#{name}: " }
23
-
24
- add_inspection_of object.read_attribute(name)
25
- end
26
- end
27
-
28
- as_lines_when_rendering_to_lines(collection_bookend: :close) do
29
- when_rendering_to_lines { add_text "}" }
30
-
31
- add_text ">"
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,27 +0,0 @@
1
- module SuperDiff
2
- module ActiveRecord
3
- module ObjectInspection
4
- module InspectionTreeBuilders
5
- class ActiveRecordRelation < SuperDiff::ObjectInspection::InspectionTreeBuilders::Base
6
- def self.applies_to?(value)
7
- value.is_a?(::ActiveRecord::Relation)
8
- end
9
-
10
- def call
11
- SuperDiff::ObjectInspection::InspectionTree.new do
12
- as_lines_when_rendering_to_lines(collection_bookend: :open) do
13
- add_text "#<ActiveRecord::Relation ["
14
- end
15
-
16
- nested { |array| insert_array_inspection_of(array) }
17
-
18
- as_lines_when_rendering_to_lines(collection_bookend: :close) do
19
- add_text "]>"
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end