super_diff 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) 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 +5 -13
  6. data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb +1 -3
  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 +3 -9
  18. data/lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb +1 -1
  19. data/lib/super_diff/active_support/object_inspection.rb +1 -1
  20. data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +5 -6
  21. data/lib/super_diff/active_support/operation_tree_builders.rb +1 -1
  22. data/lib/super_diff/active_support/operation_tree_flatteners.rb +1 -1
  23. data/lib/super_diff/active_support/operation_trees.rb +1 -1
  24. data/lib/super_diff/active_support.rb +6 -11
  25. data/lib/super_diff/colorized_document_extensions.rb +2 -4
  26. data/lib/super_diff/configuration.rb +14 -8
  27. data/lib/super_diff/csi/color.rb +4 -4
  28. data/lib/super_diff/csi/colorized_document.rb +12 -16
  29. data/lib/super_diff/csi/document.rb +8 -19
  30. data/lib/super_diff/csi/eight_bit_color.rb +19 -19
  31. data/lib/super_diff/csi/four_bit_color.rb +82 -31
  32. data/lib/super_diff/csi/twenty_four_bit_color.rb +12 -11
  33. data/lib/super_diff/csi/uncolorized_document.rb +2 -6
  34. data/lib/super_diff/csi.rb +10 -14
  35. data/lib/super_diff/diff_formatters/collection.rb +35 -41
  36. data/lib/super_diff/differs/default_object.rb +1 -1
  37. data/lib/super_diff/differs/defaults.rb +1 -1
  38. data/lib/super_diff/differs/main.rb +2 -13
  39. data/lib/super_diff/equality_matchers/array.rb +10 -12
  40. data/lib/super_diff/equality_matchers/base.rb +1 -1
  41. data/lib/super_diff/equality_matchers/default.rb +2 -4
  42. data/lib/super_diff/equality_matchers/defaults.rb +1 -1
  43. data/lib/super_diff/equality_matchers/hash.rb +10 -12
  44. data/lib/super_diff/equality_matchers/multiline_string.rb +11 -13
  45. data/lib/super_diff/equality_matchers/primitive.rb +10 -12
  46. data/lib/super_diff/equality_matchers/singleline_string.rb +10 -12
  47. data/lib/super_diff/equality_matchers.rb +1 -1
  48. data/lib/super_diff/errors.rb +3 -3
  49. data/lib/super_diff/gem_version.rb +3 -3
  50. data/lib/super_diff/helpers.rb +10 -10
  51. data/lib/super_diff/implementation_checks.rb +2 -2
  52. data/lib/super_diff/line.rb +3 -3
  53. data/lib/super_diff/object_inspection/inspection_tree.rb +46 -60
  54. data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +2 -6
  55. data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +3 -9
  56. data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +5 -14
  57. data/lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb +1 -1
  58. data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +4 -12
  59. data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +6 -23
  60. data/lib/super_diff/object_inspection/inspection_tree_builders.rb +9 -9
  61. data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +8 -20
  62. data/lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb +1 -5
  63. data/lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb +1 -5
  64. data/lib/super_diff/object_inspection/nodes/as_single_line.rb +3 -7
  65. data/lib/super_diff/object_inspection/nodes/base.rb +9 -14
  66. data/lib/super_diff/object_inspection/nodes/inspection.rb +26 -34
  67. data/lib/super_diff/object_inspection/nodes/nesting.rb +1 -1
  68. data/lib/super_diff/object_inspection/nodes/only_when.rb +2 -6
  69. data/lib/super_diff/object_inspection/nodes/text.rb +1 -5
  70. data/lib/super_diff/object_inspection/nodes/when_empty.rb +2 -6
  71. data/lib/super_diff/object_inspection/nodes/when_non_empty.rb +2 -6
  72. data/lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb +1 -1
  73. data/lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb +1 -5
  74. data/lib/super_diff/object_inspection/nodes.rb +7 -7
  75. data/lib/super_diff/object_inspection.rb +3 -3
  76. data/lib/super_diff/operation_tree_builders/array.rb +12 -11
  77. data/lib/super_diff/operation_tree_builders/base.rb +17 -15
  78. data/lib/super_diff/operation_tree_builders/custom_object.rb +8 -6
  79. data/lib/super_diff/operation_tree_builders/default_object.rb +29 -21
  80. data/lib/super_diff/operation_tree_builders/hash.rb +23 -24
  81. data/lib/super_diff/operation_tree_builders/main.rb +4 -11
  82. data/lib/super_diff/operation_tree_builders/multiline_string.rb +3 -3
  83. data/lib/super_diff/operation_tree_builders/time_like.rb +1 -11
  84. data/lib/super_diff/operation_tree_builders.rb +1 -1
  85. data/lib/super_diff/operation_tree_flatteners/base.rb +1 -5
  86. data/lib/super_diff/operation_tree_flatteners/collection.rb +13 -16
  87. data/lib/super_diff/operation_tree_flatteners/default_object.rb +1 -2
  88. data/lib/super_diff/operation_tree_flatteners/hash.rb +2 -10
  89. data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +2 -1
  90. data/lib/super_diff/operation_tree_flatteners.rb +3 -3
  91. data/lib/super_diff/operation_trees/base.rb +3 -5
  92. data/lib/super_diff/operation_trees/default_object.rb +1 -3
  93. data/lib/super_diff/operations/binary_operation.rb +2 -2
  94. data/lib/super_diff/operations/unary_operation.rb +1 -1
  95. data/lib/super_diff/rails.rb +2 -1
  96. data/lib/super_diff/recursion_guard.rb +5 -4
  97. data/lib/super_diff/rspec/augmented_matcher.rb +4 -5
  98. data/lib/super_diff/rspec/differ.rb +6 -13
  99. data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +3 -2
  100. data/lib/super_diff/rspec/differs/collection_including.rb +1 -1
  101. data/lib/super_diff/rspec/differs/hash_including.rb +1 -1
  102. data/lib/super_diff/rspec/differs.rb +3 -3
  103. data/lib/super_diff/rspec/matcher_text_builders/base.rb +13 -15
  104. data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +5 -7
  105. data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +3 -5
  106. data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -5
  107. data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +2 -6
  108. data/lib/super_diff/rspec/matcher_text_builders.rb +5 -8
  109. data/lib/super_diff/rspec/matcher_text_template.rb +13 -16
  110. data/lib/super_diff/rspec/monkey_patches.rb +122 -116
  111. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +8 -6
  112. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +11 -16
  113. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +2 -1
  114. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +8 -6
  115. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +8 -6
  116. data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +9 -9
  117. data/lib/super_diff/rspec/object_inspection.rb +1 -1
  118. data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +11 -10
  119. data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +7 -6
  120. data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +11 -10
  121. data/lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb +22 -17
  122. data/lib/super_diff/rspec/operation_tree_builders.rb +4 -4
  123. data/lib/super_diff/rspec.rb +11 -13
  124. data/lib/super_diff/tiered_lines_elider.rb +87 -115
  125. data/lib/super_diff/tiered_lines_formatter.rb +5 -9
  126. data/lib/super_diff/version.rb +1 -1
  127. data/lib/super_diff.rb +4 -9
  128. data/spec/examples.txt +493 -485
  129. data/spec/integration/rails/active_record_spec.rb +3 -1
  130. data/spec/integration/rails/engines_spec.rb +20 -0
  131. data/spec/integration/rails/hash_with_indifferent_access_spec.rb +3 -1
  132. data/spec/integration/rspec/be_falsey_matcher_spec.rb +40 -35
  133. data/spec/integration/rspec/be_matcher_spec.rb +360 -320
  134. data/spec/integration/rspec/be_nil_matcher_spec.rb +38 -34
  135. data/spec/integration/rspec/be_predicate_matcher_spec.rb +376 -359
  136. data/spec/integration/rspec/be_truthy_matcher_spec.rb +38 -33
  137. data/spec/integration/rspec/contain_exactly_matcher_spec.rb +242 -239
  138. data/spec/integration/rspec/eq_matcher_spec.rb +595 -557
  139. data/spec/integration/rspec/have_attributes_matcher_spec.rb +294 -286
  140. data/spec/integration/rspec/have_predicate_matcher_spec.rb +291 -297
  141. data/spec/integration/rspec/include_matcher_spec.rb +317 -215
  142. data/spec/integration/rspec/match_array_matcher_spec.rb +276 -273
  143. data/spec/integration/rspec/match_matcher_spec.rb +847 -834
  144. data/spec/integration/rspec/raise_error_matcher_spec.rb +468 -453
  145. data/spec/integration/rspec/respond_to_matcher_spec.rb +702 -697
  146. data/spec/integration/rspec/third_party_matcher_spec.rb +142 -138
  147. data/spec/integration/rspec/unhandled_errors_spec.rb +88 -84
  148. data/spec/spec_helper.rb +17 -20
  149. data/spec/support/command_runner.rb +34 -57
  150. data/spec/support/integration/helpers.rb +35 -28
  151. data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +28 -23
  152. data/spec/support/integration/test_programs/base.rb +12 -17
  153. data/spec/support/integration/test_programs/plain.rb +6 -0
  154. data/spec/support/integration/test_programs/rspec_active_record.rb +4 -1
  155. data/spec/support/integration/test_programs/rspec_active_support.rb +4 -1
  156. data/spec/support/integration/test_programs/rspec_rails.rb +4 -1
  157. data/spec/support/integration/test_programs/rspec_rails_engine.rb +30 -0
  158. data/spec/support/models/active_record/person.rb +6 -4
  159. data/spec/support/models/active_record/shipping_address.rb +9 -10
  160. data/spec/support/models/customer.rb +2 -4
  161. data/spec/support/models/player.rb +3 -6
  162. data/spec/support/models/shipping_address.rb +4 -13
  163. data/spec/support/shared_examples/active_record.rb +232 -214
  164. data/spec/support/shared_examples/active_support.rb +53 -51
  165. data/spec/support/shared_examples/elided_diffs.rb +405 -381
  166. data/spec/support/shared_examples/hash_with_indifferent_access.rb +424 -388
  167. data/spec/support/shared_examples/key.rb +123 -0
  168. data/spec/support/unit/helpers.rb +1 -3
  169. data/spec/support/unit/matchers/match_output.rb +12 -13
  170. data/spec/unit/active_record/object_inspection_spec.rb +222 -206
  171. data/spec/unit/equality_matchers/main_spec.rb +1049 -984
  172. data/spec/unit/helpers_spec.rb +14 -21
  173. data/spec/unit/operation_tree_flatteners/array_spec.rb +557 -524
  174. data/spec/unit/operation_tree_flatteners/custom_object_spec.rb +619 -601
  175. data/spec/unit/operation_tree_flatteners/default_object_spec.rb +619 -621
  176. data/spec/unit/operation_tree_flatteners/hash_spec.rb +595 -556
  177. data/spec/unit/operation_tree_flatteners/multiline_string_spec.rb +102 -92
  178. data/spec/unit/rspec/matchers/be_compared_to_spec.rb +3 -3
  179. data/spec/unit/rspec/matchers/be_predicate_spec.rb +3 -3
  180. data/spec/unit/rspec/matchers/contain_exactly_spec.rb +1 -1
  181. data/spec/unit/rspec/matchers/have_attributes_spec.rb +1 -1
  182. data/spec/unit/rspec/matchers/have_predicate_spec.rb +2 -2
  183. data/spec/unit/rspec/matchers/include_spec.rb +2 -2
  184. data/spec/unit/rspec/matchers/match_array_spec.rb +2 -2
  185. data/spec/unit/rspec/matchers/raise_error_spec.rb +5 -5
  186. data/spec/unit/rspec/matchers/respond_to_spec.rb +23 -16
  187. data/spec/unit/rspec/object_inspection_spec.rb +349 -324
  188. data/spec/unit/super_diff_spec.rb +1542 -1449
  189. data/spec/unit/tiered_lines_elider_spec.rb +3508 -3536
  190. data/spec/unit/tiered_lines_formatter_spec.rb +54 -116
  191. data/super_diff.gemspec +13 -12
  192. metadata +73 -73
  193. data/spec/tmp/warnings_logger/all_warnings.txt +0 -2
@@ -36,51 +36,55 @@ shared_examples_for "a matcher that supports elided diffs" do
36
36
  ]
37
37
  expect(actual).to #{matcher}(expected)
38
38
  TEST
39
- program = make_plain_test_program(
40
- snippet,
41
- color_enabled: color_enabled,
42
- configuration: {
43
- diff_elision_enabled: true,
44
- diff_elision_maximum: 3,
45
- },
46
- )
39
+ program =
40
+ make_plain_test_program(
41
+ snippet,
42
+ color_enabled: color_enabled,
43
+ configuration: {
44
+ diff_elision_enabled: true,
45
+ diff_elision_maximum: 3
46
+ }
47
+ )
47
48
 
48
- expected_output = build_expected_output(
49
- color_enabled: color_enabled,
50
- snippet: %|expect(actual).to #{matcher}(expected)|,
51
- newline_before_expectation: true,
52
- expectation: proc {
53
- line do
54
- plain "Expected "
55
- # rubocop:disable Layout/LineLength
56
- actual %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
57
- # rubocop:enable Layout/LineLength
58
- end
49
+ expected_output =
50
+ build_expected_output(
51
+ color_enabled: color_enabled,
52
+ snippet: %|expect(actual).to #{matcher}(expected)|,
53
+ newline_before_expectation: true,
54
+ expectation:
55
+ proc do
56
+ line do
57
+ plain "Expected "
58
+ # rubocop:disable Layout/LineLength
59
+ actual %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
60
+ # rubocop:enable Layout/LineLength
61
+ end
59
62
 
60
- line do
61
- plain " to eq "
62
- # rubocop:disable Layout/LineLength
63
- expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
64
- # rubocop:enable Layout/LineLength
65
- end
66
- },
67
- diff: proc {
68
- plain_line %| [|
69
- elision_marker_line %| # ...|
70
- plain_line %| "American Samoa",|
71
- plain_line %| "Andorra",|
72
- expected_line %|- "Angola",|
73
- actual_line %|+ "Anguilla",|
74
- plain_line %| "Antarctica",|
75
- plain_line %| "Antigua And Barbuda",|
76
- elision_marker_line %| # ...|
77
- plain_line %| ]|
78
- },
79
- )
63
+ line do
64
+ plain " to eq "
65
+ # rubocop:disable Layout/LineLength
66
+ expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
67
+ # rubocop:enable Layout/LineLength
68
+ end
69
+ end,
70
+ diff:
71
+ proc do
72
+ plain_line " ["
73
+ elision_marker_line " # ..."
74
+ plain_line %| "American Samoa",|
75
+ plain_line %| "Andorra",|
76
+ expected_line %|- "Angola",|
77
+ actual_line %|+ "Anguilla",|
78
+ plain_line %| "Antarctica",|
79
+ plain_line %| "Antigua And Barbuda",|
80
+ elision_marker_line " # ..."
81
+ plain_line " ]"
82
+ end
83
+ )
80
84
 
81
- expect(program).
82
- to produce_output_when_run(expected_output).
83
- in_color(color_enabled)
85
+ expect(program).to produce_output_when_run(expected_output).in_color(
86
+ color_enabled
87
+ )
84
88
  end
85
89
  end
86
90
  end
@@ -121,57 +125,61 @@ shared_examples_for "a matcher that supports elided diffs" do
121
125
  ]
122
126
  expect(actual).to #{matcher}(expected)
123
127
  TEST
124
- program = make_plain_test_program(
125
- snippet,
126
- color_enabled: color_enabled,
127
- configuration: {
128
- diff_elision_enabled: false,
129
- diff_elision_maximum: 3,
130
- },
131
- )
128
+ program =
129
+ make_plain_test_program(
130
+ snippet,
131
+ color_enabled: color_enabled,
132
+ configuration: {
133
+ diff_elision_enabled: false,
134
+ diff_elision_maximum: 3
135
+ }
136
+ )
132
137
 
133
- expected_output = build_expected_output(
134
- color_enabled: color_enabled,
135
- snippet: %|expect(actual).to #{matcher}(expected)|,
136
- newline_before_expectation: true,
137
- expectation: proc {
138
- line do
139
- plain "Expected "
140
- # rubocop:disable Layout/LineLength
141
- actual %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
142
- # rubocop:enable Layout/LineLength
143
- end
138
+ expected_output =
139
+ build_expected_output(
140
+ color_enabled: color_enabled,
141
+ snippet: %|expect(actual).to #{matcher}(expected)|,
142
+ newline_before_expectation: true,
143
+ expectation:
144
+ proc do
145
+ line do
146
+ plain "Expected "
147
+ # rubocop:disable Layout/LineLength
148
+ actual %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
149
+ # rubocop:enable Layout/LineLength
150
+ end
144
151
 
145
- line do
146
- plain " to eq "
147
- # rubocop:disable Layout/LineLength
148
- expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
149
- # rubocop:enable Layout/LineLength
150
- end
151
- },
152
- diff: proc {
153
- plain_line %| [|
154
- plain_line %| "Afghanistan",|
155
- plain_line %| "Aland Islands",|
156
- plain_line %| "Albania",|
157
- plain_line %| "Algeria",|
158
- plain_line %| "American Samoa",|
159
- plain_line %| "Andorra",|
160
- expected_line %|- "Angola",|
161
- actual_line %|+ "Anguilla",|
162
- plain_line %| "Antarctica",|
163
- plain_line %| "Antigua And Barbuda",|
164
- plain_line %| "Argentina",|
165
- plain_line %| "Armenia",|
166
- plain_line %| "Aruba",|
167
- plain_line %| "Australia"|
168
- plain_line %| ]|
169
- },
170
- )
152
+ line do
153
+ plain " to eq "
154
+ # rubocop:disable Layout/LineLength
155
+ expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
156
+ # rubocop:enable Layout/LineLength
157
+ end
158
+ end,
159
+ diff:
160
+ proc do
161
+ plain_line " ["
162
+ plain_line %| "Afghanistan",|
163
+ plain_line %| "Aland Islands",|
164
+ plain_line %| "Albania",|
165
+ plain_line %| "Algeria",|
166
+ plain_line %| "American Samoa",|
167
+ plain_line %| "Andorra",|
168
+ expected_line %|- "Angola",|
169
+ actual_line %|+ "Anguilla",|
170
+ plain_line %| "Antarctica",|
171
+ plain_line %| "Antigua And Barbuda",|
172
+ plain_line %| "Argentina",|
173
+ plain_line %| "Armenia",|
174
+ plain_line %| "Aruba",|
175
+ plain_line %| "Australia"|
176
+ plain_line " ]"
177
+ end
178
+ )
171
179
 
172
- expect(program).
173
- to produce_output_when_run(expected_output).
174
- in_color(color_enabled)
180
+ expect(program).to produce_output_when_run(expected_output).in_color(
181
+ color_enabled
182
+ )
175
183
  end
176
184
  end
177
185
  end
@@ -216,50 +224,54 @@ shared_examples_for "a matcher that supports elided diffs" do
216
224
  ]
217
225
  expect(actual).to #{matcher}(expected)
218
226
  TEST
219
- program = make_plain_test_program(
220
- snippet,
221
- color_enabled: color_enabled,
222
- configuration: {
223
- diff_elision_enabled: true,
224
- diff_elision_maximum: 3,
225
- },
226
- )
227
+ program =
228
+ make_plain_test_program(
229
+ snippet,
230
+ color_enabled: color_enabled,
231
+ configuration: {
232
+ diff_elision_enabled: true,
233
+ diff_elision_maximum: 3
234
+ }
235
+ )
227
236
 
228
- expected_output = build_expected_output(
229
- color_enabled: color_enabled,
230
- snippet: %|expect(actual).to #{matcher}(expected)|,
231
- newline_before_expectation: true,
232
- expectation: proc {
233
- line do
234
- plain "Expected "
235
- # rubocop:disable Layout/LineLength
236
- actual %|["Zambia", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Zimbabwe"]|
237
- # rubocop:enable Layout/LineLength
238
- end
237
+ expected_output =
238
+ build_expected_output(
239
+ color_enabled: color_enabled,
240
+ snippet: %|expect(actual).to #{matcher}(expected)|,
241
+ newline_before_expectation: true,
242
+ expectation:
243
+ proc do
244
+ line do
245
+ plain "Expected "
246
+ # rubocop:disable Layout/LineLength
247
+ actual %|["Zambia", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Zimbabwe"]|
248
+ # rubocop:enable Layout/LineLength
249
+ end
239
250
 
240
- line do
241
- plain " to eq "
242
- # rubocop:disable Layout/LineLength
243
- expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
244
- # rubocop:enable Layout/LineLength
245
- end
246
- },
247
- diff: proc {
248
- plain_line %| [|
249
- expected_line %|- "Afghanistan",|
250
- actual_line %|+ "Zambia",|
251
- plain_line %| "Aland Islands",|
252
- elision_marker_line %| # ...|
253
- plain_line %| "Aruba",|
254
- expected_line %|- "Australia"|
255
- actual_line %|+ "Zimbabwe"|
256
- plain_line %| ]|
257
- },
258
- )
251
+ line do
252
+ plain " to eq "
253
+ # rubocop:disable Layout/LineLength
254
+ expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
255
+ # rubocop:enable Layout/LineLength
256
+ end
257
+ end,
258
+ diff:
259
+ proc do
260
+ plain_line " ["
261
+ expected_line %|- "Afghanistan",|
262
+ actual_line %|+ "Zambia",|
263
+ plain_line %| "Aland Islands",|
264
+ elision_marker_line " # ..."
265
+ plain_line %| "Aruba",|
266
+ expected_line %|- "Australia"|
267
+ actual_line %|+ "Zimbabwe"|
268
+ plain_line " ]"
269
+ end
270
+ )
259
271
 
260
- expect(program).
261
- to produce_output_when_run(expected_output).
262
- in_color(color_enabled)
272
+ expect(program).to produce_output_when_run(expected_output).in_color(
273
+ color_enabled
274
+ )
263
275
  end
264
276
  end
265
277
  end
@@ -302,59 +314,63 @@ shared_examples_for "a matcher that supports elided diffs" do
302
314
  ]
303
315
  expect(actual).to #{matcher}(expected)
304
316
  TEST
305
- program = make_plain_test_program(
306
- snippet,
307
- color_enabled: color_enabled,
308
- configuration: {
309
- diff_elision_enabled: false,
310
- diff_elision_maximum: 3,
311
- },
312
- )
317
+ program =
318
+ make_plain_test_program(
319
+ snippet,
320
+ color_enabled: color_enabled,
321
+ configuration: {
322
+ diff_elision_enabled: false,
323
+ diff_elision_maximum: 3
324
+ }
325
+ )
313
326
 
314
- expected_output = build_expected_output(
315
- color_enabled: color_enabled,
316
- snippet: %|expect(actual).to #{matcher}(expected)|,
317
- newline_before_expectation: true,
318
- expectation: proc {
319
- line do
320
- plain "Expected "
321
- # rubocop:disable Layout/LineLength
322
- actual %|["Zambia", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Zimbabwe"]|
323
- # rubocop:enable Layout/LineLength
324
- end
327
+ expected_output =
328
+ build_expected_output(
329
+ color_enabled: color_enabled,
330
+ snippet: %|expect(actual).to #{matcher}(expected)|,
331
+ newline_before_expectation: true,
332
+ expectation:
333
+ proc do
334
+ line do
335
+ plain "Expected "
336
+ # rubocop:disable Layout/LineLength
337
+ actual %|["Zambia", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Zimbabwe"]|
338
+ # rubocop:enable Layout/LineLength
339
+ end
325
340
 
326
- line do
327
- plain " to eq "
328
- # rubocop:disable Layout/LineLength
329
- expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
330
- # rubocop:enable Layout/LineLength
331
- end
332
- },
333
- diff: proc {
334
- plain_line %| [|
335
- expected_line %|- "Afghanistan",|
336
- actual_line %|+ "Zambia",|
337
- plain_line %| "Aland Islands",|
338
- plain_line %| "Albania",|
339
- plain_line %| "Algeria",|
340
- plain_line %| "American Samoa",|
341
- plain_line %| "Andorra",|
342
- plain_line %| "Angola",|
343
- plain_line %| "Anguilla",|
344
- plain_line %| "Antarctica",|
345
- plain_line %| "Antigua And Barbuda",|
346
- plain_line %| "Argentina",|
347
- plain_line %| "Armenia",|
348
- plain_line %| "Aruba",|
349
- expected_line %|- "Australia"|
350
- actual_line %|+ "Zimbabwe"|
351
- plain_line %| ]|
352
- },
353
- )
341
+ line do
342
+ plain " to eq "
343
+ # rubocop:disable Layout/LineLength
344
+ expected %|["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia"]|
345
+ # rubocop:enable Layout/LineLength
346
+ end
347
+ end,
348
+ diff:
349
+ proc do
350
+ plain_line " ["
351
+ expected_line %|- "Afghanistan",|
352
+ actual_line %|+ "Zambia",|
353
+ plain_line %| "Aland Islands",|
354
+ plain_line %| "Albania",|
355
+ plain_line %| "Algeria",|
356
+ plain_line %| "American Samoa",|
357
+ plain_line %| "Andorra",|
358
+ plain_line %| "Angola",|
359
+ plain_line %| "Anguilla",|
360
+ plain_line %| "Antarctica",|
361
+ plain_line %| "Antigua And Barbuda",|
362
+ plain_line %| "Argentina",|
363
+ plain_line %| "Armenia",|
364
+ plain_line %| "Aruba",|
365
+ expected_line %|- "Australia"|
366
+ actual_line %|+ "Zimbabwe"|
367
+ plain_line " ]"
368
+ end
369
+ )
354
370
 
355
- expect(program).
356
- to produce_output_when_run(expected_output).
357
- in_color(color_enabled)
371
+ expect(program).to produce_output_when_run(expected_output).in_color(
372
+ color_enabled
373
+ )
358
374
  end
359
375
  end
360
376
  end
@@ -530,92 +546,96 @@ shared_examples_for "a matcher that supports elided diffs" do
530
546
  ]
531
547
  expect(actual).to #{matcher}(expected)
532
548
  TEST
533
- program = make_plain_test_program(
534
- snippet,
535
- color_enabled: color_enabled,
536
- configuration: {
537
- diff_elision_enabled: true,
538
- diff_elision_maximum: 10,
539
- },
540
- )
549
+ program =
550
+ make_plain_test_program(
551
+ snippet,
552
+ color_enabled: color_enabled,
553
+ configuration: {
554
+ diff_elision_enabled: true,
555
+ diff_elision_maximum: 10
556
+ }
557
+ )
541
558
 
542
- expected_output = build_expected_output(
543
- color_enabled: color_enabled,
544
- snippet: %|expect(actual).to #{matcher}(expected)|,
545
- newline_before_expectation: true,
546
- expectation: proc {
547
- line do
548
- plain "Expected "
549
- # rubocop:disable Layout/LineLength
550
- actual %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", url: "http://t.co/dnhLQpd9BY", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", display_url: "FT.com", indices: [65, 88] }] } }, protected: false, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png", 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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
551
- # rubocop:enable Layout/LineLength
552
- end
559
+ expected_output =
560
+ build_expected_output(
561
+ color_enabled: color_enabled,
562
+ snippet: %|expect(actual).to #{matcher}(expected)|,
563
+ newline_before_expectation: true,
564
+ expectation:
565
+ proc do
566
+ line do
567
+ plain "Expected "
568
+ # rubocop:disable Layout/LineLength
569
+ actual %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", url: "http://t.co/dnhLQpd9BY", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", display_url: "FT.com", indices: [65, 88] }] } }, protected: false, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png", 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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
570
+ # rubocop:enable Layout/LineLength
571
+ end
553
572
 
554
- line do
555
- plain " to eq "
556
- # rubocop:disable Layout/LineLength
557
- expected %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", expanded_url: "http://FT.com", indices: [65, 88] }] } }, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, 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_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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", advertiser_account_service_levels: [], profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
558
- # rubocop:enable Layout/LineLength
559
- end
560
- },
561
- diff: proc {
562
- plain_line %| [|
563
- plain_line %| {|
564
- plain_line %| user_id: "18949452",|
565
- plain_line %| user: {|
566
- plain_line %| id: 18949452,|
567
- plain_line %| name: "Financial Times",|
568
- plain_line %| screen_name: "FT",|
569
- plain_line %| location: "London",|
570
- actual_line %|+ url: "http://t.co/dnhLQpd9BY",|
571
- plain_line %| entities: {|
572
- plain_line %| url: {|
573
- plain_line %| urls: [|
574
- elision_marker_line %| # ...|
575
- plain_line %| ]|
576
- plain_line %| },|
577
- plain_line %| description: {|
578
- plain_line %| urls: [|
579
- plain_line %| {|
580
- elision_marker_line %| # ...|
581
- expected_line %|- expanded_url: "http://FT.com",|
582
- actual_line %|+ display_url: "FT.com",|
583
- plain_line %| indices: [|
584
- plain_line %| 65,|
585
- plain_line %| 88|
586
- plain_line %| ]|
587
- plain_line %| }|
588
- plain_line %| ]|
589
- plain_line %| }|
590
- plain_line %| },|
591
- actual_line %|+ protected: false,|
592
- elision_marker_line %| # ...|
593
- expected_line %|- profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",|
594
- expected_line %|- profile_background_tile: false,|
595
- expected_line %|- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
596
- actual_line %|+ profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png",|
597
- plain_line %| profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
598
- plain_line %| profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",|
599
- plain_line %| profile_image_extensions: {|
600
- elision_marker_line %| # ...|
601
- plain_line %| },|
602
- plain_line %| profile_banner_extensions: {},|
603
- plain_line %| blocking: false,|
604
- plain_line %| blocked_by: false,|
605
- plain_line %| want_retweets: false,|
606
- plain_line %| advertiser_account_type: "none",|
607
- expected_line %|- advertiser_account_service_levels: [],|
608
- elision_marker_line %| # ...|
609
- plain_line %| },|
610
- plain_line %| token: "117"|
611
- plain_line %| }|
612
- plain_line %| ]|
613
- },
614
- )
573
+ line do
574
+ plain " to eq "
575
+ # rubocop:disable Layout/LineLength
576
+ expected %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", expanded_url: "http://FT.com", indices: [65, 88] }] } }, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, 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_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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", advertiser_account_service_levels: [], profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
577
+ # rubocop:enable Layout/LineLength
578
+ end
579
+ end,
580
+ diff:
581
+ proc do
582
+ plain_line " ["
583
+ plain_line " {"
584
+ plain_line %| user_id: "18949452",|
585
+ plain_line " user: {"
586
+ plain_line " id: 18949452,"
587
+ plain_line %| name: "Financial Times",|
588
+ plain_line %| screen_name: "FT",|
589
+ plain_line %| location: "London",|
590
+ actual_line %|+ url: "http://t.co/dnhLQpd9BY",|
591
+ plain_line " entities: {"
592
+ plain_line " url: {"
593
+ plain_line " urls: ["
594
+ elision_marker_line " # ..."
595
+ plain_line " ]"
596
+ plain_line " },"
597
+ plain_line " description: {"
598
+ plain_line " urls: ["
599
+ plain_line " {"
600
+ elision_marker_line " # ..."
601
+ expected_line %|- expanded_url: "http://FT.com",|
602
+ actual_line %|+ display_url: "FT.com",|
603
+ plain_line " indices: ["
604
+ plain_line " 65,"
605
+ plain_line " 88"
606
+ plain_line " ]"
607
+ plain_line " }"
608
+ plain_line " ]"
609
+ plain_line " }"
610
+ plain_line " },"
611
+ actual_line "+ protected: false,"
612
+ elision_marker_line " # ..."
613
+ expected_line %|- profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",|
614
+ expected_line "- profile_background_tile: false,"
615
+ expected_line %|- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
616
+ actual_line %|+ profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png",|
617
+ plain_line %| profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
618
+ plain_line %| profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",|
619
+ plain_line " profile_image_extensions: {"
620
+ elision_marker_line " # ..."
621
+ plain_line " },"
622
+ plain_line " profile_banner_extensions: {},"
623
+ plain_line " blocking: false,"
624
+ plain_line " blocked_by: false,"
625
+ plain_line " want_retweets: false,"
626
+ plain_line %| advertiser_account_type: "none",|
627
+ expected_line "- advertiser_account_service_levels: [],"
628
+ elision_marker_line " # ..."
629
+ plain_line " },"
630
+ plain_line %| token: "117"|
631
+ plain_line " }"
632
+ plain_line " ]"
633
+ end
634
+ )
615
635
 
616
- expect(program).
617
- to produce_output_when_run(expected_output).
618
- in_color(color_enabled)
636
+ expect(program).to produce_output_when_run(expected_output).in_color(
637
+ color_enabled
638
+ )
619
639
  end
620
640
  end
621
641
  end
@@ -787,126 +807,130 @@ shared_examples_for "a matcher that supports elided diffs" do
787
807
  ]
788
808
  expect(actual).to #{matcher}(expected)
789
809
  TEST
790
- program = make_plain_test_program(
791
- snippet,
792
- color_enabled: color_enabled,
793
- configuration: {
794
- diff_elision_enabled: false,
795
- diff_elision_maximum: 10,
796
- },
797
- )
810
+ program =
811
+ make_plain_test_program(
812
+ snippet,
813
+ color_enabled: color_enabled,
814
+ configuration: {
815
+ diff_elision_enabled: false,
816
+ diff_elision_maximum: 10
817
+ }
818
+ )
798
819
 
799
- expected_output = build_expected_output(
800
- color_enabled: color_enabled,
801
- snippet: %|expect(actual).to #{matcher}(expected)|,
802
- newline_before_expectation: true,
803
- expectation: proc {
804
- line do
805
- plain "Expected "
806
- # rubocop:disable Layout/LineLength
807
- actual %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", url: "http://t.co/dnhLQpd9BY", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", display_url: "FT.com", indices: [65, 88] }] } }, protected: false, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png", 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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
808
- # rubocop:enable Layout/LineLength
809
- end
820
+ expected_output =
821
+ build_expected_output(
822
+ color_enabled: color_enabled,
823
+ snippet: %|expect(actual).to #{matcher}(expected)|,
824
+ newline_before_expectation: true,
825
+ expectation:
826
+ proc do
827
+ line do
828
+ plain "Expected "
829
+ # rubocop:disable Layout/LineLength
830
+ actual %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", url: "http://t.co/dnhLQpd9BY", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", display_url: "FT.com", indices: [65, 88] }] } }, protected: false, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, statuses_count: 273860, media_count: 51044, contributors_enabled: false, is_translator: false, is_translation_enabled: false, profile_background_color: "FFF1E0", profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png", 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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
831
+ # rubocop:enable Layout/LineLength
832
+ end
810
833
 
811
- line do
812
- plain " to eq "
813
- # rubocop:disable Layout/LineLength
814
- expected %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", expanded_url: "http://FT.com", indices: [65, 88] }] } }, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, 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_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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", advertiser_account_service_levels: [], profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
815
- # rubocop:enable Layout/LineLength
816
- end
817
- },
818
- diff: proc {
819
- plain_line %| [|
820
- plain_line %| {|
821
- plain_line %| user_id: "18949452",|
822
- plain_line %| user: {|
823
- plain_line %| id: 18949452,|
824
- plain_line %| name: "Financial Times",|
825
- plain_line %| screen_name: "FT",|
826
- plain_line %| location: "London",|
827
- actual_line %|+ url: "http://t.co/dnhLQpd9BY",|
828
- plain_line %| entities: {|
829
- plain_line %| url: {|
830
- plain_line %| urls: [|
831
- plain_line %| {|
832
- plain_line %| url: "http://t.co/dnhLQpd9BY",|
833
- plain_line %| expanded_url: "http://www.ft.com/",|
834
- plain_line %| display_url: "ft.com",|
835
- plain_line %| indices: [|
836
- plain_line %| 0,|
837
- plain_line %| 22|
838
- plain_line %| ]|
839
- plain_line %| }|
840
- plain_line %| ]|
841
- plain_line %| },|
842
- plain_line %| description: {|
843
- plain_line %| urls: [|
844
- plain_line %| {|
845
- plain_line %| url: "https://t.co/5BsmLs9y1Z",|
846
- expected_line %|- expanded_url: "http://FT.com",|
847
- actual_line %|+ display_url: "FT.com",|
848
- plain_line %| indices: [|
849
- plain_line %| 65,|
850
- plain_line %| 88|
851
- plain_line %| ]|
852
- plain_line %| }|
853
- plain_line %| ]|
854
- plain_line %| }|
855
- plain_line %| },|
856
- actual_line %|+ protected: false,|
857
- plain_line %| listed_count: 37009,|
858
- plain_line %| created_at: "Tue Jan 13 19:28:24 +0000 2009",|
859
- plain_line %| favourites_count: 38,|
860
- plain_line %| utc_offset: nil,|
861
- plain_line %| time_zone: nil,|
862
- plain_line %| geo_enabled: false,|
863
- plain_line %| verified: true,|
864
- plain_line %| statuses_count: 273860,|
865
- plain_line %| media_count: 51044,|
866
- plain_line %| contributors_enabled: false,|
867
- plain_line %| is_translator: false,|
868
- plain_line %| is_translation_enabled: false,|
869
- plain_line %| profile_background_color: "FFF1E0",|
870
- expected_line %|- profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",|
871
- expected_line %|- profile_background_tile: false,|
872
- expected_line %|- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
873
- actual_line %|+ profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png",|
874
- plain_line %| profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
875
- plain_line %| profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",|
876
- plain_line %| profile_image_extensions: {|
877
- plain_line %| mediaStats: {|
878
- plain_line %| r: {|
879
- plain_line %| missing: nil|
880
- plain_line %| },|
881
- plain_line %| ttl: -1|
882
- plain_line %| }|
883
- plain_line %| },|
884
- plain_line %| profile_banner_extensions: {},|
885
- plain_line %| blocking: false,|
886
- plain_line %| blocked_by: false,|
887
- plain_line %| want_retweets: false,|
888
- plain_line %| advertiser_account_type: "none",|
889
- expected_line %|- advertiser_account_service_levels: [],|
890
- plain_line %| profile_interstitial_type: "",|
891
- plain_line %| business_profile_state: "none",|
892
- plain_line %| translator_type: "none",|
893
- plain_line %| followed_by: false,|
894
- plain_line %| ext: {|
895
- plain_line %| highlightedLabel: {|
896
- plain_line %| ttl: -1|
897
- plain_line %| }|
898
- plain_line %| },|
899
- plain_line %| require_some_consent: false|
900
- plain_line %| },|
901
- plain_line %| token: "117"|
902
- plain_line %| }|
903
- plain_line %| ]|
904
- },
905
- )
834
+ line do
835
+ plain " to eq "
836
+ # rubocop:disable Layout/LineLength
837
+ expected %<[{ user_id: "18949452", user: { id: 18949452, name: "Financial Times", screen_name: "FT", location: "London", entities: { url: { urls: [{ url: "http://t.co/dnhLQpd9BY", expanded_url: "http://www.ft.com/", display_url: "ft.com", indices: [0, 22] }] }, description: { urls: [{ url: "https://t.co/5BsmLs9y1Z", expanded_url: "http://FT.com", indices: [65, 88] }] } }, listed_count: 37009, created_at: "Tue Jan 13 19:28:24 +0000 2009", favourites_count: 38, utc_offset: nil, time_zone: nil, geo_enabled: false, verified: true, 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_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", profile_image_extensions: { mediaStats: { r: { missing: nil }, ttl: -1 } }, profile_banner_extensions: {}, blocking: false, blocked_by: false, want_retweets: false, advertiser_account_type: "none", advertiser_account_service_levels: [], profile_interstitial_type: "", business_profile_state: "none", translator_type: "none", followed_by: false, ext: { highlightedLabel: { ttl: -1 } }, require_some_consent: false }, token: "117" }]>
838
+ # rubocop:enable Layout/LineLength
839
+ end
840
+ end,
841
+ diff:
842
+ proc do
843
+ plain_line " ["
844
+ plain_line " {"
845
+ plain_line %| user_id: "18949452",|
846
+ plain_line " user: {"
847
+ plain_line " id: 18949452,"
848
+ plain_line %| name: "Financial Times",|
849
+ plain_line %| screen_name: "FT",|
850
+ plain_line %| location: "London",|
851
+ actual_line %|+ url: "http://t.co/dnhLQpd9BY",|
852
+ plain_line " entities: {"
853
+ plain_line " url: {"
854
+ plain_line " urls: ["
855
+ plain_line " {"
856
+ plain_line %| url: "http://t.co/dnhLQpd9BY",|
857
+ plain_line %| expanded_url: "http://www.ft.com/",|
858
+ plain_line %| display_url: "ft.com",|
859
+ plain_line " indices: ["
860
+ plain_line " 0,"
861
+ plain_line " 22"
862
+ plain_line " ]"
863
+ plain_line " }"
864
+ plain_line " ]"
865
+ plain_line " },"
866
+ plain_line " description: {"
867
+ plain_line " urls: ["
868
+ plain_line " {"
869
+ plain_line %| url: "https://t.co/5BsmLs9y1Z",|
870
+ expected_line %|- expanded_url: "http://FT.com",|
871
+ actual_line %|+ display_url: "FT.com",|
872
+ plain_line " indices: ["
873
+ plain_line " 65,"
874
+ plain_line " 88"
875
+ plain_line " ]"
876
+ plain_line " }"
877
+ plain_line " ]"
878
+ plain_line " }"
879
+ plain_line " },"
880
+ actual_line "+ protected: false,"
881
+ plain_line " listed_count: 37009,"
882
+ plain_line %| created_at: "Tue Jan 13 19:28:24 +0000 2009",|
883
+ plain_line " favourites_count: 38,"
884
+ plain_line " utc_offset: nil,"
885
+ plain_line " time_zone: nil,"
886
+ plain_line " geo_enabled: false,"
887
+ plain_line " verified: true,"
888
+ plain_line " statuses_count: 273860,"
889
+ plain_line " media_count: 51044,"
890
+ plain_line " contributors_enabled: false,"
891
+ plain_line " is_translator: false,"
892
+ plain_line " is_translation_enabled: false,"
893
+ plain_line %| profile_background_color: "FFF1E0",|
894
+ expected_line %|- profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",|
895
+ expected_line "- profile_background_tile: false,"
896
+ expected_line %|- profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
897
+ actual_line %|+ profile_background_image_url: "http://abs.twimg.com/images/themes/theme1/bg.png",|
898
+ plain_line %| profile_image_url_https: "https://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",|
899
+ plain_line %| profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",|
900
+ plain_line " profile_image_extensions: {"
901
+ plain_line " mediaStats: {"
902
+ plain_line " r: {"
903
+ plain_line " missing: nil"
904
+ plain_line " },"
905
+ plain_line " ttl: -1"
906
+ plain_line " }"
907
+ plain_line " },"
908
+ plain_line " profile_banner_extensions: {},"
909
+ plain_line " blocking: false,"
910
+ plain_line " blocked_by: false,"
911
+ plain_line " want_retweets: false,"
912
+ plain_line %| advertiser_account_type: "none",|
913
+ expected_line "- advertiser_account_service_levels: [],"
914
+ plain_line %| profile_interstitial_type: "",|
915
+ plain_line %| business_profile_state: "none",|
916
+ plain_line %| translator_type: "none",|
917
+ plain_line " followed_by: false,"
918
+ plain_line " ext: {"
919
+ plain_line " highlightedLabel: {"
920
+ plain_line " ttl: -1"
921
+ plain_line " }"
922
+ plain_line " },"
923
+ plain_line " require_some_consent: false"
924
+ plain_line " },"
925
+ plain_line %| token: "117"|
926
+ plain_line " }"
927
+ plain_line " ]"
928
+ end
929
+ )
906
930
 
907
- expect(program).
908
- to produce_output_when_run(expected_output).
909
- in_color(color_enabled)
931
+ expect(program).to produce_output_when_run(expected_output).in_color(
932
+ color_enabled
933
+ )
910
934
  end
911
935
  end
912
936
  end