super_diff 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -26
  3. data/lib/super_diff/active_record/differs/active_record_relation.rb +1 -2
  4. data/lib/super_diff/active_record/differs.rb +1 -1
  5. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_model.rb +22 -18
  6. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb +14 -7
  7. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb +2 -2
  8. data/lib/super_diff/active_record/object_inspection.rb +1 -1
  9. data/lib/super_diff/active_record/operation_tree_builders/active_record_model.rb +1 -2
  10. data/lib/super_diff/active_record/operation_tree_builders/active_record_relation.rb +1 -2
  11. data/lib/super_diff/active_record/operation_tree_builders.rb +2 -2
  12. data/lib/super_diff/active_record/operation_tree_flatteners.rb +1 -1
  13. data/lib/super_diff/active_record/operation_trees.rb +1 -1
  14. data/lib/super_diff/active_record.rb +7 -15
  15. data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +5 -6
  16. data/lib/super_diff/active_support/differs.rb +1 -1
  17. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +20 -11
  18. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/ordered_options.rb +46 -0
  19. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb +5 -1
  20. data/lib/super_diff/active_support/object_inspection.rb +1 -1
  21. data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +5 -6
  22. data/lib/super_diff/active_support/operation_tree_builders.rb +1 -1
  23. data/lib/super_diff/active_support/operation_tree_flatteners.rb +1 -1
  24. data/lib/super_diff/active_support/operation_trees.rb +1 -1
  25. data/lib/super_diff/active_support.rb +6 -10
  26. data/lib/super_diff/colorized_document_extensions.rb +2 -4
  27. data/lib/super_diff/configuration.rb +14 -8
  28. data/lib/super_diff/csi/color.rb +4 -4
  29. data/lib/super_diff/csi/colorized_document.rb +12 -16
  30. data/lib/super_diff/csi/document.rb +8 -19
  31. data/lib/super_diff/csi/eight_bit_color.rb +19 -19
  32. data/lib/super_diff/csi/four_bit_color.rb +82 -31
  33. data/lib/super_diff/csi/twenty_four_bit_color.rb +12 -11
  34. data/lib/super_diff/csi/uncolorized_document.rb +2 -6
  35. data/lib/super_diff/csi.rb +10 -14
  36. data/lib/super_diff/diff_formatters/collection.rb +35 -41
  37. data/lib/super_diff/differs/date_like.rb +15 -0
  38. data/lib/super_diff/differs/default_object.rb +1 -1
  39. data/lib/super_diff/differs/defaults.rb +2 -1
  40. data/lib/super_diff/differs/main.rb +2 -13
  41. data/lib/super_diff/differs.rb +1 -0
  42. data/lib/super_diff/equality_matchers/array.rb +10 -12
  43. data/lib/super_diff/equality_matchers/base.rb +1 -1
  44. data/lib/super_diff/equality_matchers/default.rb +2 -4
  45. data/lib/super_diff/equality_matchers/defaults.rb +1 -1
  46. data/lib/super_diff/equality_matchers/hash.rb +10 -12
  47. data/lib/super_diff/equality_matchers/multiline_string.rb +11 -13
  48. data/lib/super_diff/equality_matchers/primitive.rb +10 -12
  49. data/lib/super_diff/equality_matchers/singleline_string.rb +10 -12
  50. data/lib/super_diff/equality_matchers.rb +1 -1
  51. data/lib/super_diff/errors.rb +2 -6
  52. data/lib/super_diff/gem_version.rb +3 -3
  53. data/lib/super_diff/helpers.rb +10 -10
  54. data/lib/super_diff/implementation_checks.rb +2 -2
  55. data/lib/super_diff/line.rb +3 -3
  56. data/lib/super_diff/object_inspection/inspection_tree.rb +64 -73
  57. data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +29 -14
  58. data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +17 -13
  59. data/lib/super_diff/object_inspection/inspection_tree_builders/date_like.rb +51 -0
  60. data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +43 -27
  61. data/lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb +2 -1
  62. data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +35 -18
  63. data/lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb +3 -5
  64. data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +30 -36
  65. data/lib/super_diff/object_inspection/inspection_tree_builders.rb +13 -9
  66. data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +11 -22
  67. data/lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb +1 -5
  68. data/lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb +1 -5
  69. data/lib/super_diff/object_inspection/nodes/as_single_line.rb +3 -7
  70. data/lib/super_diff/object_inspection/nodes/base.rb +9 -14
  71. data/lib/super_diff/object_inspection/nodes/inspection.rb +26 -34
  72. data/lib/super_diff/object_inspection/nodes/nesting.rb +1 -1
  73. data/lib/super_diff/object_inspection/nodes/only_when.rb +2 -6
  74. data/lib/super_diff/object_inspection/nodes/text.rb +1 -5
  75. data/lib/super_diff/object_inspection/nodes/when_empty.rb +2 -6
  76. data/lib/super_diff/object_inspection/nodes/when_non_empty.rb +2 -6
  77. data/lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb +1 -1
  78. data/lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb +1 -5
  79. data/lib/super_diff/object_inspection/nodes.rb +7 -7
  80. data/lib/super_diff/object_inspection.rb +3 -3
  81. data/lib/super_diff/operation_tree_builders/array.rb +12 -11
  82. data/lib/super_diff/operation_tree_builders/base.rb +17 -15
  83. data/lib/super_diff/operation_tree_builders/custom_object.rb +8 -6
  84. data/lib/super_diff/operation_tree_builders/date_like.rb +15 -0
  85. data/lib/super_diff/operation_tree_builders/default_object.rb +29 -21
  86. data/lib/super_diff/operation_tree_builders/defaults.rb +1 -1
  87. data/lib/super_diff/operation_tree_builders/hash.rb +23 -24
  88. data/lib/super_diff/operation_tree_builders/main.rb +4 -11
  89. data/lib/super_diff/operation_tree_builders/multiline_string.rb +3 -3
  90. data/lib/super_diff/operation_tree_builders/time_like.rb +1 -11
  91. data/lib/super_diff/operation_tree_builders.rb +2 -1
  92. data/lib/super_diff/operation_tree_flatteners/base.rb +1 -5
  93. data/lib/super_diff/operation_tree_flatteners/collection.rb +13 -16
  94. data/lib/super_diff/operation_tree_flatteners/default_object.rb +1 -2
  95. data/lib/super_diff/operation_tree_flatteners/hash.rb +2 -10
  96. data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +2 -1
  97. data/lib/super_diff/operation_tree_flatteners.rb +3 -3
  98. data/lib/super_diff/operation_trees/base.rb +3 -5
  99. data/lib/super_diff/operation_trees/default_object.rb +1 -3
  100. data/lib/super_diff/operations/binary_operation.rb +2 -2
  101. data/lib/super_diff/operations/unary_operation.rb +1 -1
  102. data/lib/super_diff/rails.rb +2 -1
  103. data/lib/super_diff/recursion_guard.rb +5 -4
  104. data/lib/super_diff/rspec/augmented_matcher.rb +4 -5
  105. data/lib/super_diff/rspec/differ.rb +6 -13
  106. data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +3 -2
  107. data/lib/super_diff/rspec/differs/collection_including.rb +1 -1
  108. data/lib/super_diff/rspec/differs/hash_including.rb +1 -1
  109. data/lib/super_diff/rspec/differs.rb +3 -3
  110. data/lib/super_diff/rspec/matcher_text_builders/base.rb +13 -15
  111. data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +5 -7
  112. data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +3 -5
  113. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +2 -10
  114. data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +2 -6
  115. data/lib/super_diff/rspec/matcher_text_builders.rb +5 -8
  116. data/lib/super_diff/rspec/matcher_text_template.rb +13 -16
  117. data/lib/super_diff/rspec/monkey_patches.rb +180 -123
  118. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_containing_exactly.rb +14 -7
  119. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +21 -13
  120. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +35 -36
  121. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/generic_describable_matcher.rb +19 -0
  122. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +21 -15
  123. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +11 -10
  124. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +11 -10
  125. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/object_having_attributes.rb +14 -7
  126. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb +10 -11
  127. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +13 -9
  128. data/lib/super_diff/rspec/object_inspection.rb +1 -1
  129. data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +11 -10
  130. data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +7 -6
  131. data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +11 -10
  132. data/lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb +22 -17
  133. data/lib/super_diff/rspec/operation_tree_builders.rb +4 -4
  134. data/lib/super_diff/rspec.rb +17 -18
  135. data/lib/super_diff/tiered_lines_elider.rb +87 -115
  136. data/lib/super_diff/tiered_lines_formatter.rb +5 -9
  137. data/lib/super_diff/version.rb +1 -1
  138. data/lib/super_diff.rb +13 -9
  139. data/spec/examples.txt +541 -483
  140. data/spec/integration/rails/active_record_spec.rb +3 -1
  141. data/spec/integration/rails/engines_spec.rb +25 -0
  142. data/spec/integration/rails/hash_with_indifferent_access_spec.rb +3 -1
  143. data/spec/integration/rspec/be_falsey_matcher_spec.rb +40 -35
  144. data/spec/integration/rspec/be_matcher_spec.rb +360 -320
  145. data/spec/integration/rspec/be_nil_matcher_spec.rb +38 -34
  146. data/spec/integration/rspec/be_predicate_matcher_spec.rb +376 -359
  147. data/spec/integration/rspec/be_truthy_matcher_spec.rb +38 -33
  148. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +257 -254
  149. data/spec/integration/rspec/eq_matcher_spec.rb +695 -585
  150. data/spec/integration/rspec/generic_describable_matchers_spec.rb +177 -0
  151. data/spec/integration/rspec/have_attributes_matcher_spec.rb +312 -304
  152. data/spec/integration/rspec/have_predicate_matcher_spec.rb +291 -297
  153. data/spec/integration/rspec/include_matcher_spec.rb +327 -225
  154. data/spec/integration/rspec/magic_metadata_spec.rb +51 -0
  155. data/spec/integration/rspec/match_array_matcher_spec.rb +294 -291
  156. data/spec/integration/rspec/match_matcher_spec.rb +916 -903
  157. data/spec/integration/rspec/raise_error_matcher_spec.rb +1208 -449
  158. data/spec/integration/rspec/respond_to_matcher_spec.rb +702 -697
  159. data/spec/integration/rspec/third_party_matcher_spec.rb +142 -138
  160. data/spec/integration/rspec/unhandled_errors_spec.rb +88 -84
  161. data/spec/internal/log/test.log +0 -0
  162. data/spec/spec_helper.rb +20 -20
  163. data/spec/support/command_runner.rb +34 -57
  164. data/spec/support/integration/helpers.rb +44 -32
  165. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +28 -23
  166. data/spec/support/integration/matchers.rb +34 -0
  167. data/spec/support/integration/test_programs/base.rb +17 -22
  168. data/spec/support/integration/test_programs/plain.rb +6 -0
  169. data/spec/support/integration/test_programs/rspec_active_record.rb +4 -1
  170. data/spec/support/integration/test_programs/rspec_active_support.rb +4 -1
  171. data/spec/support/integration/test_programs/rspec_rails.rb +4 -1
  172. data/spec/support/integration/test_programs/rspec_rails_engine.rb +20 -0
  173. data/spec/support/models/active_record/person.rb +6 -4
  174. data/spec/support/models/active_record/shipping_address.rb +9 -10
  175. data/spec/support/models/customer.rb +2 -4
  176. data/spec/support/models/player.rb +3 -6
  177. data/spec/support/models/shipping_address.rb +4 -13
  178. data/spec/support/shared_examples/active_record.rb +258 -240
  179. data/spec/support/shared_examples/active_support.rb +174 -51
  180. data/spec/support/shared_examples/elided_diffs.rb +447 -423
  181. data/spec/support/shared_examples/hash_with_indifferent_access.rb +500 -464
  182. data/spec/support/shared_examples/key.rb +123 -0
  183. data/spec/support/unit/helpers.rb +1 -3
  184. data/spec/support/unit/matchers/match_output.rb +12 -13
  185. data/spec/unit/active_record/object_inspection_spec.rb +222 -206
  186. data/spec/unit/active_support/object_inspection_spec.rb +170 -0
  187. data/spec/unit/equality_matchers/main_spec.rb +1049 -984
  188. data/spec/unit/helpers_spec.rb +14 -21
  189. data/spec/unit/operation_tree_flatteners/array_spec.rb +557 -524
  190. data/spec/unit/operation_tree_flatteners/custom_object_spec.rb +619 -601
  191. data/spec/unit/operation_tree_flatteners/default_object_spec.rb +619 -621
  192. data/spec/unit/operation_tree_flatteners/hash_spec.rb +595 -556
  193. data/spec/unit/operation_tree_flatteners/multiline_string_spec.rb +102 -92
  194. data/spec/unit/rspec/matchers/be_compared_to_spec.rb +3 -3
  195. data/spec/unit/rspec/matchers/be_predicate_spec.rb +3 -3
  196. data/spec/unit/rspec/matchers/contain_exactly_spec.rb +1 -1
  197. data/spec/unit/rspec/matchers/have_attributes_spec.rb +1 -1
  198. data/spec/unit/rspec/matchers/have_predicate_spec.rb +2 -2
  199. data/spec/unit/rspec/matchers/include_spec.rb +2 -2
  200. data/spec/unit/rspec/matchers/match_array_spec.rb +2 -2
  201. data/spec/unit/rspec/matchers/raise_error_spec.rb +43 -11
  202. data/spec/unit/rspec/matchers/respond_to_spec.rb +23 -16
  203. data/spec/unit/rspec/object_inspection/rspec_matcher_spec.rb +91 -0
  204. data/spec/unit/rspec/object_inspection_spec.rb +351 -326
  205. data/spec/unit/super_diff_spec.rb +1594 -1437
  206. data/spec/unit/tiered_lines_elider_spec.rb +3508 -3536
  207. data/spec/unit/tiered_lines_formatter_spec.rb +54 -116
  208. data/super_diff.gemspec +13 -12
  209. metadata +88 -75
  210. data/lib/super_diff/errors/no_diff_formatter_available_error.rb +0 -21
  211. data/lib/super_diff/errors/no_operational_sequencer_available_error.rb +0 -22
  212. data/spec/tmp/warnings_logger/all_warnings.txt +0 -2
@@ -3,167 +3,105 @@ require "spec_helper"
3
3
  RSpec.describe SuperDiff::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
- line(
7
- type: :noop,
8
- indentation_level: 0,
9
- value: %([),
10
- ),
11
- line(
12
- type: :noop,
13
- indentation_level: 1,
14
- value: %("foo"),
15
- add_comma: true,
16
- ),
17
- line(
18
- type: :noop,
19
- indentation_level: 1,
20
- value: %({),
21
- ),
6
+ line(type: :noop, indentation_level: 0, value: "["),
7
+ line(type: :noop, indentation_level: 1, value: %("foo"), add_comma: true),
8
+ line(type: :noop, indentation_level: 1, value: "{"),
22
9
  line(
23
10
  type: :noop,
24
11
  indentation_level: 2,
25
- prefix: %(one: ),
12
+ prefix: "one: ",
26
13
  value: %("fish"),
27
- add_comma: true,
14
+ add_comma: true
28
15
  ),
29
16
  line(
30
17
  type: :delete,
31
18
  indentation_level: 2,
32
- prefix: %(two: ),
19
+ prefix: "two: ",
33
20
  value: %("fish"),
34
- add_comma: true,
21
+ add_comma: true
35
22
  ),
36
23
  line(
37
24
  type: :insert,
38
25
  indentation_level: 2,
39
- prefix: %(two: ),
26
+ prefix: "two: ",
40
27
  value: %("FISH"),
41
- add_comma: true,
42
- ),
43
- line(
44
- type: :noop,
45
- indentation_level: 2,
46
- prefix: %(hard: ),
47
- value: %([),
28
+ add_comma: true
48
29
  ),
30
+ line(type: :noop, indentation_level: 2, prefix: "hard: ", value: "["),
49
31
  elision(
50
32
  indentation_level: 3,
51
- value: %(# ...),
33
+ value: "# ...",
52
34
  children: [
53
- line(
54
- type: :noop,
55
- indentation_level: 3,
56
- value: %("a"),
57
- ),
58
- line(
59
- type: :noop,
60
- indentation_level: 3,
61
- value: %("b"),
62
- ),
63
- line(
64
- type: :noop,
65
- indentation_level: 3,
66
- value: %("c"),
67
- ),
68
- ],
69
- ),
70
- line(
71
- type: :noop,
72
- indentation_level: 2,
73
- value: %(]),
74
- add_comma: true,
35
+ line(type: :noop, indentation_level: 3, value: %("a")),
36
+ line(type: :noop, indentation_level: 3, value: %("b")),
37
+ line(type: :noop, indentation_level: 3, value: %("c"))
38
+ ]
75
39
  ),
40
+ line(type: :noop, indentation_level: 2, value: "]", add_comma: true),
76
41
  line(
77
42
  type: :insert,
78
43
  indentation_level: 2,
79
- prefix: %(blue: ),
44
+ prefix: "blue: ",
80
45
  value: %("fish"),
81
- add_comma: true,
46
+ add_comma: true
82
47
  ),
83
48
  line(
84
49
  type: :insert,
85
50
  indentation_level: 2,
86
- prefix: %(stew: ),
87
- value: %("fish"),
88
- ),
89
- line(
90
- type: :noop,
91
- indentation_level: 1,
92
- value: %(}),
93
- add_comma: true,
94
- ),
95
- line(
96
- type: :noop,
97
- indentation_level: 1,
98
- value: %(∙∙∙),
99
- add_comma: true,
51
+ prefix: "stew: ",
52
+ value: %("fish")
100
53
  ),
54
+ line(type: :noop, indentation_level: 1, value: "}", add_comma: true),
55
+ line(type: :noop, indentation_level: 1, value: "∙∙∙", add_comma: true),
101
56
  line(
102
57
  type: :delete,
103
58
  indentation_level: 1,
104
59
  value: %("baz"),
105
- add_comma: true,
106
- ),
107
- line(
108
- type: :insert,
109
- indentation_level: 1,
110
- value: %(2),
111
- add_comma: true,
112
- ),
113
- line(
114
- type: :noop,
115
- indentation_level: 1,
116
- value: %("qux"),
117
- add_comma: true,
60
+ add_comma: true
118
61
  ),
62
+ line(type: :insert, indentation_level: 1, value: "2", add_comma: true),
63
+ line(type: :noop, indentation_level: 1, value: %("qux"), add_comma: true),
119
64
  line(
120
65
  type: :delete,
121
66
  indentation_level: 1,
122
67
  value: %("blargh"),
123
- add_comma: true,
68
+ add_comma: true
124
69
  ),
125
70
  line(
126
71
  type: :delete,
127
72
  indentation_level: 1,
128
73
  value: %("zig"),
129
- add_comma: true,
130
- ),
131
- line(
132
- type: :delete,
133
- indentation_level: 1,
134
- value: %("zag"),
135
- ),
136
- line(
137
- type: :noop,
138
- indentation_level: 0,
139
- value: %(]),
74
+ add_comma: true
140
75
  ),
76
+ line(type: :delete, indentation_level: 1, value: %("zag")),
77
+ line(type: :noop, indentation_level: 0, value: "]")
141
78
  ]
142
79
 
143
80
  actual_diff = described_class.call(tiered_lines)
144
81
 
145
- expected_diff = colored do
146
- plain_line %( [)
147
- plain_line %( "foo",)
148
- plain_line %( {)
149
- plain_line %( one: "fish",)
150
- expected_line %(- two: "fish",)
151
- actual_line %(+ two: "FISH",)
152
- plain_line %( hard: [)
153
- elision_marker_line %( # ...)
154
- plain_line %( ],)
155
- actual_line %(+ blue: "fish",)
156
- actual_line %(+ stew: "fish")
157
- plain_line %( },)
158
- plain_line %( ∙∙∙,)
159
- expected_line %(- "baz",)
160
- actual_line %(+ 2,)
161
- plain_line %( "qux",)
162
- expected_line %(- "blargh",)
163
- expected_line %(- "zig",)
164
- expected_line %(- "zag")
165
- plain_line %( ])
166
- end
82
+ expected_diff =
83
+ colored do
84
+ plain_line " ["
85
+ plain_line %( "foo",)
86
+ plain_line " {"
87
+ plain_line %( one: "fish",)
88
+ expected_line %(- two: "fish",)
89
+ actual_line %(+ two: "FISH",)
90
+ plain_line " hard: ["
91
+ elision_marker_line " # ..."
92
+ plain_line " ],"
93
+ actual_line %(+ blue: "fish",)
94
+ actual_line %(+ stew: "fish")
95
+ plain_line " },"
96
+ plain_line " ∙∙∙,"
97
+ expected_line %(- "baz",)
98
+ actual_line "+ 2,"
99
+ plain_line %( "qux",)
100
+ expected_line %(- "blargh",)
101
+ expected_line %(- "zig",)
102
+ expected_line %(- "zag")
103
+ plain_line " ]"
104
+ end
167
105
 
168
106
  expect(actual_diff).to eq(expected_diff)
169
107
  end
@@ -175,7 +113,7 @@ RSpec.describe SuperDiff::TieredLinesFormatter, type: :unit do
175
113
  indentation_level: indentation_level,
176
114
  prefix: prefix,
177
115
  value: value,
178
- add_comma?: add_comma,
116
+ add_comma?: add_comma
179
117
  )
180
118
  end
181
119
 
@@ -187,7 +125,7 @@ RSpec.describe SuperDiff::TieredLinesFormatter, type: :unit do
187
125
  prefix: "",
188
126
  value: value,
189
127
  add_comma?: false,
190
- children: children,
128
+ children: children
191
129
  )
192
130
  end
193
131
  end
data/super_diff.gemspec CHANGED
@@ -1,24 +1,25 @@
1
1
  require File.expand_path("lib/super_diff/version", __dir__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = "super_diff"
5
- s.version = SuperDiff::VERSION
6
- s.authors = ["Elliot Winkler"]
7
- s.email = ["elliot.winkler@gmail.com"]
8
- s.homepage = "https://github.com/mcmire/super_diff"
9
- s.summary = "A better way to view differences between complex data structures in RSpec."
10
- s.license = "MIT"
4
+ s.name = "super_diff"
5
+ s.version = SuperDiff::VERSION
6
+ s.authors = ["Elliot Winkler"]
7
+ s.email = ["elliot.winkler@gmail.com"]
8
+ s.homepage = "https://github.com/mcmire/super_diff"
9
+ s.summary =
10
+ "A better way to view differences between complex data structures in RSpec."
11
+ s.license = "MIT"
11
12
  s.description = <<~DESC
12
13
  SuperDiff is a gem that hooks into RSpec to intelligently display the
13
14
  differences between two data structures of any type.
14
15
  DESC
15
- s.required_ruby_version = [">= 2.4", "< 4"]
16
+ s.required_ruby_version = ">= 3"
16
17
 
17
- s.files = ["README.md", "super_diff.gemspec"] + Dir["lib/**/*"]
18
- s.test_files = Dir["spec/**/*"]
19
- s.executables = Dir["exe/**/*"].map { |f| File.basename(f) }
18
+ s.files = %w[README.md super_diff.gemspec] + Dir["lib/**/*"]
19
+ s.test_files = Dir["spec/**/*"]
20
+ s.executables = Dir["exe/**/*"].map { |f| File.basename(f) }
20
21
 
21
- s.add_dependency "attr_extras", '>= 6.2.4'
22
+ s.add_dependency "attr_extras", ">= 6.2.4"
22
23
  s.add_dependency "diff-lcs"
23
24
  s.add_dependency "patience_diff"
24
25
  end
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.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Winkler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attr_extras
@@ -84,6 +84,7 @@ files:
84
84
  - lib/super_diff/active_support/object_inspection.rb
85
85
  - lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb
86
86
  - lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb
87
+ - lib/super_diff/active_support/object_inspection/inspection_tree_builders/ordered_options.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
@@ -109,6 +110,7 @@ files:
109
110
  - lib/super_diff/differs/array.rb
110
111
  - lib/super_diff/differs/base.rb
111
112
  - lib/super_diff/differs/custom_object.rb
113
+ - lib/super_diff/differs/date_like.rb
112
114
  - lib/super_diff/differs/default_object.rb
113
115
  - lib/super_diff/differs/defaults.rb
114
116
  - lib/super_diff/differs/empty.rb
@@ -127,9 +129,7 @@ files:
127
129
  - lib/super_diff/equality_matchers/primitive.rb
128
130
  - lib/super_diff/equality_matchers/singleline_string.rb
129
131
  - lib/super_diff/errors.rb
130
- - lib/super_diff/errors/no_diff_formatter_available_error.rb
131
132
  - lib/super_diff/errors/no_differ_available_error.rb
132
- - lib/super_diff/errors/no_operational_sequencer_available_error.rb
133
133
  - lib/super_diff/gem_version.rb
134
134
  - lib/super_diff/helpers.rb
135
135
  - lib/super_diff/implementation_checks.rb
@@ -140,6 +140,7 @@ files:
140
140
  - lib/super_diff/object_inspection/inspection_tree_builders/array.rb
141
141
  - lib/super_diff/object_inspection/inspection_tree_builders/base.rb
142
142
  - lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb
143
+ - lib/super_diff/object_inspection/inspection_tree_builders/date_like.rb
143
144
  - lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb
144
145
  - lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb
145
146
  - lib/super_diff/object_inspection/inspection_tree_builders/hash.rb
@@ -166,6 +167,7 @@ files:
166
167
  - lib/super_diff/operation_tree_builders/array.rb
167
168
  - lib/super_diff/operation_tree_builders/base.rb
168
169
  - lib/super_diff/operation_tree_builders/custom_object.rb
170
+ - lib/super_diff/operation_tree_builders/date_like.rb
169
171
  - lib/super_diff/operation_tree_builders/default_object.rb
170
172
  - lib/super_diff/operation_tree_builders/defaults.rb
171
173
  - lib/super_diff/operation_tree_builders/hash.rb
@@ -218,6 +220,7 @@ files:
218
220
  - lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_containing_exactly.rb
219
221
  - lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb
220
222
  - lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb
223
+ - lib/super_diff/rspec/object_inspection/inspection_tree_builders/generic_describable_matcher.rb
221
224
  - lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb
222
225
  - lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb
223
226
  - lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb
@@ -236,6 +239,7 @@ files:
236
239
  - spec/examples.txt
237
240
  - spec/integration/rails/active_record_spec.rb
238
241
  - spec/integration/rails/active_support_spec.rb
242
+ - spec/integration/rails/engines_spec.rb
239
243
  - spec/integration/rails/hash_with_indifferent_access_spec.rb
240
244
  - spec/integration/rspec/be_falsey_matcher_spec.rb
241
245
  - spec/integration/rspec/be_matcher_spec.rb
@@ -244,15 +248,18 @@ files:
244
248
  - spec/integration/rspec/be_truthy_matcher_spec.rb
245
249
  - spec/integration/rspec/contain_exactly_matcher_spec.rb
246
250
  - spec/integration/rspec/eq_matcher_spec.rb
251
+ - spec/integration/rspec/generic_describable_matchers_spec.rb
247
252
  - spec/integration/rspec/have_attributes_matcher_spec.rb
248
253
  - spec/integration/rspec/have_predicate_matcher_spec.rb
249
254
  - spec/integration/rspec/include_matcher_spec.rb
255
+ - spec/integration/rspec/magic_metadata_spec.rb
250
256
  - spec/integration/rspec/match_array_matcher_spec.rb
251
257
  - spec/integration/rspec/match_matcher_spec.rb
252
258
  - spec/integration/rspec/raise_error_matcher_spec.rb
253
259
  - spec/integration/rspec/respond_to_matcher_spec.rb
254
260
  - spec/integration/rspec/third_party_matcher_spec.rb
255
261
  - spec/integration/rspec/unhandled_errors_spec.rb
262
+ - spec/internal/log/test.log
256
263
  - spec/spec_helper.rb
257
264
  - spec/support/colorizer.rb
258
265
  - spec/support/command_runner.rb
@@ -265,6 +272,7 @@ files:
265
272
  - spec/support/integration/test_programs/rspec_active_record.rb
266
273
  - spec/support/integration/test_programs/rspec_active_support.rb
267
274
  - spec/support/integration/test_programs/rspec_rails.rb
275
+ - spec/support/integration/test_programs/rspec_rails_engine.rb
268
276
  - spec/support/models/a.rb
269
277
  - spec/support/models/active_record/person.rb
270
278
  - spec/support/models/active_record/query.rb
@@ -280,10 +288,11 @@ files:
280
288
  - spec/support/shared_examples/active_support.rb
281
289
  - spec/support/shared_examples/elided_diffs.rb
282
290
  - spec/support/shared_examples/hash_with_indifferent_access.rb
291
+ - spec/support/shared_examples/key.rb
283
292
  - spec/support/unit/helpers.rb
284
293
  - spec/support/unit/matchers/match_output.rb
285
- - spec/tmp/warnings_logger/all_warnings.txt
286
294
  - spec/unit/active_record/object_inspection_spec.rb
295
+ - spec/unit/active_support/object_inspection_spec.rb
287
296
  - spec/unit/equality_matchers/main_spec.rb
288
297
  - spec/unit/helpers_spec.rb
289
298
  - spec/unit/operation_tree_flatteners/array_spec.rb
@@ -306,6 +315,7 @@ files:
306
315
  - spec/unit/rspec/matchers/match_spec.rb
307
316
  - spec/unit/rspec/matchers/raise_error_spec.rb
308
317
  - spec/unit/rspec/matchers/respond_to_spec.rb
318
+ - spec/unit/rspec/object_inspection/rspec_matcher_spec.rb
309
319
  - spec/unit/rspec/object_inspection_spec.rb
310
320
  - spec/unit/super_diff_spec.rb
311
321
  - spec/unit/tiered_lines_elider_spec.rb
@@ -315,7 +325,7 @@ homepage: https://github.com/mcmire/super_diff
315
325
  licenses:
316
326
  - MIT
317
327
  metadata: {}
318
- post_install_message:
328
+ post_install_message:
319
329
  rdoc_options: []
320
330
  require_paths:
321
331
  - lib
@@ -323,96 +333,99 @@ required_ruby_version: !ruby/object:Gem::Requirement
323
333
  requirements:
324
334
  - - ">="
325
335
  - !ruby/object:Gem::Version
326
- version: '2.4'
327
- - - "<"
328
- - !ruby/object:Gem::Version
329
- version: '4'
336
+ version: '3'
330
337
  required_rubygems_version: !ruby/object:Gem::Requirement
331
338
  requirements:
332
339
  - - ">="
333
340
  - !ruby/object:Gem::Version
334
341
  version: '0'
335
342
  requirements: []
336
- rubyforge_project:
337
- rubygems_version: 2.7.6.3
338
- signing_key:
343
+ rubygems_version: 3.4.6
344
+ signing_key:
339
345
  specification_version: 4
340
346
  summary: A better way to view differences between complex data structures in RSpec.
341
347
  test_files:
342
- - spec/spec_helper.rb
343
- - spec/unit/tiered_lines_formatter_spec.rb
344
- - spec/unit/operation_tree_flatteners/default_object_spec.rb
345
- - spec/unit/operation_tree_flatteners/multiline_string_spec.rb
346
- - spec/unit/operation_tree_flatteners/custom_object_spec.rb
347
- - spec/unit/operation_tree_flatteners/array_spec.rb
348
- - spec/unit/operation_tree_flatteners/hash_spec.rb
349
- - spec/unit/equality_matchers/main_spec.rb
350
- - spec/unit/active_record/object_inspection_spec.rb
351
- - spec/unit/helpers_spec.rb
352
- - spec/unit/super_diff_spec.rb
353
- - spec/unit/tiered_lines_elider_spec.rb
354
- - spec/unit/rspec/object_inspection_spec.rb
355
- - spec/unit/rspec/matchers/contain_exactly_spec.rb
356
- - spec/unit/rspec/matchers/be_predicate_spec.rb
357
- - spec/unit/rspec/matchers/raise_error_spec.rb
358
- - spec/unit/rspec/matchers/have_predicate_spec.rb
359
- - spec/unit/rspec/matchers/eq_spec.rb
360
- - spec/unit/rspec/matchers/have_attributes_spec.rb
361
- - spec/unit/rspec/matchers/match_spec.rb
362
- - spec/unit/rspec/matchers/be_spec.rb
363
- - spec/unit/rspec/matchers/be_compared_to_spec.rb
364
- - spec/unit/rspec/matchers/respond_to_spec.rb
365
- - spec/unit/rspec/matchers/match_array_spec.rb
366
- - spec/unit/rspec/matchers/be_nil_spec.rb
367
- - spec/unit/rspec/matchers/be_falsey_spec.rb
368
- - spec/unit/rspec/matchers/be_truthy_spec.rb
369
- - spec/unit/rspec/matchers/include_spec.rb
370
348
  - spec/examples.txt
371
- - spec/integration/rspec/be_predicate_matcher_spec.rb
349
+ - spec/integration/rails/active_record_spec.rb
350
+ - spec/integration/rails/active_support_spec.rb
351
+ - spec/integration/rails/engines_spec.rb
352
+ - spec/integration/rails/hash_with_indifferent_access_spec.rb
372
353
  - spec/integration/rspec/be_falsey_matcher_spec.rb
373
- - spec/integration/rspec/be_truthy_matcher_spec.rb
374
- - spec/integration/rspec/be_nil_matcher_spec.rb
375
- - spec/integration/rspec/unhandled_errors_spec.rb
376
354
  - spec/integration/rspec/be_matcher_spec.rb
377
- - spec/integration/rspec/respond_to_matcher_spec.rb
378
- - spec/integration/rspec/match_matcher_spec.rb
379
- - spec/integration/rspec/match_array_matcher_spec.rb
380
- - spec/integration/rspec/third_party_matcher_spec.rb
381
- - spec/integration/rspec/have_attributes_matcher_spec.rb
382
- - spec/integration/rspec/raise_error_matcher_spec.rb
355
+ - spec/integration/rspec/be_nil_matcher_spec.rb
356
+ - spec/integration/rspec/be_predicate_matcher_spec.rb
357
+ - spec/integration/rspec/be_truthy_matcher_spec.rb
358
+ - spec/integration/rspec/contain_exactly_matcher_spec.rb
383
359
  - spec/integration/rspec/eq_matcher_spec.rb
360
+ - spec/integration/rspec/generic_describable_matchers_spec.rb
361
+ - spec/integration/rspec/have_attributes_matcher_spec.rb
384
362
  - spec/integration/rspec/have_predicate_matcher_spec.rb
385
- - spec/integration/rspec/contain_exactly_matcher_spec.rb
386
363
  - spec/integration/rspec/include_matcher_spec.rb
387
- - spec/integration/rails/active_support_spec.rb
388
- - spec/integration/rails/active_record_spec.rb
389
- - spec/integration/rails/hash_with_indifferent_access_spec.rb
364
+ - spec/integration/rspec/magic_metadata_spec.rb
365
+ - spec/integration/rspec/match_array_matcher_spec.rb
366
+ - spec/integration/rspec/match_matcher_spec.rb
367
+ - spec/integration/rspec/raise_error_matcher_spec.rb
368
+ - spec/integration/rspec/respond_to_matcher_spec.rb
369
+ - spec/integration/rspec/third_party_matcher_spec.rb
370
+ - spec/integration/rspec/unhandled_errors_spec.rb
371
+ - spec/internal/log/test.log
372
+ - spec/spec_helper.rb
373
+ - spec/support/colorizer.rb
374
+ - spec/support/command_runner.rb
390
375
  - spec/support/helpers.rb
391
- - spec/support/unit/helpers.rb
392
- - spec/support/unit/matchers/match_output.rb
376
+ - spec/support/integration/helpers.rb
377
+ - spec/support/integration/matchers/produce_output_when_run_matcher.rb
378
+ - spec/support/integration/matchers.rb
393
379
  - spec/support/integration/test_programs/base.rb
394
- - spec/support/integration/test_programs/rspec_rails.rb
395
380
  - spec/support/integration/test_programs/plain.rb
396
- - spec/support/integration/test_programs/rspec_active_support.rb
397
381
  - spec/support/integration/test_programs/rspec_active_record.rb
398
- - spec/support/integration/helpers.rb
399
- - spec/support/integration/matchers.rb
400
- - spec/support/integration/matchers/produce_output_when_run_matcher.rb
401
- - spec/support/models/item.rb
402
- - spec/support/models/customer.rb
403
- - spec/support/models/empty_class.rb
404
- - spec/support/models/player.rb
405
- - spec/support/models/active_record/shipping_address.rb
382
+ - spec/support/integration/test_programs/rspec_active_support.rb
383
+ - spec/support/integration/test_programs/rspec_rails.rb
384
+ - spec/support/integration/test_programs/rspec_rails_engine.rb
385
+ - spec/support/models/a.rb
406
386
  - spec/support/models/active_record/person.rb
407
387
  - spec/support/models/active_record/query.rb
408
- - spec/support/models/a.rb
409
- - spec/support/models/shipping_address.rb
388
+ - spec/support/models/active_record/shipping_address.rb
389
+ - spec/support/models/customer.rb
390
+ - spec/support/models/empty_class.rb
391
+ - spec/support/models/item.rb
410
392
  - spec/support/models/order.rb
411
393
  - spec/support/models/person.rb
412
- - spec/support/command_runner.rb
413
- - spec/support/colorizer.rb
414
- - spec/support/shared_examples/hash_with_indifferent_access.rb
415
- - spec/support/shared_examples/elided_diffs.rb
394
+ - spec/support/models/player.rb
395
+ - spec/support/models/shipping_address.rb
416
396
  - spec/support/shared_examples/active_record.rb
417
397
  - spec/support/shared_examples/active_support.rb
418
- - spec/tmp/warnings_logger/all_warnings.txt
398
+ - spec/support/shared_examples/elided_diffs.rb
399
+ - spec/support/shared_examples/hash_with_indifferent_access.rb
400
+ - spec/support/shared_examples/key.rb
401
+ - spec/support/unit/helpers.rb
402
+ - spec/support/unit/matchers/match_output.rb
403
+ - spec/unit/active_record/object_inspection_spec.rb
404
+ - spec/unit/active_support/object_inspection_spec.rb
405
+ - spec/unit/equality_matchers/main_spec.rb
406
+ - spec/unit/helpers_spec.rb
407
+ - spec/unit/operation_tree_flatteners/array_spec.rb
408
+ - spec/unit/operation_tree_flatteners/custom_object_spec.rb
409
+ - spec/unit/operation_tree_flatteners/default_object_spec.rb
410
+ - spec/unit/operation_tree_flatteners/hash_spec.rb
411
+ - spec/unit/operation_tree_flatteners/multiline_string_spec.rb
412
+ - spec/unit/rspec/matchers/be_compared_to_spec.rb
413
+ - spec/unit/rspec/matchers/be_falsey_spec.rb
414
+ - spec/unit/rspec/matchers/be_nil_spec.rb
415
+ - spec/unit/rspec/matchers/be_predicate_spec.rb
416
+ - spec/unit/rspec/matchers/be_spec.rb
417
+ - spec/unit/rspec/matchers/be_truthy_spec.rb
418
+ - spec/unit/rspec/matchers/contain_exactly_spec.rb
419
+ - spec/unit/rspec/matchers/eq_spec.rb
420
+ - spec/unit/rspec/matchers/have_attributes_spec.rb
421
+ - spec/unit/rspec/matchers/have_predicate_spec.rb
422
+ - spec/unit/rspec/matchers/include_spec.rb
423
+ - spec/unit/rspec/matchers/match_array_spec.rb
424
+ - spec/unit/rspec/matchers/match_spec.rb
425
+ - spec/unit/rspec/matchers/raise_error_spec.rb
426
+ - spec/unit/rspec/matchers/respond_to_spec.rb
427
+ - spec/unit/rspec/object_inspection/rspec_matcher_spec.rb
428
+ - spec/unit/rspec/object_inspection_spec.rb
429
+ - spec/unit/super_diff_spec.rb
430
+ - spec/unit/tiered_lines_elider_spec.rb
431
+ - spec/unit/tiered_lines_formatter_spec.rb
@@ -1,21 +0,0 @@
1
- module SuperDiff
2
- module Errors
3
- class NoDiffFormatterAvailableError < StandardError
4
- def self.create(operation_tree)
5
- allocate.tap do |error|
6
- error.operation_tree = operation_tree
7
- error.__send__(:initialize)
8
- end
9
- end
10
-
11
- attr_accessor :operation_tree
12
-
13
- def initialize
14
- super(<<-MESSAGE)
15
- There is no diff formatter available to handle an operation tree object of
16
- #{operation_tree.class}.
17
- MESSAGE
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- module SuperDiff
2
- module Errors
3
- class NoOperationalSequencerAvailableError < StandardError
4
- def self.create(expected, actual)
5
- allocate.tap do |error|
6
- error.expected = expected
7
- error.actual = actual
8
- error.__send__(:initialize)
9
- end
10
- end
11
-
12
- attr_accessor :expected, :actual
13
-
14
- def initialize
15
- super(<<-MESSAGE)
16
- There is no operational sequencer available to handle an "expected" value of
17
- type #{expected.class} and an "actual" value of type #{actual.class}.
18
- MESSAGE
19
- end
20
- end
21
- end
22
- end
@@ -1,2 +0,0 @@
1
-
2
- RSpec is shutting down and will print the summary report... Interrupt again to force quit.