super_diff 0.5.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -20
  3. data/lib/super_diff.rb +46 -7
  4. data/lib/super_diff/active_record.rb +7 -7
  5. data/lib/super_diff/active_record/differs/active_record_relation.rb +3 -13
  6. data/lib/super_diff/active_record/object_inspection.rb +2 -6
  7. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb +16 -0
  8. data/lib/super_diff/active_record/object_inspection/{inspectors → inspection_tree_builders}/active_record_model.rb +19 -20
  9. data/lib/super_diff/active_record/object_inspection/{inspectors → inspection_tree_builders}/active_record_relation.rb +9 -8
  10. data/lib/super_diff/active_record/operation_tree_flatteners.rb +10 -0
  11. data/lib/super_diff/active_record/operation_tree_flatteners/active_record_relation.rb +17 -0
  12. data/lib/super_diff/active_record/operation_trees/active_record_relation.rb +8 -7
  13. data/lib/super_diff/active_support.rb +8 -8
  14. data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +3 -13
  15. data/lib/super_diff/active_support/object_inspection.rb +2 -6
  16. data/lib/super_diff/active_support/object_inspection/{inspectors.rb → inspection_tree_builders.rb} +2 -2
  17. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +37 -0
  18. data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +17 -0
  19. data/lib/super_diff/active_support/operation_tree_flatteners.rb +10 -0
  20. data/lib/super_diff/active_support/operation_tree_flatteners/hash_with_indifferent_access.rb +17 -0
  21. data/lib/super_diff/active_support/operation_trees/hash_with_indifferent_access.rb +4 -7
  22. data/lib/super_diff/colorized_document_extensions.rb +9 -6
  23. data/lib/super_diff/configuration.rb +102 -19
  24. data/lib/super_diff/csi.rb +1 -1
  25. data/lib/super_diff/csi/four_bit_color.rb +0 -2
  26. data/lib/super_diff/diff_formatters/collection.rb +2 -2
  27. data/lib/super_diff/diff_formatters/multiline_string.rb +4 -4
  28. data/lib/super_diff/differs/array.rb +1 -1
  29. data/lib/super_diff/differs/base.rb +3 -21
  30. data/lib/super_diff/differs/custom_object.rb +1 -1
  31. data/lib/super_diff/differs/default_object.rb +1 -1
  32. data/lib/super_diff/differs/hash.rb +1 -1
  33. data/lib/super_diff/differs/main.rb +1 -7
  34. data/lib/super_diff/differs/multiline_string.rb +1 -1
  35. data/lib/super_diff/differs/time_like.rb +1 -1
  36. data/lib/super_diff/equality_matchers/array.rb +4 -4
  37. data/lib/super_diff/equality_matchers/default.rb +4 -4
  38. data/lib/super_diff/equality_matchers/hash.rb +4 -4
  39. data/lib/super_diff/equality_matchers/multiline_string.rb +4 -4
  40. data/lib/super_diff/equality_matchers/primitive.rb +6 -9
  41. data/lib/super_diff/equality_matchers/singleline_string.rb +4 -4
  42. data/lib/super_diff/gem_version.rb +45 -0
  43. data/lib/super_diff/helpers.rb +52 -2
  44. data/lib/super_diff/line.rb +83 -0
  45. data/lib/super_diff/object_inspection.rb +12 -9
  46. data/lib/super_diff/object_inspection/inspection_tree.rb +183 -81
  47. data/lib/super_diff/object_inspection/inspection_tree_builders.rb +44 -0
  48. data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +38 -0
  49. data/lib/super_diff/object_inspection/inspection_tree_builders/base.rb +27 -0
  50. data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +37 -0
  51. data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +63 -0
  52. data/lib/super_diff/object_inspection/{inspectors → inspection_tree_builders}/defaults.rb +1 -2
  53. data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +46 -0
  54. data/lib/super_diff/object_inspection/{inspectors → inspection_tree_builders}/main.rb +5 -10
  55. data/lib/super_diff/object_inspection/inspection_tree_builders/primitive.rb +21 -0
  56. data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +64 -0
  57. data/lib/super_diff/object_inspection/nodes.rb +33 -32
  58. data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +97 -0
  59. data/lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb +27 -0
  60. data/lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb +27 -0
  61. data/lib/super_diff/object_inspection/nodes/as_single_line.rb +33 -0
  62. data/lib/super_diff/object_inspection/nodes/base.rb +55 -20
  63. data/lib/super_diff/object_inspection/nodes/inspection.rb +47 -7
  64. data/lib/super_diff/object_inspection/nodes/nesting.rb +16 -5
  65. data/lib/super_diff/object_inspection/nodes/only_when.rb +54 -0
  66. data/lib/super_diff/object_inspection/nodes/text.rb +16 -2
  67. data/lib/super_diff/object_inspection/nodes/when_empty.rb +21 -6
  68. data/lib/super_diff/object_inspection/nodes/when_non_empty.rb +20 -5
  69. data/lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb +27 -0
  70. data/lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb +27 -0
  71. data/lib/super_diff/object_inspection/prefix_for_next_node.rb +6 -0
  72. data/lib/super_diff/object_inspection/prelude_for_next_node.rb +6 -0
  73. data/lib/super_diff/operation_tree_builders/array.rb +7 -10
  74. data/lib/super_diff/operation_tree_builders/base.rb +6 -6
  75. data/lib/super_diff/operation_tree_builders/custom_object.rb +5 -2
  76. data/lib/super_diff/operation_tree_builders/default_object.rb +1 -1
  77. data/lib/super_diff/operation_tree_builders/defaults.rb +1 -1
  78. data/lib/super_diff/operation_tree_builders/hash.rb +1 -8
  79. data/lib/super_diff/operation_tree_builders/multiline_string.rb +2 -6
  80. data/lib/super_diff/operation_tree_builders/time_like.rb +2 -2
  81. data/lib/super_diff/operation_tree_flatteners.rb +20 -0
  82. data/lib/super_diff/operation_tree_flatteners/array.rb +15 -0
  83. data/lib/super_diff/operation_tree_flatteners/base.rb +54 -0
  84. data/lib/super_diff/operation_tree_flatteners/collection.rb +139 -0
  85. data/lib/super_diff/operation_tree_flatteners/custom_object.rb +28 -0
  86. data/lib/super_diff/operation_tree_flatteners/default_object.rb +32 -0
  87. data/lib/super_diff/operation_tree_flatteners/hash.rb +41 -0
  88. data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +17 -0
  89. data/lib/super_diff/operation_trees/array.rb +4 -7
  90. data/lib/super_diff/operation_trees/base.rb +39 -16
  91. data/lib/super_diff/operation_trees/custom_object.rb +4 -8
  92. data/lib/super_diff/operation_trees/default_object.rb +28 -13
  93. data/lib/super_diff/operation_trees/hash.rb +4 -7
  94. data/lib/super_diff/operation_trees/main.rb +1 -1
  95. data/lib/super_diff/operation_trees/multiline_string.rb +4 -7
  96. data/lib/super_diff/operations/binary_operation.rb +1 -6
  97. data/lib/super_diff/operations/unary_operation.rb +2 -30
  98. data/lib/super_diff/recursion_guard.rb +3 -3
  99. data/lib/super_diff/rspec.rb +41 -13
  100. data/lib/super_diff/rspec/differs/collection_including.rb +4 -2
  101. data/lib/super_diff/rspec/differs/hash_including.rb +4 -2
  102. data/lib/super_diff/rspec/matcher_text_builders/base.rb +7 -7
  103. data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +6 -6
  104. data/lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb +1 -1
  105. data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +4 -4
  106. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -1
  107. data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +5 -5
  108. data/lib/super_diff/rspec/monkey_patches.rb +353 -306
  109. data/lib/super_diff/rspec/object_inspection.rb +4 -1
  110. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +44 -0
  111. data/lib/super_diff/rspec/object_inspection/{inspectors → inspection_tree_builders}/collection_containing_exactly.rb +9 -8
  112. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +34 -0
  113. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +103 -0
  114. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +36 -0
  115. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +26 -0
  116. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +26 -0
  117. data/lib/super_diff/rspec/object_inspection/{inspectors → inspection_tree_builders}/object_having_attributes.rb +10 -12
  118. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/primitive.rb +10 -0
  119. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/value_within.rb +33 -0
  120. data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +12 -4
  121. data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +10 -3
  122. data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +10 -3
  123. data/lib/super_diff/tiered_lines.rb +4 -0
  124. data/lib/super_diff/tiered_lines_elider.rb +490 -0
  125. data/lib/super_diff/tiered_lines_formatter.rb +79 -0
  126. data/lib/super_diff/version.rb +1 -1
  127. data/spec/examples.txt +407 -5
  128. data/spec/integration/rails/active_support_spec.rb +19 -0
  129. data/spec/integration/rspec/be_falsey_matcher_spec.rb +10 -10
  130. data/spec/integration/rspec/be_matcher_spec.rb +100 -100
  131. data/spec/integration/rspec/be_nil_matcher_spec.rb +10 -10
  132. data/spec/integration/rspec/be_predicate_matcher_spec.rb +103 -103
  133. data/spec/integration/rspec/be_truthy_matcher_spec.rb +10 -10
  134. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +113 -107
  135. data/spec/integration/rspec/eq_matcher_spec.rb +223 -277
  136. data/spec/integration/rspec/have_attributes_matcher_spec.rb +138 -129
  137. data/spec/integration/rspec/have_predicate_matcher_spec.rb +65 -65
  138. data/spec/integration/rspec/include_matcher_spec.rb +73 -73
  139. data/spec/integration/rspec/match_array_matcher_spec.rb +126 -119
  140. data/spec/integration/rspec/match_matcher_spec.rb +362 -274
  141. data/spec/integration/rspec/raise_error_matcher_spec.rb +86 -86
  142. data/spec/integration/rspec/respond_to_matcher_spec.rb +240 -240
  143. data/spec/integration/rspec/third_party_matcher_spec.rb +8 -8
  144. data/spec/integration/rspec/unhandled_errors_spec.rb +5 -5
  145. data/spec/spec_helper.rb +33 -13
  146. data/spec/support/command_runner.rb +15 -25
  147. data/spec/support/helpers.rb +21 -0
  148. data/spec/support/integration/helpers.rb +8 -2
  149. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +4 -4
  150. data/spec/support/integration/test_programs/base.rb +38 -10
  151. data/spec/support/integration/test_programs/rspec_active_record.rb +1 -1
  152. data/spec/support/integration/test_programs/rspec_active_support.rb +17 -0
  153. data/spec/support/integration/test_programs/rspec_rails.rb +1 -1
  154. data/spec/support/shared_examples/active_record.rb +109 -108
  155. data/spec/support/shared_examples/active_support.rb +65 -0
  156. data/spec/support/shared_examples/elided_diffs.rb +914 -0
  157. data/spec/support/shared_examples/hash_with_indifferent_access.rb +196 -232
  158. data/spec/support/unit/helpers.rb +15 -0
  159. data/spec/support/unit/matchers/match_output.rb +41 -0
  160. data/spec/unit/active_record/object_inspection_spec.rb +273 -0
  161. data/spec/unit/equality_matchers/main_spec.rb +445 -465
  162. data/spec/unit/helpers_spec.rb +61 -0
  163. data/spec/unit/operation_tree_flatteners/array_spec.rb +604 -0
  164. data/spec/unit/operation_tree_flatteners/custom_object_spec.rb +667 -0
  165. data/spec/unit/operation_tree_flatteners/default_object_spec.rb +687 -0
  166. data/spec/unit/operation_tree_flatteners/hash_spec.rb +632 -0
  167. data/spec/unit/operation_tree_flatteners/multiline_string_spec.rb +121 -0
  168. data/spec/unit/rspec/object_inspection_spec.rb +446 -0
  169. data/spec/unit/super_diff_spec.rb +1958 -0
  170. data/spec/unit/tiered_lines_elider_spec.rb +6356 -0
  171. data/spec/unit/tiered_lines_formatter_spec.rb +193 -0
  172. data/super_diff.gemspec +1 -1
  173. metadata +95 -50
  174. data/lib/super_diff/active_record/diff_formatters.rb +0 -10
  175. data/lib/super_diff/active_record/diff_formatters/active_record_relation.rb +0 -23
  176. data/lib/super_diff/active_record/object_inspection/inspectors.rb +0 -16
  177. data/lib/super_diff/active_support/diff_formatters.rb +0 -10
  178. data/lib/super_diff/active_support/diff_formatters/hash_with_indifferent_access.rb +0 -36
  179. data/lib/super_diff/active_support/object_inspection/inspectors/hash_with_indifferent_access.rb +0 -28
  180. data/lib/super_diff/diff_formatters.rb +0 -14
  181. data/lib/super_diff/diff_formatters/array.rb +0 -21
  182. data/lib/super_diff/diff_formatters/base.rb +0 -33
  183. data/lib/super_diff/diff_formatters/custom_object.rb +0 -30
  184. data/lib/super_diff/diff_formatters/default_object.rb +0 -46
  185. data/lib/super_diff/diff_formatters/defaults.rb +0 -10
  186. data/lib/super_diff/diff_formatters/hash.rb +0 -34
  187. data/lib/super_diff/diff_formatters/main.rb +0 -41
  188. data/lib/super_diff/object_inspection/inspectors.rb +0 -23
  189. data/lib/super_diff/object_inspection/inspectors/array.rb +0 -32
  190. data/lib/super_diff/object_inspection/inspectors/base.rb +0 -36
  191. data/lib/super_diff/object_inspection/inspectors/custom_object.rb +0 -37
  192. data/lib/super_diff/object_inspection/inspectors/default_object.rb +0 -61
  193. data/lib/super_diff/object_inspection/inspectors/hash.rb +0 -32
  194. data/lib/super_diff/object_inspection/inspectors/primitive.rb +0 -28
  195. data/lib/super_diff/object_inspection/inspectors/string.rb +0 -23
  196. data/lib/super_diff/object_inspection/inspectors/time_like.rb +0 -23
  197. data/lib/super_diff/object_inspection/nodes/break.rb +0 -15
  198. data/lib/super_diff/object_inspection/nodes/when_multiline.rb +0 -22
  199. data/lib/super_diff/object_inspection/nodes/when_singleline.rb +0 -24
  200. data/lib/super_diff/rspec/object_inspection/inspectors.rb +0 -40
  201. data/lib/super_diff/rspec/object_inspection/inspectors/collection_including.rb +0 -28
  202. data/lib/super_diff/rspec/object_inspection/inspectors/hash_including.rb +0 -31
  203. data/lib/super_diff/rspec/object_inspection/inspectors/instance_of.rb +0 -23
  204. data/lib/super_diff/rspec/object_inspection/inspectors/kind_of.rb +0 -23
  205. data/lib/super_diff/rspec/object_inspection/inspectors/primitive.rb +0 -13
  206. data/lib/super_diff/rspec/object_inspection/inspectors/value_within.rb +0 -29
  207. data/spec/support/object_id.rb +0 -27
  208. data/spec/support/ruby_versions.rb +0 -11
  209. data/spec/unit/object_inspection_spec.rb +0 -1168
@@ -0,0 +1,15 @@
1
+ module SuperDiff
2
+ module UnitTests
3
+ def with_configuration(configuration)
4
+ old_configuration = SuperDiff.configuration.dup
5
+ SuperDiff.configuration.merge!(configuration)
6
+ yield.tap do
7
+ SuperDiff.configuration.merge!(old_configuration)
8
+ end
9
+ end
10
+
11
+ def colored(*args, **opts, &block)
12
+ SuperDiff::Helpers.style(*args, **opts, &block).to_s.chomp
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,41 @@
1
+ module SuperDiff
2
+ module UnitTests
3
+ def match_output(expected_output)
4
+ MatchOutputMatcher.new(expected_output)
5
+ end
6
+
7
+ class MatchOutputMatcher
8
+ extend AttrExtras.mixin
9
+
10
+ pattr_initialize :expected_output
11
+ attr_private :actual_output
12
+
13
+ def matches?(actual_output)
14
+ @actual_output = actual_output
15
+ actual_output == expected_output
16
+ end
17
+
18
+ def failure_message
19
+ message =
20
+ "Expected colored output to be printed, but got a mismatch.\n\n" +
21
+ "Expected output:\n\n" +
22
+ SuperDiff::Test::OutputHelpers.bookended(expected_output) +
23
+ "\n" +
24
+ "Actual output:\n\n" +
25
+ SuperDiff::Test::OutputHelpers.bookended(actual_output)
26
+
27
+ if ["1", "true"].include?(ENV["SHOW_DIFF"])
28
+ ::RSpec::Matchers::ExpectedsForMultipleDiffs.
29
+ from(expected_output).
30
+ message_with_diff(
31
+ message,
32
+ ::RSpec::Expectations.differ,
33
+ actual_output,
34
+ )
35
+ else
36
+ message
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,273 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe SuperDiff, type: :unit do
4
+ describe ".inspect_object", "for ActiveRecord objects", active_record: true do
5
+ context "given an ActiveRecord object" do
6
+ context "given as_lines: false" do
7
+ it "returns an inspected version of the object" do
8
+ string = described_class.inspect_object(
9
+ SuperDiff::Test::Models::ActiveRecord::Person.new(
10
+ name: "Elliot",
11
+ age: 31,
12
+ ),
13
+ as_lines: false,
14
+ )
15
+ expect(string).to eq(
16
+ %(#<SuperDiff::Test::Models::ActiveRecord::Person id: nil, age: 31, name: "Elliot">)
17
+ )
18
+ end
19
+ end
20
+
21
+ context "given as_lines: true" do
22
+ it "returns an inspected version of the object as multiple Lines" do
23
+ tiered_lines = described_class.inspect_object(
24
+ SuperDiff::Test::Models::ActiveRecord::Person.new(
25
+ name: "Elliot",
26
+ age: 31,
27
+ ),
28
+ as_lines: true,
29
+ type: :delete,
30
+ indentation_level: 1,
31
+ )
32
+ expect(tiered_lines).to match([
33
+ an_object_having_attributes(
34
+ type: :delete,
35
+ indentation_level: 1,
36
+ value: %(#<SuperDiff::Test::Models::ActiveRecord::Person {),
37
+ collection_bookend: :open,
38
+ ),
39
+ an_object_having_attributes(
40
+ type: :delete,
41
+ indentation_level: 2,
42
+ prefix: %(id: ),
43
+ value: %(nil),
44
+ add_comma: true,
45
+ ),
46
+ an_object_having_attributes(
47
+ type: :delete,
48
+ indentation_level: 2,
49
+ prefix: %(age: ),
50
+ value: %(31),
51
+ add_comma: true,
52
+ ),
53
+ an_object_having_attributes(
54
+ type: :delete,
55
+ indentation_level: 2,
56
+ prefix: %(name: ),
57
+ value: %("Elliot"),
58
+ add_comma: false,
59
+ ),
60
+ an_object_having_attributes(
61
+ type: :delete,
62
+ indentation_level: 1,
63
+ value: %(}>),
64
+ collection_bookend: :close,
65
+ ),
66
+ ])
67
+ end
68
+ end
69
+ end
70
+
71
+ context "given an ActiveRecord::Relation object" do
72
+ context "given as_lines: false" do
73
+ it "returns an inspected version of the Relation" do
74
+ SuperDiff::Test::Models::ActiveRecord::Person.create!(
75
+ name: "Marty",
76
+ age: 19,
77
+ )
78
+ SuperDiff::Test::Models::ActiveRecord::Person.create!(
79
+ name: "Jennifer",
80
+ age: 17,
81
+ )
82
+
83
+ string = described_class.inspect_object(
84
+ SuperDiff::Test::Models::ActiveRecord::Person.all,
85
+ as_lines: false,
86
+ )
87
+
88
+ expect(string).to eq(
89
+ %(#<ActiveRecord::Relation [#<SuperDiff::Test::Models::ActiveRecord::Person id: 1, age: 19, name: "Marty">, #<SuperDiff::Test::Models::ActiveRecord::Person id: 2, age: 17, name: "Jennifer">]>)
90
+ )
91
+ end
92
+ end
93
+
94
+ context "given as_lines: true" do
95
+ it "returns an inspected version of the Relation as multiple Lines" do
96
+ SuperDiff::Test::Models::ActiveRecord::Person.create!(
97
+ name: "Marty",
98
+ age: 19,
99
+ )
100
+ SuperDiff::Test::Models::ActiveRecord::Person.create!(
101
+ name: "Jennifer",
102
+ age: 17,
103
+ )
104
+
105
+ tiered_lines = described_class.inspect_object(
106
+ SuperDiff::Test::Models::ActiveRecord::Person.all,
107
+ as_lines: true,
108
+ type: :delete,
109
+ indentation_level: 1,
110
+ )
111
+
112
+ expect(tiered_lines).to match([
113
+ an_object_having_attributes(
114
+ type: :delete,
115
+ indentation_level: 1,
116
+ value: %(#<ActiveRecord::Relation [),
117
+ collection_bookend: :open,
118
+ ),
119
+ an_object_having_attributes(
120
+ type: :delete,
121
+ indentation_level: 2,
122
+ value: %(#<SuperDiff::Test::Models::ActiveRecord::Person {),
123
+ collection_bookend: :open,
124
+ ),
125
+ an_object_having_attributes(
126
+ type: :delete,
127
+ indentation_level: 3,
128
+ prefix: %(id: ),
129
+ value: %(1),
130
+ add_comma: true,
131
+ ),
132
+ an_object_having_attributes(
133
+ type: :delete,
134
+ indentation_level: 3,
135
+ prefix: %(age: ),
136
+ value: %(19),
137
+ add_comma: true,
138
+ ),
139
+ an_object_having_attributes(
140
+ type: :delete,
141
+ indentation_level: 3,
142
+ prefix: %(name: ),
143
+ value: %("Marty"),
144
+ add_comma: false,
145
+ ),
146
+ an_object_having_attributes(
147
+ type: :delete,
148
+ indentation_level: 2,
149
+ value: %(}>),
150
+ collection_bookend: :close,
151
+ ),
152
+ an_object_having_attributes(
153
+ type: :delete,
154
+ indentation_level: 2,
155
+ value: %(#<SuperDiff::Test::Models::ActiveRecord::Person {),
156
+ collection_bookend: :open,
157
+ ),
158
+ an_object_having_attributes(
159
+ type: :delete,
160
+ indentation_level: 3,
161
+ prefix: %(id: ),
162
+ value: %(2),
163
+ add_comma: true,
164
+ ),
165
+ an_object_having_attributes(
166
+ type: :delete,
167
+ indentation_level: 3,
168
+ prefix: %(age: ),
169
+ value: %(17),
170
+ add_comma: true,
171
+ ),
172
+ an_object_having_attributes(
173
+ type: :delete,
174
+ indentation_level: 3,
175
+ prefix: %(name: ),
176
+ value: %("Jennifer"),
177
+ add_comma: false,
178
+ ),
179
+ an_object_having_attributes(
180
+ type: :delete,
181
+ indentation_level: 2,
182
+ value: %(}>),
183
+ collection_bookend: :close,
184
+ ),
185
+ an_object_having_attributes(
186
+ type: :delete,
187
+ indentation_level: 1,
188
+ value: %(]>),
189
+ collection_bookend: :close,
190
+ ),
191
+ ])
192
+ end
193
+ end
194
+ end
195
+
196
+ context "given a HashWithIndifferentAccess" do
197
+ context "given as_lines: false" do
198
+ it "returns an inspected version of the object" do
199
+ string = described_class.inspect_object(
200
+ HashWithIndifferentAccess.new({
201
+ line_1: "123 Main St.",
202
+ city: "Hill Valley",
203
+ state: "CA",
204
+ zip: "90382",
205
+ }),
206
+ as_lines: false,
207
+ )
208
+ expect(string).to eq(
209
+ %(#<HashWithIndifferentAccess { "line_1" => "123 Main St.", "city" => "Hill Valley", "state" => "CA", "zip" => "90382" }>),
210
+ )
211
+ end
212
+ end
213
+
214
+ context "given as_lines: true" do
215
+ it "returns an inspected version of the object as multiple Lines" do
216
+ tiered_lines = described_class.inspect_object(
217
+ HashWithIndifferentAccess.new({
218
+ line_1: "123 Main St.",
219
+ city: "Hill Valley",
220
+ state: "CA",
221
+ zip: "90382",
222
+ }),
223
+ as_lines: true,
224
+ type: :delete,
225
+ indentation_level: 1,
226
+ )
227
+ expect(tiered_lines).to match([
228
+ an_object_having_attributes(
229
+ type: :delete,
230
+ indentation_level: 1,
231
+ value: %(#<HashWithIndifferentAccess {),
232
+ collection_bookend: :open,
233
+ ),
234
+ an_object_having_attributes(
235
+ type: :delete,
236
+ indentation_level: 2,
237
+ prefix: %("line_1" => ),
238
+ value: %("123 Main St."),
239
+ add_comma: true,
240
+ ),
241
+ an_object_having_attributes(
242
+ type: :delete,
243
+ indentation_level: 2,
244
+ prefix: %("city" => ),
245
+ value: %("Hill Valley"),
246
+ add_comma: true,
247
+ ),
248
+ an_object_having_attributes(
249
+ type: :delete,
250
+ indentation_level: 2,
251
+ prefix: %("state" => ),
252
+ value: %("CA"),
253
+ add_comma: true,
254
+ ),
255
+ an_object_having_attributes(
256
+ type: :delete,
257
+ indentation_level: 2,
258
+ prefix: %("zip" => ),
259
+ value: %("90382"),
260
+ add_comma: false,
261
+ ),
262
+ an_object_having_attributes(
263
+ type: :delete,
264
+ indentation_level: 1,
265
+ value: %(}>),
266
+ collection_bookend: :close,
267
+ ),
268
+ ])
269
+ end
270
+ end
271
+ end
272
+ end
273
+ end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe SuperDiff::EqualityMatchers::Main do
3
+ RSpec.describe SuperDiff::EqualityMatchers::Main, type: :unit do
4
4
  describe "#call" do
5
5
  context "given the same integers" do
6
6
  it "returns an empty string" do
@@ -27,13 +27,13 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
27
27
 
28
28
  #{
29
29
  colored do
30
- alpha_line %(Expected: 42)
31
- beta_line %( Actual: 1)
30
+ expected_line %(Expected: 42)
31
+ actual_line %( Actual: 1)
32
32
  end
33
33
  }
34
34
  STR
35
35
 
36
- expect(actual_output).to eq(expected_output)
36
+ expect(actual_output).to match_output(expected_output)
37
37
  end
38
38
  end
39
39
 
@@ -54,13 +54,13 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
54
54
 
55
55
  #{
56
56
  colored do
57
- alpha_line %(Expected: :foo)
58
- beta_line %( Actual: :bar)
57
+ expected_line %(Expected: :foo)
58
+ actual_line %( Actual: :bar)
59
59
  end
60
60
  }
61
61
  STR
62
62
 
63
- expect(actual_output).to eq(expected_output)
63
+ expect(actual_output).to match_output(expected_output)
64
64
  end
65
65
  end
66
66
 
@@ -84,13 +84,13 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
84
84
 
85
85
  #{
86
86
  colored do
87
- alpha_line %(Expected: "Marty")
88
- beta_line %( Actual: "Jennifer")
87
+ expected_line %(Expected: "Marty")
88
+ actual_line %( Actual: "Jennifer")
89
89
  end
90
90
  }
91
91
  STR
92
92
 
93
- expect(actual_output).to eq(expected_output)
93
+ expect(actual_output).to match_output(expected_output)
94
94
  end
95
95
  end
96
96
 
@@ -106,13 +106,13 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
106
106
 
107
107
  #{
108
108
  colored do
109
- alpha_line %(Expected: "Marty")
110
- beta_line %( Actual: "Marty McFly")
109
+ expected_line %(Expected: "Marty")
110
+ actual_line %( Actual: "Marty McFly")
111
111
  end
112
112
  }
113
113
  STR
114
114
 
115
- expect(actual_output).to eq(expected_output)
115
+ expect(actual_output).to match_output(expected_output)
116
116
  end
117
117
  end
118
118
 
@@ -128,13 +128,13 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
128
128
 
129
129
  #{
130
130
  colored do
131
- alpha_line %(Expected: "Something entirely different")
132
- beta_line %( Actual: "This is a line\\nAnd that's another line\\n")
131
+ expected_line %(Expected: "Something entirely different")
132
+ actual_line %( Actual: "This is a line\\nAnd that's another line\\n")
133
133
  end
134
134
  }
135
135
  STR
136
136
 
137
- expect(actual_output).to eq(expected_output)
137
+ expect(actual_output).to match_output(expected_output)
138
138
  end
139
139
  end
140
140
 
@@ -150,13 +150,13 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
150
150
 
151
151
  #{
152
152
  colored do
153
- alpha_line %(Expected: "This is a line\\nAnd that's another line\\n")
154
- beta_line %( Actual: "Something entirely different")
153
+ expected_line %(Expected: "This is a line\\nAnd that's another line\\n")
154
+ actual_line %( Actual: "Something entirely different")
155
155
  end
156
156
  }
157
157
  STR
158
158
 
159
- expect(actual_output).to eq(expected_output)
159
+ expect(actual_output).to match_output(expected_output)
160
160
  end
161
161
  end
162
162
 
@@ -172,8 +172,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
172
172
 
173
173
  #{
174
174
  colored do
175
- alpha_line %(Expected: "This is a line\\nAnd that's a line\\nAnd there's a line too")
176
- beta_line %( Actual: "This is a line\\nSomething completely different\\nAnd there's a line too")
175
+ expected_line %(Expected: "This is a line\\nAnd that's a line\\nAnd there's a line too")
176
+ actual_line %( Actual: "This is a line\\nSomething completely different\\nAnd there's a line too")
177
177
  end
178
178
  }
179
179
 
@@ -181,15 +181,15 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
181
181
 
182
182
  #{
183
183
  colored do
184
- plain_line %( This is a line\\n)
185
- alpha_line %(- And that's a line\\n)
186
- beta_line %(+ Something completely different\\n)
187
- plain_line %( And there's a line too)
184
+ plain_line %( This is a line\\n)
185
+ expected_line %(- And that's a line\\n)
186
+ actual_line %(+ Something completely different\\n)
187
+ plain_line %( And there's a line too)
188
188
  end
189
189
  }
190
190
  STR
191
191
 
192
- expect(actual_output).to eq(expected_output)
192
+ expect(actual_output).to match_output(expected_output)
193
193
  end
194
194
  end
195
195
 
@@ -205,8 +205,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
205
205
 
206
206
  #{
207
207
  colored do
208
- alpha_line %(Expected: "This is a line\\nAnd that's a line\\n")
209
- beta_line %( Actual: "Something completely different\\nAnd something else too\\n")
208
+ expected_line %(Expected: "This is a line\\nAnd that's a line\\n")
209
+ actual_line %( Actual: "Something completely different\\nAnd something else too\\n")
210
210
  end
211
211
  }
212
212
 
@@ -214,15 +214,15 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
214
214
 
215
215
  #{
216
216
  colored do
217
- alpha_line %(- This is a line\\n)
218
- alpha_line %(- And that's a line\\n)
219
- beta_line %(+ Something completely different\\n)
220
- beta_line %(+ And something else too\\n)
217
+ expected_line %(- This is a line\\n)
218
+ expected_line %(- And that's a line\\n)
219
+ actual_line %(+ Something completely different\\n)
220
+ actual_line %(+ And something else too\\n)
221
221
  end
222
222
  }
223
223
  STR
224
224
 
225
- expect(actual_output).to eq(expected_output)
225
+ expect(actual_output).to match_output(expected_output)
226
226
  end
227
227
  end
228
228
 
@@ -264,12 +264,12 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
264
264
 
265
265
  #{
266
266
  colored do
267
- alpha_line do
267
+ expected_line do
268
268
  text "Expected: "
269
269
  text %("\\e[34mThis is a line\\e[0m\\n\\e[38;5;176mAnd that's a line\\e[0m\\n\\e[38;2;47;59;164mAnd there's a line too\\e[0m\\n")
270
270
  end
271
271
 
272
- beta_line do
272
+ actual_line do
273
273
  text " Actual: "
274
274
  text %("\\e[34mThis is a line\\e[0m\\n\\e[38;5;176mSomething completely different\\e[0m\\n\\e[38;2;47;59;164mAnd there's a line too\\e[0m\\n")
275
275
  end
@@ -280,15 +280,15 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
280
280
 
281
281
  #{
282
282
  colored do
283
- plain_line %( \\e[34mThis is a line\\e[0m\\n)
284
- alpha_line %(- \\e[38;5;176mAnd that's a line\\e[0m\\n)
285
- beta_line %(+ \\e[38;5;176mSomething completely different\\e[0m\\n)
286
- plain_line %( \\e[38;2;47;59;164mAnd there's a line too\\e[0m\\n)
283
+ plain_line %( \\e[34mThis is a line\\e[0m\\n)
284
+ expected_line %(- \\e[38;5;176mAnd that's a line\\e[0m\\n)
285
+ actual_line %(+ \\e[38;5;176mSomething completely different\\e[0m\\n)
286
+ plain_line %( \\e[38;2;47;59;164mAnd there's a line too\\e[0m\\n)
287
287
  end
288
288
  }
289
289
  STR
290
290
 
291
- expect(actual_output).to eq(expected_output)
291
+ expect(actual_output).to match_output(expected_output)
292
292
  end
293
293
  end
294
294
 
@@ -315,8 +315,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
315
315
 
316
316
  #{
317
317
  colored do
318
- alpha_line %(Expected: [1, 2, 3, 4])
319
- beta_line %( Actual: [1, 2, 99, 4])
318
+ expected_line %(Expected: [1, 2, 3, 4])
319
+ actual_line %( Actual: [1, 2, 99, 4])
320
320
  end
321
321
  }
322
322
 
@@ -324,18 +324,18 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
324
324
 
325
325
  #{
326
326
  colored do
327
- plain_line %( [)
328
- plain_line %( 1,)
329
- plain_line %( 2,)
330
- alpha_line %(- 3,)
331
- beta_line %(+ 99,)
332
- plain_line %( 4)
333
- plain_line %( ])
327
+ plain_line %( [)
328
+ plain_line %( 1,)
329
+ plain_line %( 2,)
330
+ expected_line %(- 3,)
331
+ actual_line %(+ 99,)
332
+ plain_line %( 4)
333
+ plain_line %( ])
334
334
  end
335
335
  }
336
336
  STR
337
337
 
338
- expect(actual_output).to eq(expected_output)
338
+ expect(actual_output).to match_output(expected_output)
339
339
  end
340
340
  end
341
341
 
@@ -351,8 +351,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
351
351
 
352
352
  #{
353
353
  colored do
354
- alpha_line %(Expected: [:one, :fish, :two, :fish])
355
- beta_line %( Actual: [:one, :FISH, :two, :fish])
354
+ expected_line %(Expected: [:one, :fish, :two, :fish])
355
+ actual_line %( Actual: [:one, :FISH, :two, :fish])
356
356
  end
357
357
  }
358
358
 
@@ -360,18 +360,18 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
360
360
 
361
361
  #{
362
362
  colored do
363
- plain_line %( [)
364
- plain_line %( :one,)
365
- alpha_line %(- :fish,)
366
- beta_line %(+ :FISH,)
367
- plain_line %( :two,)
368
- plain_line %( :fish)
369
- plain_line %( ])
363
+ plain_line %( [)
364
+ plain_line %( :one,)
365
+ expected_line %(- :fish,)
366
+ actual_line %(+ :FISH,)
367
+ plain_line %( :two,)
368
+ plain_line %( :fish)
369
+ plain_line %( ])
370
370
  end
371
371
  }
372
372
  STR
373
373
 
374
- expect(actual_output).to eq(expected_output)
374
+ expect(actual_output).to match_output(expected_output)
375
375
  end
376
376
  end
377
377
 
@@ -387,8 +387,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
387
387
 
388
388
  #{
389
389
  colored do
390
- alpha_line %(Expected: ["sausage", "egg", "cheese"])
391
- beta_line %( Actual: ["bacon", "egg", "cheese"])
390
+ expected_line %(Expected: ["sausage", "egg", "cheese"])
391
+ actual_line %( Actual: ["bacon", "egg", "cheese"])
392
392
  end
393
393
  }
394
394
 
@@ -396,17 +396,17 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
396
396
 
397
397
  #{
398
398
  colored do
399
- plain_line %( [)
400
- alpha_line %(- "sausage",)
401
- beta_line %(+ "bacon",)
402
- plain_line %( "egg",)
403
- plain_line %( "cheese")
404
- plain_line %( ])
399
+ plain_line %( [)
400
+ expected_line %(- "sausage",)
401
+ actual_line %(+ "bacon",)
402
+ plain_line %( "egg",)
403
+ plain_line %( "cheese")
404
+ plain_line %( ])
405
405
  end
406
406
  }
407
407
  STR
408
408
 
409
- expect(actual_output).to eq(expected_output)
409
+ expect(actual_output).to match_output(expected_output)
410
410
  end
411
411
  end
412
412
 
@@ -428,8 +428,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
428
428
 
429
429
  #{
430
430
  colored do
431
- alpha_line %(Expected: [#<SuperDiff::Test::Person name: "Marty", age: 18>, #<SuperDiff::Test::Person name: "Jennifer", age: 17>])
432
- beta_line %( Actual: [#<SuperDiff::Test::Person name: "Marty", age: 18>, #<SuperDiff::Test::Person name: "Doc", age: 50>])
431
+ expected_line %(Expected: [#<SuperDiff::Test::Person name: "Marty", age: 18>, #<SuperDiff::Test::Person name: "Jennifer", age: 17>])
432
+ actual_line %( Actual: [#<SuperDiff::Test::Person name: "Marty", age: 18>, #<SuperDiff::Test::Person name: "Doc", age: 50>])
433
433
  end
434
434
  }
435
435
 
@@ -437,23 +437,23 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
437
437
 
438
438
  #{
439
439
  colored do
440
- plain_line %( [)
441
- plain_line %( #<SuperDiff::Test::Person {)
442
- plain_line %( name: "Marty",)
443
- plain_line %( age: 18)
444
- plain_line %( }>,)
445
- plain_line %( #<SuperDiff::Test::Person {)
446
- alpha_line %(- name: "Jennifer",)
447
- beta_line %(+ name: "Doc",)
448
- alpha_line %(- age: 17)
449
- beta_line %(+ age: 50)
450
- plain_line %( }>)
451
- plain_line %( ])
440
+ plain_line %( [)
441
+ plain_line %( #<SuperDiff::Test::Person {)
442
+ plain_line %( name: "Marty",)
443
+ plain_line %( age: 18)
444
+ plain_line %( }>,)
445
+ plain_line %( #<SuperDiff::Test::Person {)
446
+ expected_line %(- name: "Jennifer",)
447
+ actual_line %(+ name: "Doc",)
448
+ expected_line %(- age: 17)
449
+ actual_line %(+ age: 50)
450
+ plain_line %( }>)
451
+ plain_line %( ])
452
452
  end
453
453
  }
454
454
  STR
455
455
 
456
- expect(actual_output).to eq(expected_output)
456
+ expect(actual_output).to match_output(expected_output)
457
457
  end
458
458
  end
459
459
 
@@ -469,8 +469,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
469
469
 
470
470
  #{
471
471
  colored do
472
- alpha_line %(Expected: ["bread"])
473
- beta_line %( Actual: ["bread", "eggs", "milk"])
472
+ expected_line %(Expected: ["bread"])
473
+ actual_line %( Actual: ["bread", "eggs", "milk"])
474
474
  end
475
475
  }
476
476
 
@@ -478,16 +478,16 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
478
478
 
479
479
  #{
480
480
  colored do
481
- plain_line %( [)
482
- plain_line %( "bread",)
483
- beta_line %(+ "eggs",)
484
- beta_line %(+ "milk")
485
- plain_line %( ])
481
+ plain_line %( [)
482
+ plain_line %( "bread",)
483
+ actual_line %(+ "eggs",)
484
+ actual_line %(+ "milk")
485
+ plain_line %( ])
486
486
  end
487
487
  }
488
488
  STR
489
489
 
490
- expect(actual_output).to eq(expected_output)
490
+ expect(actual_output).to match_output(expected_output)
491
491
  end
492
492
  end
493
493
 
@@ -503,8 +503,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
503
503
 
504
504
  #{
505
505
  colored do
506
- alpha_line %(Expected: ["bread", "eggs", "milk"])
507
- beta_line %( Actual: ["bread"])
506
+ expected_line %(Expected: ["bread", "eggs", "milk"])
507
+ actual_line %( Actual: ["bread"])
508
508
  end
509
509
  }
510
510
 
@@ -512,16 +512,16 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
512
512
 
513
513
  #{
514
514
  colored do
515
- plain_line %( [)
516
- plain_line %( "bread")
517
- alpha_line %(- "eggs",)
518
- alpha_line %(- "milk")
519
- plain_line %( ])
515
+ plain_line %( [)
516
+ plain_line %( "bread")
517
+ expected_line %(- "eggs",)
518
+ expected_line %(- "milk")
519
+ plain_line %( ])
520
520
  end
521
521
  }
522
522
  STR
523
523
 
524
- expect(actual_output).to eq(expected_output)
524
+ expect(actual_output).to match_output(expected_output)
525
525
  end
526
526
  end
527
527
 
@@ -537,8 +537,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
537
537
 
538
538
  #{
539
539
  colored do
540
- alpha_line %(Expected: ["milk"])
541
- beta_line %( Actual: ["bread", "eggs", "milk"])
540
+ expected_line %(Expected: ["milk"])
541
+ actual_line %( Actual: ["bread", "eggs", "milk"])
542
542
  end
543
543
  }
544
544
 
@@ -546,16 +546,16 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
546
546
 
547
547
  #{
548
548
  colored do
549
- plain_line %( [)
550
- beta_line %(+ "bread",)
551
- beta_line %(+ "eggs",)
552
- plain_line %( "milk")
553
- plain_line %( ])
549
+ plain_line %( [)
550
+ actual_line %(+ "bread",)
551
+ actual_line %(+ "eggs",)
552
+ plain_line %( "milk")
553
+ plain_line %( ])
554
554
  end
555
555
  }
556
556
  STR
557
557
 
558
- expect(actual_output).to eq(expected_output)
558
+ expect(actual_output).to match_output(expected_output)
559
559
  end
560
560
  end
561
561
 
@@ -571,8 +571,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
571
571
 
572
572
  #{
573
573
  colored do
574
- alpha_line %(Expected: ["bread", "eggs", "milk"])
575
- beta_line %( Actual: ["milk"])
574
+ expected_line %(Expected: ["bread", "eggs", "milk"])
575
+ actual_line %( Actual: ["milk"])
576
576
  end
577
577
  }
578
578
 
@@ -580,16 +580,16 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
580
580
 
581
581
  #{
582
582
  colored do
583
- plain_line %( [)
584
- alpha_line %(- "bread",)
585
- alpha_line %(- "eggs",)
586
- plain_line %( "milk")
587
- plain_line %( ])
583
+ plain_line %( [)
584
+ expected_line %(- "bread",)
585
+ expected_line %(- "eggs",)
586
+ plain_line %( "milk")
587
+ plain_line %( ])
588
588
  end
589
589
  }
590
590
  STR
591
591
 
592
- expect(actual_output).to eq(expected_output)
592
+ expect(actual_output).to match_output(expected_output)
593
593
  end
594
594
  end
595
595
 
@@ -605,8 +605,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
605
605
 
606
606
  #{
607
607
  colored do
608
- alpha_line %(Expected: [1, 2, [:a, :b, :c], 4])
609
- beta_line %( Actual: [1, 2, [:a, :x, :c], 4])
608
+ expected_line %(Expected: [1, 2, [:a, :b, :c], 4])
609
+ actual_line %( Actual: [1, 2, [:a, :x, :c], 4])
610
610
  end
611
611
  }
612
612
 
@@ -614,22 +614,22 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
614
614
 
615
615
  #{
616
616
  colored do
617
- plain_line %( [)
618
- plain_line %( 1,)
619
- plain_line %( 2,)
620
- plain_line %( [)
621
- plain_line %( :a,)
622
- alpha_line %(- :b,)
623
- beta_line %(+ :x,)
624
- plain_line %( :c)
625
- plain_line %( ],)
626
- plain_line %( 4)
627
- plain_line %( ])
617
+ plain_line %( [)
618
+ plain_line %( 1,)
619
+ plain_line %( 2,)
620
+ plain_line %( [)
621
+ plain_line %( :a,)
622
+ expected_line %(- :b,)
623
+ actual_line %(+ :x,)
624
+ plain_line %( :c)
625
+ plain_line %( ],)
626
+ plain_line %( 4)
627
+ plain_line %( ])
628
628
  end
629
629
  }
630
630
  STR
631
631
 
632
- expect(actual_output).to eq(expected_output)
632
+ expect(actual_output).to match_output(expected_output)
633
633
  end
634
634
  end
635
635
 
@@ -645,8 +645,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
645
645
 
646
646
  #{
647
647
  colored do
648
- alpha_line %(Expected: [1, 2, { foo: "bar", baz: "qux" }, 4])
649
- beta_line %( Actual: [1, 2, { foo: "bar", baz: "qox" }, 4])
648
+ expected_line %(Expected: [1, 2, { foo: "bar", baz: "qux" }, 4])
649
+ actual_line %( Actual: [1, 2, { foo: "bar", baz: "qox" }, 4])
650
650
  end
651
651
  }
652
652
 
@@ -654,21 +654,21 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
654
654
 
655
655
  #{
656
656
  colored do
657
- plain_line %( [)
658
- plain_line %( 1,)
659
- plain_line %( 2,)
660
- plain_line %( {)
661
- plain_line %( foo: "bar",)
662
- alpha_line %(- baz: "qux")
663
- beta_line %(+ baz: "qox")
664
- plain_line %( },)
665
- plain_line %( 4)
666
- plain_line %( ])
657
+ plain_line %( [)
658
+ plain_line %( 1,)
659
+ plain_line %( 2,)
660
+ plain_line %( {)
661
+ plain_line %( foo: "bar",)
662
+ expected_line %(- baz: "qux")
663
+ actual_line %(+ baz: "qox")
664
+ plain_line %( },)
665
+ plain_line %( 4)
666
+ plain_line %( ])
667
667
  end
668
668
  }
669
669
  STR
670
670
 
671
- expect(actual_output).to eq(expected_output)
671
+ expect(actual_output).to match_output(expected_output)
672
672
  end
673
673
  end
674
674
 
@@ -689,8 +689,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
689
689
 
690
690
  #{
691
691
  colored do
692
- alpha_line %(Expected: [1, 2, #<SuperDiff::Test::Person name: "Marty", age: 18>, 4])
693
- beta_line %( Actual: [1, 2, #<SuperDiff::Test::Person name: "Doc", age: 50>, 4])
692
+ expected_line %(Expected: [1, 2, #<SuperDiff::Test::Person name: "Marty", age: 18>, 4])
693
+ actual_line %( Actual: [1, 2, #<SuperDiff::Test::Person name: "Doc", age: 50>, 4])
694
694
  end
695
695
  }
696
696
 
@@ -698,22 +698,22 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
698
698
 
699
699
  #{
700
700
  colored do
701
- plain_line %( [)
702
- plain_line %( 1,)
703
- plain_line %( 2,)
704
- plain_line %( #<SuperDiff::Test::Person {)
705
- alpha_line %(- name: "Marty",)
706
- beta_line %(+ name: "Doc",)
707
- alpha_line %(- age: 18)
708
- beta_line %(+ age: 50)
709
- plain_line %( }>,)
710
- plain_line %( 4)
711
- plain_line %( ])
701
+ plain_line %( [)
702
+ plain_line %( 1,)
703
+ plain_line %( 2,)
704
+ plain_line %( #<SuperDiff::Test::Person {)
705
+ expected_line %(- name: "Marty",)
706
+ actual_line %(+ name: "Doc",)
707
+ expected_line %(- age: 18)
708
+ actual_line %(+ age: 50)
709
+ plain_line %( }>,)
710
+ plain_line %( 4)
711
+ plain_line %( ])
712
712
  end
713
713
  }
714
714
  STR
715
715
 
716
- expect(actual_output).to eq(expected_output)
716
+ expect(actual_output).to match_output(expected_output)
717
717
  end
718
718
  end
719
719
 
@@ -749,8 +749,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
749
749
 
750
750
  #{
751
751
  colored do
752
- alpha_line %(Expected: [[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true } }]])
753
- beta_line %( Actual: [[:h2, [:span, [:text, "Goodbye world"]], { id: "hero", class: "header", data: { "sticky" => false, :role => "deprecated" } }], :br])
752
+ expected_line %(Expected: [[:h1, [:span, [:text, "Hello world"]], { class: "header", data: { "sticky" => true } }]])
753
+ actual_line %( Actual: [[:h2, [:span, [:text, "Goodbye world"]], { id: "hero", class: "header", data: { "sticky" => false, :role => "deprecated" } }], :br])
754
754
  end
755
755
  }
756
756
 
@@ -758,35 +758,35 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
758
758
 
759
759
  #{
760
760
  colored do
761
- plain_line %( [)
762
- plain_line %( [)
763
- alpha_line %(- :h1,)
764
- beta_line %(+ :h2,)
765
- plain_line %( [)
766
- plain_line %( :span,)
767
- plain_line %( [)
768
- plain_line %( :text,)
769
- alpha_line %(- "Hello world")
770
- beta_line %(+ "Goodbye world")
771
- plain_line %( ])
772
- plain_line %( ],)
773
- plain_line %( {)
774
- beta_line %(+ id: "hero",)
775
- plain_line %( class: "header",)
776
- plain_line %( data: {)
777
- alpha_line %(- "sticky" => true)
778
- beta_line %(+ "sticky" => false,)
779
- beta_line %(+ role: "deprecated")
780
- plain_line %( })
781
- plain_line %( })
782
- plain_line %( ],)
783
- beta_line %(+ :br)
784
- plain_line %( ])
761
+ plain_line %( [)
762
+ plain_line %( [)
763
+ expected_line %(- :h1,)
764
+ actual_line %(+ :h2,)
765
+ plain_line %( [)
766
+ plain_line %( :span,)
767
+ plain_line %( [)
768
+ plain_line %( :text,)
769
+ expected_line %(- "Hello world")
770
+ actual_line %(+ "Goodbye world")
771
+ plain_line %( ])
772
+ plain_line %( ],)
773
+ plain_line %( {)
774
+ actual_line %(+ id: "hero",)
775
+ plain_line %( class: "header",)
776
+ plain_line %( data: {)
777
+ expected_line %(- "sticky" => true)
778
+ actual_line %(+ "sticky" => false,)
779
+ actual_line %(+ :role => "deprecated")
780
+ plain_line %( })
781
+ plain_line %( })
782
+ plain_line %( ],)
783
+ actual_line %(+ :br)
784
+ plain_line %( ])
785
785
  end
786
786
  }
787
787
  STR
788
788
 
789
- expect(actual_output).to eq(expected_output)
789
+ expect(actual_output).to match_output(expected_output)
790
790
  end
791
791
  end
792
792
 
@@ -813,8 +813,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
813
813
 
814
814
  #{
815
815
  colored do
816
- alpha_line %(Expected: { tall: 12, grande: 19, venti: 20 })
817
- beta_line %( Actual: { tall: 12, grande: 16, venti: 20 })
816
+ expected_line %(Expected: { tall: 12, grande: 19, venti: 20 })
817
+ actual_line %( Actual: { tall: 12, grande: 16, venti: 20 })
818
818
  end
819
819
  }
820
820
 
@@ -822,17 +822,17 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
822
822
 
823
823
  #{
824
824
  colored do
825
- plain_line %( {)
826
- plain_line %( tall: 12,)
827
- alpha_line %(- grande: 19,)
828
- beta_line %(+ grande: 16,)
829
- plain_line %( venti: 20)
830
- plain_line %( })
825
+ plain_line %( {)
826
+ plain_line %( tall: 12,)
827
+ expected_line %(- grande: 19,)
828
+ actual_line %(+ grande: 16,)
829
+ plain_line %( venti: 20)
830
+ plain_line %( })
831
831
  end
832
832
  }
833
833
  STR
834
834
 
835
- expect(actual_output).to eq(expected_output)
835
+ expect(actual_output).to match_output(expected_output)
836
836
  end
837
837
  end
838
838
 
@@ -848,8 +848,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
848
848
 
849
849
  #{
850
850
  colored do
851
- alpha_line %(Expected: { "tall" => 12, "grande" => 19, "venti" => 20 })
852
- beta_line %( Actual: { "tall" => 12, "grande" => 16, "venti" => 20 })
851
+ expected_line %(Expected: { "tall" => 12, "grande" => 19, "venti" => 20 })
852
+ actual_line %( Actual: { "tall" => 12, "grande" => 16, "venti" => 20 })
853
853
  end
854
854
  }
855
855
 
@@ -857,17 +857,17 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
857
857
 
858
858
  #{
859
859
  colored do
860
- plain_line %( {)
861
- plain_line %( "tall" => 12,)
862
- alpha_line %(- "grande" => 19,)
863
- beta_line %(+ "grande" => 16,)
864
- plain_line %( "venti" => 20)
865
- plain_line %( })
860
+ plain_line %( {)
861
+ plain_line %( "tall" => 12,)
862
+ expected_line %(- "grande" => 19,)
863
+ actual_line %(+ "grande" => 16,)
864
+ plain_line %( "venti" => 20)
865
+ plain_line %( })
866
866
  end
867
867
  }
868
868
  STR
869
869
 
870
- expect(actual_output).to eq(expected_output)
870
+ expect(actual_output).to match_output(expected_output)
871
871
  end
872
872
  end
873
873
 
@@ -883,8 +883,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
883
883
 
884
884
  #{
885
885
  colored do
886
- alpha_line %(Expected: { tall: :small, grande: :grand, venti: :large })
887
- beta_line %( Actual: { tall: :small, grande: :medium, venti: :large })
886
+ expected_line %(Expected: { tall: :small, grande: :grand, venti: :large })
887
+ actual_line %( Actual: { tall: :small, grande: :medium, venti: :large })
888
888
  end
889
889
  }
890
890
 
@@ -892,17 +892,17 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
892
892
 
893
893
  #{
894
894
  colored do
895
- plain_line %( {)
896
- plain_line %( tall: :small,)
897
- alpha_line %(- grande: :grand,)
898
- beta_line %(+ grande: :medium,)
899
- plain_line %( venti: :large)
900
- plain_line %( })
895
+ plain_line %( {)
896
+ plain_line %( tall: :small,)
897
+ expected_line %(- grande: :grand,)
898
+ actual_line %(+ grande: :medium,)
899
+ plain_line %( venti: :large)
900
+ plain_line %( })
901
901
  end
902
902
  }
903
903
  STR
904
904
 
905
- expect(actual_output).to eq(expected_output)
905
+ expect(actual_output).to match_output(expected_output)
906
906
  end
907
907
  end
908
908
 
@@ -918,8 +918,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
918
918
 
919
919
  #{
920
920
  colored do
921
- alpha_line %(Expected: { tall: "small", grande: "grand", venti: "large" })
922
- beta_line %( Actual: { tall: "small", grande: "medium", venti: "large" })
921
+ expected_line %(Expected: { tall: "small", grande: "grand", venti: "large" })
922
+ actual_line %( Actual: { tall: "small", grande: "medium", venti: "large" })
923
923
  end
924
924
  }
925
925
 
@@ -927,17 +927,17 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
927
927
 
928
928
  #{
929
929
  colored do
930
- plain_line %( {)
931
- plain_line %( tall: "small",)
932
- alpha_line %(- grande: "grand",)
933
- beta_line %(+ grande: "medium",)
934
- plain_line %( venti: "large")
935
- plain_line %( })
930
+ plain_line %( {)
931
+ plain_line %( tall: "small",)
932
+ expected_line %(- grande: "grand",)
933
+ actual_line %(+ grande: "medium",)
934
+ plain_line %( venti: "large")
935
+ plain_line %( })
936
936
  end
937
937
  }
938
938
  STR
939
939
 
940
- expect(actual_output).to eq(expected_output)
940
+ expect(actual_output).to match_output(expected_output)
941
941
  end
942
942
  end
943
943
 
@@ -959,8 +959,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
959
959
 
960
960
  #{
961
961
  colored do
962
- alpha_line %(Expected: { steve: #<SuperDiff::Test::Person name: "Jobs", age: 30>, susan: #<SuperDiff::Test::Person name: "Kare", age: 27> })
963
- beta_line %( Actual: { steve: #<SuperDiff::Test::Person name: "Wozniak", age: 33>, susan: #<SuperDiff::Test::Person name: "Kare", age: 27> })
962
+ expected_line %(Expected: { steve: #<SuperDiff::Test::Person name: "Jobs", age: 30>, susan: #<SuperDiff::Test::Person name: "Kare", age: 27> })
963
+ actual_line %( Actual: { steve: #<SuperDiff::Test::Person name: "Wozniak", age: 33>, susan: #<SuperDiff::Test::Person name: "Kare", age: 27> })
964
964
  end
965
965
  }
966
966
 
@@ -968,23 +968,23 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
968
968
 
969
969
  #{
970
970
  colored do
971
- plain_line %( {)
972
- plain_line %( steve: #<SuperDiff::Test::Person {)
973
- alpha_line %(- name: "Jobs",)
974
- beta_line %(+ name: "Wozniak",)
975
- alpha_line %(- age: 30)
976
- beta_line %(+ age: 33)
977
- plain_line %( }>,)
978
- plain_line %( susan: #<SuperDiff::Test::Person {)
979
- plain_line %( name: "Kare",)
980
- plain_line %( age: 27)
981
- plain_line %( }>)
982
- plain_line %( })
971
+ plain_line %( {)
972
+ plain_line %( steve: #<SuperDiff::Test::Person {)
973
+ expected_line %(- name: "Jobs",)
974
+ actual_line %(+ name: "Wozniak",)
975
+ expected_line %(- age: 30)
976
+ actual_line %(+ age: 33)
977
+ plain_line %( }>,)
978
+ plain_line %( susan: #<SuperDiff::Test::Person {)
979
+ plain_line %( name: "Kare",)
980
+ plain_line %( age: 27)
981
+ plain_line %( }>)
982
+ plain_line %( })
983
983
  end
984
984
  }
985
985
  STR
986
986
 
987
- expect(actual_output).to eq(expected_output)
987
+ expect(actual_output).to match_output(expected_output)
988
988
  end
989
989
  end
990
990
 
@@ -1000,8 +1000,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1000
1000
 
1001
1001
  #{
1002
1002
  colored do
1003
- alpha_line %(Expected: { latte: 4.5 })
1004
- beta_line %( Actual: { latte: 4.5, mocha: 3.5, cortado: 3 })
1003
+ expected_line %(Expected: { latte: 4.5 })
1004
+ actual_line %( Actual: { latte: 4.5, mocha: 3.5, cortado: 3 })
1005
1005
  end
1006
1006
  }
1007
1007
 
@@ -1009,16 +1009,16 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1009
1009
 
1010
1010
  #{
1011
1011
  colored do
1012
- plain_line %( {)
1013
- plain_line %( latte: 4.5,)
1014
- beta_line %(+ mocha: 3.5,)
1015
- beta_line %(+ cortado: 3)
1016
- plain_line %( })
1012
+ plain_line %( {)
1013
+ plain_line %( latte: 4.5,)
1014
+ actual_line %(+ mocha: 3.5,)
1015
+ actual_line %(+ cortado: 3)
1016
+ plain_line %( })
1017
1017
  end
1018
1018
  }
1019
1019
  STR
1020
1020
 
1021
- expect(actual_output).to eq(expected_output)
1021
+ expect(actual_output).to match_output(expected_output)
1022
1022
  end
1023
1023
  end
1024
1024
 
@@ -1034,8 +1034,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1034
1034
 
1035
1035
  #{
1036
1036
  colored do
1037
- alpha_line %(Expected: { latte: 4.5, mocha: 3.5, cortado: 3 })
1038
- beta_line %( Actual: { latte: 4.5 })
1037
+ expected_line %(Expected: { latte: 4.5, mocha: 3.5, cortado: 3 })
1038
+ actual_line %( Actual: { latte: 4.5 })
1039
1039
  end
1040
1040
  }
1041
1041
 
@@ -1043,16 +1043,16 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1043
1043
 
1044
1044
  #{
1045
1045
  colored do
1046
- plain_line %( {)
1047
- plain_line %( latte: 4.5)
1048
- alpha_line %(- mocha: 3.5,)
1049
- alpha_line %(- cortado: 3)
1050
- plain_line %( })
1046
+ plain_line %( {)
1047
+ plain_line %( latte: 4.5)
1048
+ expected_line %(- mocha: 3.5,)
1049
+ expected_line %(- cortado: 3)
1050
+ plain_line %( })
1051
1051
  end
1052
1052
  }
1053
1053
  STR
1054
1054
 
1055
- expect(actual_output).to eq(expected_output)
1055
+ expect(actual_output).to match_output(expected_output)
1056
1056
  end
1057
1057
  end
1058
1058
 
@@ -1099,8 +1099,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1099
1099
 
1100
1100
  #{
1101
1101
  colored do
1102
- alpha_line %(Expected: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" })
1103
- beta_line %( Actual: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_tile: false, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" })
1102
+ expected_line %(Expected: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" })
1103
+ actual_line %( Actual: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_tile: false, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" })
1104
1104
  end
1105
1105
  }
1106
1106
 
@@ -1108,31 +1108,31 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1108
1108
 
1109
1109
  #{
1110
1110
  colored do
1111
- plain_line %( {)
1112
- plain_line %( listed_count: 37009,)
1113
- plain_line %( created_at: "Tue Jan 13 19:28:24 +0000 2009",)
1114
- plain_line %( favourites_count: 38,)
1115
- alpha_line %(- geo_enabled: false,)
1116
- alpha_line %(- verified: true,)
1117
- beta_line %(+ utc_offset: nil,)
1118
- beta_line %(+ time_zone: nil,)
1119
- plain_line %( statuses_count: 273860,)
1120
- plain_line %( media_count: 51044,)
1121
- plain_line %( contributors_enabled: false,)
1122
- beta_line %(+ is_translator: false,)
1123
- beta_line %(+ is_translation_enabled: false,)
1124
- plain_line %( profile_background_color: "FFF1E0",)
1125
- plain_line %( profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",)
1126
- plain_line %( profile_background_tile: false,)
1127
- alpha_line %(- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",)
1128
- alpha_line %(- profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",)
1129
- plain_line %( profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592")
1130
- plain_line %( })
1111
+ plain_line %( {)
1112
+ plain_line %( listed_count: 37009,)
1113
+ plain_line %( created_at: "Tue Jan 13 19:28:24 +0000 2009",)
1114
+ plain_line %( favourites_count: 38,)
1115
+ expected_line %(- geo_enabled: false,)
1116
+ expected_line %(- verified: true,)
1117
+ actual_line %(+ utc_offset: nil,)
1118
+ actual_line %(+ time_zone: nil,)
1119
+ plain_line %( statuses_count: 273860,)
1120
+ plain_line %( media_count: 51044,)
1121
+ plain_line %( contributors_enabled: false,)
1122
+ actual_line %(+ is_translator: false,)
1123
+ actual_line %(+ is_translation_enabled: false,)
1124
+ plain_line %( profile_background_color: "FFF1E0",)
1125
+ plain_line %( profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",)
1126
+ plain_line %( profile_background_tile: false,)
1127
+ expected_line %(- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",)
1128
+ expected_line %(- profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",)
1129
+ plain_line %( profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592")
1130
+ plain_line %( })
1131
1131
  end
1132
1132
  }
1133
1133
  STR
1134
1134
 
1135
- expect(actual_output).to eq(expected_output)
1135
+ expect(actual_output).to match_output(expected_output)
1136
1136
  end
1137
1137
  end
1138
1138
 
@@ -1166,8 +1166,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1166
1166
  is_translation_enabled: false,
1167
1167
  profile_background_color: "FFF1E0",
1168
1168
  profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
1169
- profile_background_tile: false,
1170
1169
  profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",
1170
+ profile_background_tile: false,
1171
1171
  }
1172
1172
  )
1173
1173
 
@@ -1176,8 +1176,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1176
1176
 
1177
1177
  #{
1178
1178
  colored do
1179
- alpha_line %(Expected: { created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, geo_enabled: false, verified: true, media_count: 51044, statuses_count: 273860, contributors_enabled: false, profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_color: "FFF1E0", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", listed_count: 37009, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" })
1180
- beta_line %( Actual: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_tile: false, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" })
1179
+ expected_line %(Expected: { created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, geo_enabled: false, verified: true, media_count: 51044, statuses_count: 273860, contributors_enabled: false, profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_background_color: "FFF1E0", profile_background_tile: false, profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg", listed_count: 37009, profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592" })
1180
+ actual_line %( Actual: { listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png", profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592", profile_background_tile: false })
1181
1181
  end
1182
1182
  }
1183
1183
 
@@ -1185,29 +1185,29 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1185
1185
 
1186
1186
  #{
1187
1187
  colored do
1188
- plain_line %( {)
1189
- plain_line %( listed_count: 37009,)
1190
- plain_line %( created_at: "Tue Jan 13 19:28:24 +0000 2009",)
1191
- plain_line %( favourites_count: 38,)
1192
- alpha_line %(- geo_enabled: false,)
1193
- alpha_line %(- verified: true,)
1194
- beta_line %(+ utc_offset: nil,)
1195
- plain_line %( statuses_count: 273860,)
1196
- plain_line %( media_count: 51044,)
1197
- plain_line %( contributors_enabled: false,)
1198
- beta_line %(+ is_translator: false,)
1199
- beta_line %(+ is_translation_enabled: false,)
1200
- plain_line %( profile_background_color: "FFF1E0",)
1201
- plain_line %( profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",)
1202
- plain_line %( profile_background_tile: false,)
1203
- alpha_line %(- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",)
1204
- plain_line %( profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592")
1205
- plain_line %( })
1188
+ plain_line %( {)
1189
+ plain_line %( listed_count: 37009,)
1190
+ plain_line %( created_at: "Tue Jan 13 19:28:24 +0000 2009",)
1191
+ plain_line %( favourites_count: 38,)
1192
+ expected_line %(- geo_enabled: false,)
1193
+ expected_line %(- verified: true,)
1194
+ actual_line %(+ utc_offset: nil,)
1195
+ plain_line %( statuses_count: 273860,)
1196
+ plain_line %( media_count: 51044,)
1197
+ plain_line %( contributors_enabled: false,)
1198
+ actual_line %(+ is_translator: false,)
1199
+ actual_line %(+ is_translation_enabled: false,)
1200
+ plain_line %( profile_background_color: "FFF1E0",)
1201
+ plain_line %( profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",)
1202
+ expected_line %(- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",)
1203
+ plain_line %( profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",)
1204
+ plain_line %( profile_background_tile: false)
1205
+ plain_line %( })
1206
1206
  end
1207
1207
  }
1208
1208
  STR
1209
1209
 
1210
- expect(actual_output).to eq(expected_output)
1210
+ expect(actual_output).to match_output(expected_output)
1211
1211
  end
1212
1212
  end
1213
1213
  end
@@ -1232,8 +1232,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1232
1232
 
1233
1233
  #{
1234
1234
  colored do
1235
- alpha_line %(Expected: { name: "Elliot", interests: ["music", "football", "programming"], age: 30 })
1236
- beta_line %( Actual: { name: "Elliot", interests: ["music", "travel", "programming"], age: 30 })
1235
+ expected_line %(Expected: { name: "Elliot", interests: ["music", "football", "programming"], age: 30 })
1236
+ actual_line %( Actual: { name: "Elliot", interests: ["music", "travel", "programming"], age: 30 })
1237
1237
  end
1238
1238
  }
1239
1239
 
@@ -1241,21 +1241,21 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1241
1241
 
1242
1242
  #{
1243
1243
  colored do
1244
- plain_line %( {)
1245
- plain_line %( name: "Elliot",)
1246
- plain_line %( interests: [)
1247
- plain_line %( "music",)
1248
- alpha_line %(- "football",)
1249
- beta_line %(+ "travel",)
1250
- plain_line %( "programming")
1251
- plain_line %( ],)
1252
- plain_line %( age: 30)
1253
- plain_line %( })
1244
+ plain_line %( {)
1245
+ plain_line %( name: "Elliot",)
1246
+ plain_line %( interests: [)
1247
+ plain_line %( "music",)
1248
+ expected_line %(- "football",)
1249
+ actual_line %(+ "travel",)
1250
+ plain_line %( "programming")
1251
+ plain_line %( ],)
1252
+ plain_line %( age: 30)
1253
+ plain_line %( })
1254
1254
  end
1255
1255
  }
1256
1256
  STR
1257
1257
 
1258
- expect(actual_output).to eq(expected_output)
1258
+ expect(actual_output).to match_output(expected_output)
1259
1259
  end
1260
1260
  end
1261
1261
 
@@ -1287,8 +1287,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1287
1287
 
1288
1288
  #{
1289
1289
  colored do
1290
- alpha_line %(Expected: { check_spelling: true, substitutions: { "YOLO" => "You only live once", "BRB" => "Buns, ribs, and bacon", "YMMV" => "Your mileage may vary" }, check_grammar: false })
1291
- beta_line %( Actual: { check_spelling: true, substitutions: { "YOLO" => "You only live once", "BRB" => "Be right back", "YMMV" => "Your mileage may vary" }, check_grammar: false })
1290
+ expected_line %(Expected: { check_spelling: true, substitutions: { "YOLO" => "You only live once", "BRB" => "Buns, ribs, and bacon", "YMMV" => "Your mileage may vary" }, check_grammar: false })
1291
+ actual_line %( Actual: { check_spelling: true, substitutions: { "YOLO" => "You only live once", "BRB" => "Be right back", "YMMV" => "Your mileage may vary" }, check_grammar: false })
1292
1292
  end
1293
1293
  }
1294
1294
 
@@ -1296,21 +1296,21 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1296
1296
 
1297
1297
  #{
1298
1298
  colored do
1299
- plain_line %( {)
1300
- plain_line %( check_spelling: true,)
1301
- plain_line %( substitutions: {)
1302
- plain_line %( "YOLO" => "You only live once",)
1303
- alpha_line %(- "BRB" => "Buns, ribs, and bacon",)
1304
- beta_line %(+ "BRB" => "Be right back",)
1305
- plain_line %( "YMMV" => "Your mileage may vary")
1306
- plain_line %( },)
1307
- plain_line %( check_grammar: false)
1308
- plain_line %( })
1299
+ plain_line %( {)
1300
+ plain_line %( check_spelling: true,)
1301
+ plain_line %( substitutions: {)
1302
+ plain_line %( "YOLO" => "You only live once",)
1303
+ expected_line %(- "BRB" => "Buns, ribs, and bacon",)
1304
+ actual_line %(+ "BRB" => "Be right back",)
1305
+ plain_line %( "YMMV" => "Your mileage may vary")
1306
+ plain_line %( },)
1307
+ plain_line %( check_grammar: false)
1308
+ plain_line %( })
1309
1309
  end
1310
1310
  }
1311
1311
  STR
1312
1312
 
1313
- expect(actual_output).to eq(expected_output)
1313
+ expect(actual_output).to match_output(expected_output)
1314
1314
  end
1315
1315
  end
1316
1316
 
@@ -1334,8 +1334,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1334
1334
 
1335
1335
  #{
1336
1336
  colored do
1337
- alpha_line %(Expected: { order_id: 1234, person: #<SuperDiff::Test::Person name: "Marty", age: 18>, amount: 35000 })
1338
- beta_line %( Actual: { order_id: 1234, person: #<SuperDiff::Test::Person name: "Doc", age: 50>, amount: 35000 })
1337
+ expected_line %(Expected: { order_id: 1234, person: #<SuperDiff::Test::Person name: "Marty", age: 18>, amount: 35000 })
1338
+ actual_line %( Actual: { order_id: 1234, person: #<SuperDiff::Test::Person name: "Doc", age: 50>, amount: 35000 })
1339
1339
  end
1340
1340
  }
1341
1341
 
@@ -1343,21 +1343,21 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1343
1343
 
1344
1344
  #{
1345
1345
  colored do
1346
- plain_line %( {)
1347
- plain_line %( order_id: 1234,)
1348
- plain_line %( person: #<SuperDiff::Test::Person {)
1349
- alpha_line %(- name: "Marty",)
1350
- beta_line %(+ name: "Doc",)
1351
- alpha_line %(- age: 18)
1352
- beta_line %(+ age: 50)
1353
- plain_line %( }>,)
1354
- plain_line %( amount: 35000)
1355
- plain_line %( })
1346
+ plain_line %( {)
1347
+ plain_line %( order_id: 1234,)
1348
+ plain_line %( person: #<SuperDiff::Test::Person {)
1349
+ expected_line %(- name: "Marty",)
1350
+ actual_line %(+ name: "Doc",)
1351
+ expected_line %(- age: 18)
1352
+ actual_line %(+ age: 50)
1353
+ plain_line %( }>,)
1354
+ plain_line %( amount: 35000)
1355
+ plain_line %( })
1356
1356
  end
1357
1357
  }
1358
1358
  STR
1359
1359
 
1360
- expect(actual_output).to eq(expected_output)
1360
+ expect(actual_output).to match_output(expected_output)
1361
1361
  end
1362
1362
  end
1363
1363
 
@@ -1409,8 +1409,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1409
1409
 
1410
1410
  #{
1411
1411
  colored do
1412
- alpha_line %(Expected: { customer: { name: "Marty McFly", shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] })
1413
- beta_line %( Actual: { customer: { name: "Marty McFly, Jr.", shipping_address: { line_1: "456 Ponderosa Ct.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Mattel Hoverboard" }] })
1412
+ expected_line %(Expected: { customer: { name: "Marty McFly", shipping_address: { line_1: "123 Main St.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Chevy 4x4" }] })
1413
+ actual_line %( Actual: { customer: { name: "Marty McFly, Jr.", shipping_address: { line_1: "456 Ponderosa Ct.", city: "Hill Valley", state: "CA", zip: "90382" } }, items: [{ name: "Fender Stratocaster", cost: 100000, options: ["red", "blue", "green"] }, { name: "Mattel Hoverboard" }] })
1414
1414
  end
1415
1415
  }
1416
1416
 
@@ -1418,39 +1418,39 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1418
1418
 
1419
1419
  #{
1420
1420
  colored do
1421
- plain_line %( {)
1422
- plain_line %( customer: {)
1423
- alpha_line %(- name: "Marty McFly",)
1424
- beta_line %(+ name: "Marty McFly, Jr.",)
1425
- plain_line %( shipping_address: {)
1426
- alpha_line %(- line_1: "123 Main St.",)
1427
- beta_line %(+ line_1: "456 Ponderosa Ct.",)
1428
- plain_line %( city: "Hill Valley",)
1429
- plain_line %( state: "CA",)
1430
- plain_line %( zip: "90382")
1431
- plain_line %( })
1432
- plain_line %( },)
1433
- plain_line %( items: [)
1434
- plain_line %( {)
1435
- plain_line %( name: "Fender Stratocaster",)
1436
- plain_line %( cost: 100000,)
1437
- plain_line %( options: [)
1438
- plain_line %( "red",)
1439
- plain_line %( "blue",)
1440
- plain_line %( "green")
1441
- plain_line %( ])
1442
- plain_line %( },)
1443
- plain_line %( {)
1444
- alpha_line %(- name: "Chevy 4x4")
1445
- beta_line %(+ name: "Mattel Hoverboard")
1446
- plain_line %( })
1447
- plain_line %( ])
1448
- plain_line %( })
1421
+ plain_line %( {)
1422
+ plain_line %( customer: {)
1423
+ expected_line %(- name: "Marty McFly",)
1424
+ actual_line %(+ name: "Marty McFly, Jr.",)
1425
+ plain_line %( shipping_address: {)
1426
+ expected_line %(- line_1: "123 Main St.",)
1427
+ actual_line %(+ line_1: "456 Ponderosa Ct.",)
1428
+ plain_line %( city: "Hill Valley",)
1429
+ plain_line %( state: "CA",)
1430
+ plain_line %( zip: "90382")
1431
+ plain_line %( })
1432
+ plain_line %( },)
1433
+ plain_line %( items: [)
1434
+ plain_line %( {)
1435
+ plain_line %( name: "Fender Stratocaster",)
1436
+ plain_line %( cost: 100000,)
1437
+ plain_line %( options: [)
1438
+ plain_line %( "red",)
1439
+ plain_line %( "blue",)
1440
+ plain_line %( "green")
1441
+ plain_line %( ])
1442
+ plain_line %( },)
1443
+ plain_line %( {)
1444
+ expected_line %(- name: "Chevy 4x4")
1445
+ actual_line %(+ name: "Mattel Hoverboard")
1446
+ plain_line %( })
1447
+ plain_line %( ])
1448
+ plain_line %( })
1449
1449
  end
1450
1450
  }
1451
1451
  STR
1452
1452
 
1453
- expect(actual_output).to eq(expected_output)
1453
+ expect(actual_output).to match_output(expected_output)
1454
1454
  end
1455
1455
  end
1456
1456
 
@@ -1480,8 +1480,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1480
1480
 
1481
1481
  #{
1482
1482
  colored do
1483
- alpha_line %(Expected: #<SuperDiff::Test::Person name: "Marty", age: 18>)
1484
- beta_line %( Actual: #<SuperDiff::Test::Person name: "Doc", age: 50>)
1483
+ expected_line %(Expected: #<SuperDiff::Test::Person name: "Marty", age: 18>)
1484
+ actual_line %( Actual: #<SuperDiff::Test::Person name: "Doc", age: 50>)
1485
1485
  end
1486
1486
  }
1487
1487
 
@@ -1489,17 +1489,17 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1489
1489
 
1490
1490
  #{
1491
1491
  colored do
1492
- plain_line %( #<SuperDiff::Test::Person {)
1493
- alpha_line %(- name: "Marty",)
1494
- beta_line %(+ name: "Doc",)
1495
- alpha_line %(- age: 18)
1496
- beta_line %(+ age: 50)
1497
- plain_line %( }>)
1492
+ plain_line %( #<SuperDiff::Test::Person {)
1493
+ expected_line %(- name: "Marty",)
1494
+ actual_line %(+ name: "Doc",)
1495
+ expected_line %(- age: 18)
1496
+ actual_line %(+ age: 50)
1497
+ plain_line %( }>)
1498
1498
  end
1499
1499
  }
1500
1500
  STR
1501
1501
 
1502
- expect(actual_output).to eq(expected_output)
1502
+ expect(actual_output).to match_output(expected_output)
1503
1503
  end
1504
1504
  end
1505
1505
 
@@ -1528,17 +1528,9 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1528
1528
  Differing objects.
1529
1529
 
1530
1530
  #{
1531
- if SuperDiff::Test.jruby?
1532
- # Source: <https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyBasicObject.java>
1533
- colored do
1534
- alpha_line %(Expected: #<SuperDiff::Test::Player:#{SuperDiff::Test.object_id_hex(expected)} @inventory=["flatline", "purple body shield"], @character="mirage", @handle="martymcfly", @ultimate=0.8, @shields=0.6, @health=0.3>)
1535
- beta_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Test.object_id_hex(actual)} @inventory=["wingman", "mastiff"], @character="lifeline", @handle="docbrown", @ultimate=0.8, @shields=0.6, @health=0.3>)
1536
- end
1537
- else
1538
- colored do
1539
- alpha_line %(Expected: #<SuperDiff::Test::Player:#{SuperDiff::Test.object_id_hex(expected)} @handle="martymcfly", @character="mirage", @inventory=["flatline", "purple body shield"], @shields=0.6, @health=0.3, @ultimate=0.8>)
1540
- beta_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Test.object_id_hex(actual)} @handle="docbrown", @character="lifeline", @inventory=["wingman", "mastiff"], @shields=0.6, @health=0.3, @ultimate=0.8>)
1541
- end
1531
+ colored do
1532
+ 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>)
1533
+ 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>)
1542
1534
  end
1543
1535
  }
1544
1536
 
@@ -1546,26 +1538,26 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1546
1538
 
1547
1539
  #{
1548
1540
  colored do
1549
- plain_line %( #<SuperDiff::Test::Player {)
1550
- alpha_line %(- @character="mirage",)
1551
- beta_line %(+ @character="lifeline",)
1552
- alpha_line %(- @handle="martymcfly",)
1553
- beta_line %(+ @handle="docbrown",)
1554
- plain_line %( @health=0.3,)
1555
- plain_line %( @inventory=[)
1556
- alpha_line %(- "flatline",)
1557
- beta_line %(+ "wingman",)
1558
- alpha_line %(- "purple body shield")
1559
- beta_line %(+ "mastiff")
1560
- plain_line %( ],)
1561
- plain_line %( @shields=0.6,)
1562
- plain_line %( @ultimate=0.8)
1563
- plain_line %( }>)
1541
+ plain_line %( #<SuperDiff::Test::Player:#{SuperDiff::Helpers.object_address_for(actual)} {)
1542
+ expected_line %(- @character="mirage",)
1543
+ actual_line %(+ @character="lifeline",)
1544
+ expected_line %(- @handle="martymcfly",)
1545
+ actual_line %(+ @handle="docbrown",)
1546
+ plain_line %( @health=0.3,)
1547
+ plain_line %( @inventory=[)
1548
+ expected_line %(- "flatline",)
1549
+ actual_line %(+ "wingman",)
1550
+ expected_line %(- "purple body shield")
1551
+ actual_line %(+ "mastiff")
1552
+ plain_line %( ],)
1553
+ plain_line %( @shields=0.6,)
1554
+ plain_line %( @ultimate=0.8)
1555
+ plain_line %( }>)
1564
1556
  end
1565
1557
  }
1566
1558
  STR
1567
1559
 
1568
- expect(actual_output).to eq(expected_output)
1560
+ expect(actual_output).to match_output(expected_output)
1569
1561
  end
1570
1562
  end
1571
1563
 
@@ -1588,13 +1580,13 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1588
1580
 
1589
1581
  #{
1590
1582
  colored do
1591
- alpha_line %(Expected: #<SuperDiff::Test::Person name: "Marty", age: 31>)
1592
- beta_line %( Actual: #<SuperDiff::Test::Customer name: "Doc", shipping_address: :some_shipping_address, phone: "1234567890">)
1583
+ expected_line %(Expected: #<SuperDiff::Test::Person name: "Marty", age: 31>)
1584
+ actual_line %( Actual: #<SuperDiff::Test::Customer name: "Doc", shipping_address: :some_shipping_address, phone: "1234567890">)
1593
1585
  end
1594
1586
  }
1595
1587
  STR
1596
1588
 
1597
- expect(actual_output).to eq(expected_output)
1589
+ expect(actual_output).to match_output(expected_output)
1598
1590
  end
1599
1591
  end
1600
1592
 
@@ -1619,22 +1611,14 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1619
1611
  Differing objects.
1620
1612
 
1621
1613
  #{
1622
- if SuperDiff::Test.jruby?
1623
- # Source: <https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyBasicObject.java>
1624
- colored do
1625
- alpha_line %(Expected: #<SuperDiff::Test::Item:#{SuperDiff::Test.object_id_hex(expected)} @name="camera", @quantity=3>)
1626
- beta_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Test.object_id_hex(actual)} @inventory=["sword"], @character="Jon", @handle="mcmire", @ultimate=true, @shields=11.4, @health=4>)
1627
- end
1628
- else
1629
- colored do
1630
- alpha_line %(Expected: #<SuperDiff::Test::Item:#{SuperDiff::Test.object_id_hex(expected)} @name="camera", @quantity=3>)
1631
- beta_line %( Actual: #<SuperDiff::Test::Player:#{SuperDiff::Test.object_id_hex(actual)} @handle="mcmire", @character="Jon", @inventory=["sword"], @shields=11.4, @health=4, @ultimate=true>)
1632
- end
1614
+ colored do
1615
+ expected_line %(Expected: #<SuperDiff::Test::Item:#{SuperDiff::Helpers.object_address_for(expected)} @name="camera", @quantity=3>)
1616
+ 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>)
1633
1617
  end
1634
1618
  }
1635
1619
  STR
1636
1620
 
1637
- expect(actual_output).to eq(expected_output)
1621
+ expect(actual_output).to match_output(expected_output)
1638
1622
  end
1639
1623
  end
1640
1624
 
@@ -1651,8 +1635,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1651
1635
 
1652
1636
  #{
1653
1637
  colored do
1654
- alpha_line %(Expected: ["a", ∙∙∙, "b", "c"])
1655
- beta_line %( Actual: ["a", "x", "b", "c"])
1638
+ expected_line %(Expected: ["a", ∙∙∙, "b", "c"])
1639
+ actual_line %( Actual: ["a", "x", "b", "c"])
1656
1640
  end
1657
1641
  }
1658
1642
 
@@ -1660,18 +1644,18 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1660
1644
 
1661
1645
  #{
1662
1646
  colored do
1663
- plain_line %( [)
1664
- plain_line %( "a",)
1665
- alpha_line %(- ∙∙∙,)
1666
- beta_line %(+ "x",)
1667
- plain_line %( "b",)
1668
- plain_line %( "c")
1669
- plain_line %( ])
1647
+ plain_line %( [)
1648
+ plain_line %( "a",)
1649
+ expected_line %(- ∙∙∙,)
1650
+ actual_line %(+ "x",)
1651
+ plain_line %( "b",)
1652
+ plain_line %( "c")
1653
+ plain_line %( ])
1670
1654
  end
1671
1655
  }
1672
1656
  STR
1673
1657
 
1674
- expect(actual_output).to eq(expected_output)
1658
+ expect(actual_output).to match_output(expected_output)
1675
1659
  end
1676
1660
  end
1677
1661
 
@@ -1688,8 +1672,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1688
1672
 
1689
1673
  #{
1690
1674
  colored do
1691
- alpha_line %(Expected: ["a", "x", "b", "c"])
1692
- beta_line %( Actual: ["a", ∙∙∙, "b", "c"])
1675
+ expected_line %(Expected: ["a", "x", "b", "c"])
1676
+ actual_line %( Actual: ["a", ∙∙∙, "b", "c"])
1693
1677
  end
1694
1678
  }
1695
1679
 
@@ -1697,18 +1681,18 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1697
1681
 
1698
1682
  #{
1699
1683
  colored do
1700
- plain_line %( [)
1701
- plain_line %( "a",)
1702
- alpha_line %(- "x",)
1703
- beta_line %(+ ∙∙∙,)
1704
- plain_line %( "b",)
1705
- plain_line %( "c")
1706
- plain_line %( ])
1684
+ plain_line %( [)
1685
+ plain_line %( "a",)
1686
+ expected_line %(- "x",)
1687
+ actual_line %(+ ∙∙∙,)
1688
+ plain_line %( "b",)
1689
+ plain_line %( "c")
1690
+ plain_line %( ])
1707
1691
  end
1708
1692
  }
1709
1693
  STR
1710
1694
 
1711
- expect(actual_output).to eq(expected_output)
1695
+ expect(actual_output).to match_output(expected_output)
1712
1696
  end
1713
1697
  end
1714
1698
 
@@ -1725,8 +1709,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1725
1709
 
1726
1710
  #{
1727
1711
  colored do
1728
- alpha_line %(Expected: { foo: ["a", "x", "b", "c"] })
1729
- beta_line %( Actual: { foo: ["a", ∙∙∙, "b", "c"] })
1712
+ expected_line %(Expected: { foo: ["a", "x", "b", "c"] })
1713
+ actual_line %( Actual: { foo: ["a", ∙∙∙, "b", "c"] })
1730
1714
  end
1731
1715
  }
1732
1716
 
@@ -1734,20 +1718,20 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1734
1718
 
1735
1719
  #{
1736
1720
  colored do
1737
- plain_line %( {)
1738
- plain_line %( foo: [)
1739
- plain_line %( "a",)
1740
- alpha_line %(- "x",)
1741
- beta_line %(+ ∙∙∙,)
1742
- plain_line %( "b",)
1743
- plain_line %( "c")
1744
- plain_line %( ])
1745
- plain_line %( })
1721
+ plain_line %( {)
1722
+ plain_line %( foo: [)
1723
+ plain_line %( "a",)
1724
+ expected_line %(- "x",)
1725
+ actual_line %(+ ∙∙∙,)
1726
+ plain_line %( "b",)
1727
+ plain_line %( "c")
1728
+ plain_line %( ])
1729
+ plain_line %( })
1746
1730
  end
1747
1731
  }
1748
1732
  STR
1749
1733
 
1750
- expect(actual_output).to eq(expected_output)
1734
+ expect(actual_output).to match_output(expected_output)
1751
1735
  end
1752
1736
  end
1753
1737
 
@@ -1764,8 +1748,8 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1764
1748
 
1765
1749
  #{
1766
1750
  colored do
1767
- alpha_line %(Expected: { foo: ["a", "x", "b", "c"] })
1768
- beta_line %( Actual: { foo: ["a", ∙∙∙, "b", "c"] })
1751
+ expected_line %(Expected: { foo: ["a", "x", "b", "c"] })
1752
+ actual_line %( Actual: { foo: ["a", ∙∙∙, "b", "c"] })
1769
1753
  end
1770
1754
  }
1771
1755
 
@@ -1773,25 +1757,21 @@ RSpec.describe SuperDiff::EqualityMatchers::Main do
1773
1757
 
1774
1758
  #{
1775
1759
  colored do
1776
- plain_line %( {)
1777
- plain_line %( foo: [)
1778
- plain_line %( "a",)
1779
- alpha_line %(- "x",)
1780
- beta_line %(+ ∙∙∙,)
1781
- plain_line %( "b",)
1782
- plain_line %( "c")
1783
- plain_line %( ])
1784
- plain_line %( })
1760
+ plain_line %( {)
1761
+ plain_line %( foo: [)
1762
+ plain_line %( "a",)
1763
+ expected_line %(- "x",)
1764
+ actual_line %(+ ∙∙∙,)
1765
+ plain_line %( "b",)
1766
+ plain_line %( "c")
1767
+ plain_line %( ])
1768
+ plain_line %( })
1785
1769
  end
1786
1770
  }
1787
1771
  STR
1788
1772
 
1789
- expect(actual_output).to eq(expected_output)
1773
+ expect(actual_output).to match_output(expected_output)
1790
1774
  end
1791
1775
  end
1792
1776
  end
1793
-
1794
- def colored(*args, **opts, &block)
1795
- SuperDiff::Helpers.style(*args, **opts, &block).to_s.chomp
1796
- end
1797
1777
  end