super_diff 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -1,62 +1,63 @@
1
1
  require "spec_helper"
2
2
 
3
3
  # TODO: Update coloring here
4
- RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integration do
4
+ RSpec.describe "Integration with RSpec's #respond_to matcher",
5
+ type: :integration do
5
6
  context "without any qualifiers" do
6
7
  context "when a few number of methods are specified" do
7
8
  it "produces the correct failure message when used in the positive" do
8
9
  as_both_colored_and_uncolored do |color_enabled|
9
- snippet = %|expect(double).to respond_to(:foo)|
10
- program = make_plain_test_program(
11
- snippet,
12
- color_enabled: color_enabled,
10
+ snippet = "expect(double).to respond_to(:foo)"
11
+ program =
12
+ make_plain_test_program(snippet, color_enabled: color_enabled)
13
+
14
+ expected_output =
15
+ build_expected_output(
16
+ color_enabled: color_enabled,
17
+ snippet: snippet,
18
+ expectation:
19
+ proc do
20
+ line do
21
+ plain "Expected "
22
+ actual "#<Double (anonymous)>"
23
+ plain " to respond to "
24
+ expected ":foo"
25
+ plain "."
26
+ end
27
+ end
28
+ )
29
+
30
+ expect(program).to produce_output_when_run(expected_output).in_color(
31
+ color_enabled
13
32
  )
14
-
15
- expected_output = build_expected_output(
16
- color_enabled: color_enabled,
17
- snippet: snippet,
18
- expectation: proc {
19
- line do
20
- plain %|Expected |
21
- actual %|#<Double (anonymous)>|
22
- plain %| to respond to |
23
- expected %|:foo|
24
- plain %|.|
25
- end
26
- },
27
- )
28
-
29
- expect(program).
30
- to produce_output_when_run(expected_output).
31
- in_color(color_enabled)
32
33
  end
33
34
  end
34
35
 
35
36
  it "produces the correct failure message when used in the negative" do
36
37
  as_both_colored_and_uncolored do |color_enabled|
37
- snippet = %|expect(double).not_to respond_to(:inspect)|
38
- program = make_plain_test_program(
39
- snippet,
40
- color_enabled: color_enabled,
38
+ snippet = "expect(double).not_to respond_to(:inspect)"
39
+ program =
40
+ make_plain_test_program(snippet, color_enabled: color_enabled)
41
+
42
+ expected_output =
43
+ build_expected_output(
44
+ color_enabled: color_enabled,
45
+ snippet: snippet,
46
+ expectation:
47
+ proc do
48
+ line do
49
+ plain "Expected "
50
+ actual "#<Double (anonymous)>"
51
+ plain " not to respond to "
52
+ expected ":inspect"
53
+ plain "."
54
+ end
55
+ end
56
+ )
57
+
58
+ expect(program).to produce_output_when_run(expected_output).in_color(
59
+ color_enabled
41
60
  )
42
-
43
- expected_output = build_expected_output(
44
- color_enabled: color_enabled,
45
- snippet: snippet,
46
- expectation: proc {
47
- line do
48
- plain %|Expected |
49
- actual %|#<Double (anonymous)>|
50
- plain %| not to respond to |
51
- expected %|:inspect|
52
- plain %|.|
53
- end
54
- },
55
- )
56
-
57
- expect(program).
58
- to produce_output_when_run(expected_output).
59
- in_color(color_enabled)
60
61
  end
61
62
  end
62
63
  end
@@ -67,43 +68,44 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
67
68
  snippet = <<~TEST.strip
68
69
  expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :qux, :fizz, :buzz, :zing)
69
70
  TEST
70
- program = make_plain_test_program(
71
- snippet,
72
- color_enabled: color_enabled,
71
+ program =
72
+ make_plain_test_program(snippet, color_enabled: color_enabled)
73
+
74
+ expected_output =
75
+ build_expected_output(
76
+ color_enabled: color_enabled,
77
+ snippet:
78
+ "expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :qux, :fizz, :buzz, :zing)",
79
+ newline_before_expectation: true,
80
+ expectation:
81
+ proc do
82
+ line do
83
+ plain " Expected "
84
+ actual "#<Double :something_really_long>"
85
+ end
86
+
87
+ line do
88
+ plain "to respond to "
89
+ expected ":foo"
90
+ plain ", "
91
+ expected ":bar"
92
+ plain ", "
93
+ expected ":baz"
94
+ plain ", "
95
+ expected ":qux"
96
+ plain ", "
97
+ expected ":fizz"
98
+ plain ", "
99
+ expected ":buzz"
100
+ plain " and "
101
+ expected ":zing"
102
+ end
103
+ end
104
+ )
105
+
106
+ expect(program).to produce_output_when_run(expected_output).in_color(
107
+ color_enabled
73
108
  )
74
-
75
- expected_output = build_expected_output(
76
- color_enabled: color_enabled,
77
- snippet: %|expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :qux, :fizz, :buzz, :zing)|,
78
- newline_before_expectation: true,
79
- expectation: proc {
80
- line do
81
- plain %| Expected |
82
- actual %|#<Double :something_really_long>|
83
- end
84
-
85
- line do
86
- plain %|to respond to |
87
- expected %|:foo|
88
- plain %|, |
89
- expected %|:bar|
90
- plain %|, |
91
- expected %|:baz|
92
- plain %|, |
93
- expected %|:qux|
94
- plain %|, |
95
- expected %|:fizz|
96
- plain %|, |
97
- expected %|:buzz|
98
- plain %| and |
99
- expected %|:zing|
100
- end
101
- },
102
- )
103
-
104
- expect(program).
105
- to produce_output_when_run(expected_output).
106
- in_color(color_enabled)
107
109
  end
108
110
  end
109
111
 
@@ -117,34 +119,34 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
117
119
 
118
120
  expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever)
119
121
  TEST
120
- program = make_plain_test_program(
121
- snippet,
122
- color_enabled: color_enabled,
123
- )
124
-
125
- expected_output = build_expected_output(
126
- color_enabled: color_enabled,
127
- snippet: %|expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever)|,
128
- newline_before_expectation: true,
129
- expectation: proc {
130
- line do
131
- plain %| Expected |
132
- actual %|#<B>|
133
- end
134
-
135
- line do
136
- plain %|not to respond to |
137
- expected %|:some_really_long_method_and_stuff|
138
- plain %| and |
139
- expected %|:another_method_or_whatever|
140
- end
141
- },
142
- )
143
-
144
- expect(program).
145
- to produce_output_when_run(expected_output).
146
- removing_object_ids.
147
- in_color(color_enabled)
122
+ program =
123
+ make_plain_test_program(snippet, color_enabled: color_enabled)
124
+
125
+ expected_output =
126
+ build_expected_output(
127
+ color_enabled: color_enabled,
128
+ snippet:
129
+ "expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever)",
130
+ newline_before_expectation: true,
131
+ expectation:
132
+ proc do
133
+ line do
134
+ plain " Expected "
135
+ actual "#<B>"
136
+ end
137
+
138
+ line do
139
+ plain "not to respond to "
140
+ expected ":some_really_long_method_and_stuff"
141
+ plain " and "
142
+ expected ":another_method_or_whatever"
143
+ end
144
+ end
145
+ )
146
+
147
+ expect(program).to produce_output_when_run(
148
+ expected_output
149
+ ).removing_object_ids.in_color(color_enabled)
148
150
  end
149
151
  end
150
152
  end
@@ -157,30 +159,30 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
157
159
  snippet = <<~TEST.strip
158
160
  expect(double).to respond_to(:foo).with(3).arguments
159
161
  TEST
160
- program = make_plain_test_program(
161
- snippet,
162
- color_enabled: color_enabled,
163
- )
164
-
165
- expected_output = build_expected_output(
166
- color_enabled: color_enabled,
167
- snippet: %|expect(double).to respond_to(:foo).with(3).arguments|,
168
- expectation: proc {
169
- line do
170
- plain %|Expected |
171
- actual %|#<Double (anonymous)>|
172
- plain %| to respond to |
173
- expected %|:foo|
174
- plain %| with |
175
- expected %|3|
176
- plain %| arguments.|
177
- end
178
- },
162
+ program =
163
+ make_plain_test_program(snippet, color_enabled: color_enabled)
164
+
165
+ expected_output =
166
+ build_expected_output(
167
+ color_enabled: color_enabled,
168
+ snippet: "expect(double).to respond_to(:foo).with(3).arguments",
169
+ expectation:
170
+ proc do
171
+ line do
172
+ plain "Expected "
173
+ actual "#<Double (anonymous)>"
174
+ plain " to respond to "
175
+ expected ":foo"
176
+ plain " with "
177
+ expected "3"
178
+ plain " arguments."
179
+ end
180
+ end
181
+ )
182
+
183
+ expect(program).to produce_output_when_run(expected_output).in_color(
184
+ color_enabled
179
185
  )
180
-
181
- expect(program).
182
- to produce_output_when_run(expected_output).
183
- in_color(color_enabled)
184
186
  end
185
187
  end
186
188
 
@@ -193,31 +195,31 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
193
195
 
194
196
  expect(B.new).not_to respond_to(:foo).with(3).arguments
195
197
  TEST
196
- program = make_plain_test_program(
197
- snippet,
198
- color_enabled: color_enabled,
199
- )
200
-
201
- expected_output = build_expected_output(
202
- color_enabled: color_enabled,
203
- snippet: %|expect(B.new).not_to respond_to(:foo).with(3).arguments|,
204
- expectation: proc {
205
- line do
206
- plain %|Expected |
207
- actual %|#<B>|
208
- plain %| not to respond to |
209
- expected %|:foo|
210
- plain %| with |
211
- expected %|3|
212
- plain %| arguments.|
213
- end
214
- },
215
- )
216
-
217
- expect(program).
218
- to produce_output_when_run(expected_output).
219
- removing_object_ids.
220
- in_color(color_enabled)
198
+ program =
199
+ make_plain_test_program(snippet, color_enabled: color_enabled)
200
+
201
+ expected_output =
202
+ build_expected_output(
203
+ color_enabled: color_enabled,
204
+ snippet:
205
+ "expect(B.new).not_to respond_to(:foo).with(3).arguments",
206
+ expectation:
207
+ proc do
208
+ line do
209
+ plain "Expected "
210
+ actual "#<B>"
211
+ plain " not to respond to "
212
+ expected ":foo"
213
+ plain " with "
214
+ expected "3"
215
+ plain " arguments."
216
+ end
217
+ end
218
+ )
219
+
220
+ expect(program).to produce_output_when_run(
221
+ expected_output
222
+ ).removing_object_ids.in_color(color_enabled)
221
223
  end
222
224
  end
223
225
  end
@@ -228,42 +230,43 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
228
230
  snippet = <<~TEST.strip
229
231
  expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :fizz, :buzz).with(3).arguments
230
232
  TEST
231
- program = make_plain_test_program(
232
- snippet,
233
- color_enabled: color_enabled,
233
+ program =
234
+ make_plain_test_program(snippet, color_enabled: color_enabled)
235
+
236
+ expected_output =
237
+ build_expected_output(
238
+ color_enabled: color_enabled,
239
+ snippet:
240
+ "expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :fizz, :buzz).with(3).arguments",
241
+ newline_before_expectation: true,
242
+ expectation:
243
+ proc do
244
+ line do
245
+ plain " Expected "
246
+ actual "#<Double :something_really_long>"
247
+ end
248
+
249
+ line do
250
+ plain "to respond to "
251
+ expected ":foo"
252
+ plain ", "
253
+ expected ":bar"
254
+ plain ", "
255
+ expected ":baz"
256
+ plain ", "
257
+ expected ":fizz"
258
+ plain " and "
259
+ expected ":buzz"
260
+ plain " with "
261
+ expected "3"
262
+ plain " arguments"
263
+ end
264
+ end
265
+ )
266
+
267
+ expect(program).to produce_output_when_run(expected_output).in_color(
268
+ color_enabled
234
269
  )
235
-
236
- expected_output = build_expected_output(
237
- color_enabled: color_enabled,
238
- snippet: %|expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :fizz, :buzz).with(3).arguments|,
239
- newline_before_expectation: true,
240
- expectation: proc {
241
- line do
242
- plain %| Expected |
243
- actual %|#<Double :something_really_long>|
244
- end
245
-
246
- line do
247
- plain %|to respond to |
248
- expected %|:foo|
249
- plain %|, |
250
- expected %|:bar|
251
- plain %|, |
252
- expected %|:baz|
253
- plain %|, |
254
- expected %|:fizz|
255
- plain %| and |
256
- expected %|:buzz|
257
- plain %| with |
258
- expected %|3|
259
- plain %| arguments|
260
- end
261
- },
262
- )
263
-
264
- expect(program).
265
- to produce_output_when_run(expected_output).
266
- in_color(color_enabled)
267
270
  end
268
271
  end
269
272
 
@@ -277,37 +280,37 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
277
280
 
278
281
  expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with(3).arguments
279
282
  TEST
280
- program = make_plain_test_program(
281
- snippet,
282
- color_enabled: color_enabled,
283
- )
284
-
285
- expected_output = build_expected_output(
286
- color_enabled: color_enabled,
287
- snippet: %|expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with(3).arguments|,
288
- newline_before_expectation: true,
289
- expectation: proc {
290
- line do
291
- plain %| Expected |
292
- actual %|#<B>|
293
- end
294
-
295
- line do
296
- plain %|not to respond to |
297
- expected %|:some_really_long_method_and_stuff|
298
- plain %| and |
299
- expected %|:another_method_or_whatever|
300
- plain %| with |
301
- expected %|3|
302
- plain %| arguments|
303
- end
304
- },
305
- )
306
-
307
- expect(program).
308
- to produce_output_when_run(expected_output).
309
- removing_object_ids.
310
- in_color(color_enabled)
283
+ program =
284
+ make_plain_test_program(snippet, color_enabled: color_enabled)
285
+
286
+ expected_output =
287
+ build_expected_output(
288
+ color_enabled: color_enabled,
289
+ snippet:
290
+ "expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with(3).arguments",
291
+ newline_before_expectation: true,
292
+ expectation:
293
+ proc do
294
+ line do
295
+ plain " Expected "
296
+ actual "#<B>"
297
+ end
298
+
299
+ line do
300
+ plain "not to respond to "
301
+ expected ":some_really_long_method_and_stuff"
302
+ plain " and "
303
+ expected ":another_method_or_whatever"
304
+ plain " with "
305
+ expected "3"
306
+ plain " arguments"
307
+ end
308
+ end
309
+ )
310
+
311
+ expect(program).to produce_output_when_run(
312
+ expected_output
313
+ ).removing_object_ids.in_color(color_enabled)
311
314
  end
312
315
  end
313
316
  end
@@ -320,30 +323,30 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
320
323
  snippet = <<~TEST.strip
321
324
  expect(double).to respond_to(:foo).with_keywords(:bar)
322
325
  TEST
323
- program = make_plain_test_program(
324
- snippet,
325
- color_enabled: color_enabled,
326
- )
327
-
328
- expected_output = build_expected_output(
329
- color_enabled: color_enabled,
330
- snippet: %|expect(double).to respond_to(:foo).with_keywords(:bar)|,
331
- expectation: proc {
332
- line do
333
- plain %|Expected |
334
- actual %|#<Double (anonymous)>|
335
- plain %| to respond to |
336
- expected %|:foo|
337
- plain %| with keyword |
338
- expected %|:bar|
339
- plain %|.|
340
- end
341
- },
326
+ program =
327
+ make_plain_test_program(snippet, color_enabled: color_enabled)
328
+
329
+ expected_output =
330
+ build_expected_output(
331
+ color_enabled: color_enabled,
332
+ snippet: "expect(double).to respond_to(:foo).with_keywords(:bar)",
333
+ expectation:
334
+ proc do
335
+ line do
336
+ plain "Expected "
337
+ actual "#<Double (anonymous)>"
338
+ plain " to respond to "
339
+ expected ":foo"
340
+ plain " with keyword "
341
+ expected ":bar"
342
+ plain "."
343
+ end
344
+ end
345
+ )
346
+
347
+ expect(program).to produce_output_when_run(expected_output).in_color(
348
+ color_enabled
342
349
  )
343
-
344
- expect(program).
345
- to produce_output_when_run(expected_output).
346
- in_color(color_enabled)
347
350
  end
348
351
  end
349
352
 
@@ -356,31 +359,31 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
356
359
 
357
360
  expect(B.new).not_to respond_to(:foo).with_keywords(:bar)
358
361
  TEST
359
- program = make_plain_test_program(
360
- snippet,
361
- color_enabled: color_enabled,
362
- )
363
-
364
- expected_output = build_expected_output(
365
- color_enabled: color_enabled,
366
- snippet: %|expect(B.new).not_to respond_to(:foo).with_keywords(:bar)|,
367
- expectation: proc {
368
- line do
369
- plain %|Expected |
370
- actual %|#<B>|
371
- plain %| not to respond to |
372
- expected %|:foo|
373
- plain %| with keyword |
374
- expected %|:bar|
375
- plain %|.|
376
- end
377
- },
378
- )
379
-
380
- expect(program).
381
- to produce_output_when_run(expected_output).
382
- removing_object_ids.
383
- in_color(color_enabled)
362
+ program =
363
+ make_plain_test_program(snippet, color_enabled: color_enabled)
364
+
365
+ expected_output =
366
+ build_expected_output(
367
+ color_enabled: color_enabled,
368
+ snippet:
369
+ "expect(B.new).not_to respond_to(:foo).with_keywords(:bar)",
370
+ expectation:
371
+ proc do
372
+ line do
373
+ plain "Expected "
374
+ actual "#<B>"
375
+ plain " not to respond to "
376
+ expected ":foo"
377
+ plain " with keyword "
378
+ expected ":bar"
379
+ plain "."
380
+ end
381
+ end
382
+ )
383
+
384
+ expect(program).to produce_output_when_run(
385
+ expected_output
386
+ ).removing_object_ids.in_color(color_enabled)
384
387
  end
385
388
  end
386
389
  end
@@ -391,43 +394,44 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
391
394
  snippet = <<~TEST.strip
392
395
  expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :fizz, :buzz).with_keywords(:qux, :blargh)
393
396
  TEST
394
- program = make_plain_test_program(
395
- snippet,
396
- color_enabled: color_enabled,
397
- )
398
-
399
- expected_output = build_expected_output(
400
- color_enabled: color_enabled,
401
- snippet: %|expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :fizz, :buzz).with_keywords(:qux, :blargh)|,
402
- newline_before_expectation: true,
403
- expectation: proc {
404
- line do
405
- plain %| Expected |
406
- actual %|#<Double :something_really_long>|
407
- end
408
-
409
- line do
410
- plain %|to respond to |
411
- expected %|:foo|
412
- plain %|, |
413
- expected %|:bar|
414
- plain %|, |
415
- expected %|:baz|
416
- plain %|, |
417
- expected %|:fizz|
418
- plain %| and |
419
- expected %|:buzz|
420
- plain %| with keywords |
421
- expected %|:qux|
422
- plain %| and |
423
- expected %|:blargh|
424
- end
425
- },
397
+ program =
398
+ make_plain_test_program(snippet, color_enabled: color_enabled)
399
+
400
+ expected_output =
401
+ build_expected_output(
402
+ color_enabled: color_enabled,
403
+ snippet:
404
+ "expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :fizz, :buzz).with_keywords(:qux, :blargh)",
405
+ newline_before_expectation: true,
406
+ expectation:
407
+ proc do
408
+ line do
409
+ plain " Expected "
410
+ actual "#<Double :something_really_long>"
411
+ end
412
+
413
+ line do
414
+ plain "to respond to "
415
+ expected ":foo"
416
+ plain ", "
417
+ expected ":bar"
418
+ plain ", "
419
+ expected ":baz"
420
+ plain ", "
421
+ expected ":fizz"
422
+ plain " and "
423
+ expected ":buzz"
424
+ plain " with keywords "
425
+ expected ":qux"
426
+ plain " and "
427
+ expected ":blargh"
428
+ end
429
+ end
430
+ )
431
+
432
+ expect(program).to produce_output_when_run(expected_output).in_color(
433
+ color_enabled
426
434
  )
427
-
428
- expect(program).
429
- to produce_output_when_run(expected_output).
430
- in_color(color_enabled)
431
435
  end
432
436
  end
433
437
 
@@ -441,38 +445,38 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
441
445
 
442
446
  expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_keywords(:foo, :bar)
443
447
  TEST
444
- program = make_plain_test_program(
445
- snippet,
446
- color_enabled: color_enabled,
447
- )
448
-
449
- expected_output = build_expected_output(
450
- color_enabled: color_enabled,
451
- snippet: %|expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_keywords(:foo, :bar)|,
452
- newline_before_expectation: true,
453
- expectation: proc {
454
- line do
455
- plain %| Expected |
456
- actual %|#<B>|
457
- end
458
-
459
- line do
460
- plain %|not to respond to |
461
- expected %|:some_really_long_method_and_stuff|
462
- plain %| and |
463
- expected %|:another_method_or_whatever|
464
- plain %| with keywords |
465
- expected %|:foo|
466
- plain %| and |
467
- expected %|:bar|
468
- end
469
- },
470
- )
471
-
472
- expect(program).
473
- to produce_output_when_run(expected_output).
474
- removing_object_ids.
475
- in_color(color_enabled)
448
+ program =
449
+ make_plain_test_program(snippet, color_enabled: color_enabled)
450
+
451
+ expected_output =
452
+ build_expected_output(
453
+ color_enabled: color_enabled,
454
+ snippet:
455
+ "expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_keywords(:foo, :bar)",
456
+ newline_before_expectation: true,
457
+ expectation:
458
+ proc do
459
+ line do
460
+ plain " Expected "
461
+ actual "#<B>"
462
+ end
463
+
464
+ line do
465
+ plain "not to respond to "
466
+ expected ":some_really_long_method_and_stuff"
467
+ plain " and "
468
+ expected ":another_method_or_whatever"
469
+ plain " with keywords "
470
+ expected ":foo"
471
+ plain " and "
472
+ expected ":bar"
473
+ end
474
+ end
475
+ )
476
+
477
+ expect(program).to produce_output_when_run(
478
+ expected_output
479
+ ).removing_object_ids.in_color(color_enabled)
476
480
  end
477
481
  end
478
482
  end
@@ -485,30 +489,30 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
485
489
  snippet = <<~TEST.strip
486
490
  expect(double).to respond_to(:foo).with_any_keywords
487
491
  TEST
488
- program = make_plain_test_program(
489
- snippet,
490
- color_enabled: color_enabled,
492
+ program =
493
+ make_plain_test_program(snippet, color_enabled: color_enabled)
494
+
495
+ expected_output =
496
+ build_expected_output(
497
+ color_enabled: color_enabled,
498
+ snippet: "expect(double).to respond_to(:foo).with_any_keywords",
499
+ expectation:
500
+ proc do
501
+ line do
502
+ plain "Expected "
503
+ actual "#<Double (anonymous)>"
504
+ plain " to respond to "
505
+ expected ":foo"
506
+ plain " with "
507
+ expected "any"
508
+ plain " keywords."
509
+ end
510
+ end
511
+ )
512
+
513
+ expect(program).to produce_output_when_run(expected_output).in_color(
514
+ color_enabled
491
515
  )
492
-
493
- expected_output = build_expected_output(
494
- color_enabled: color_enabled,
495
- snippet: %|expect(double).to respond_to(:foo).with_any_keywords|,
496
- expectation: proc {
497
- line do
498
- plain %|Expected |
499
- actual %|#<Double (anonymous)>|
500
- plain %| to respond to |
501
- expected %|:foo|
502
- plain %| with |
503
- expected %|any|
504
- plain %| keywords.|
505
- end
506
- },
507
- )
508
-
509
- expect(program).
510
- to produce_output_when_run(expected_output).
511
- in_color(color_enabled)
512
516
  end
513
517
  end
514
518
 
@@ -521,31 +525,31 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
521
525
 
522
526
  expect(B.new).not_to respond_to(:foo).with_any_keywords
523
527
  TEST
524
- program = make_plain_test_program(
525
- snippet,
526
- color_enabled: color_enabled,
527
- )
528
-
529
- expected_output = build_expected_output(
530
- color_enabled: color_enabled,
531
- snippet: %|expect(B.new).not_to respond_to(:foo).with_any_keywords|,
532
- expectation: proc {
533
- line do
534
- plain %|Expected |
535
- actual %|#<B>|
536
- plain %| not to respond to |
537
- expected %|:foo|
538
- plain %| with |
539
- expected %|any|
540
- plain %| keywords.|
541
- end
542
- },
543
- )
544
-
545
- expect(program).
546
- to produce_output_when_run(expected_output).
547
- removing_object_ids.
548
- in_color(color_enabled)
528
+ program =
529
+ make_plain_test_program(snippet, color_enabled: color_enabled)
530
+
531
+ expected_output =
532
+ build_expected_output(
533
+ color_enabled: color_enabled,
534
+ snippet:
535
+ "expect(B.new).not_to respond_to(:foo).with_any_keywords",
536
+ expectation:
537
+ proc do
538
+ line do
539
+ plain "Expected "
540
+ actual "#<B>"
541
+ plain " not to respond to "
542
+ expected ":foo"
543
+ plain " with "
544
+ expected "any"
545
+ plain " keywords."
546
+ end
547
+ end
548
+ )
549
+
550
+ expect(program).to produce_output_when_run(
551
+ expected_output
552
+ ).removing_object_ids.in_color(color_enabled)
549
553
  end
550
554
  end
551
555
  end
@@ -556,44 +560,45 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
556
560
  snippet = <<~TEST.strip
557
561
  expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :qux, :fizz, :buzz).with_any_keywords
558
562
  TEST
559
- program = make_plain_test_program(
560
- snippet,
561
- color_enabled: color_enabled,
563
+ program =
564
+ make_plain_test_program(snippet, color_enabled: color_enabled)
565
+
566
+ expected_output =
567
+ build_expected_output(
568
+ color_enabled: color_enabled,
569
+ snippet:
570
+ "expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :qux, :fizz, :buzz).with_any_keywords",
571
+ newline_before_expectation: true,
572
+ expectation:
573
+ proc do
574
+ line do
575
+ plain " Expected "
576
+ actual "#<Double :something_really_long>"
577
+ end
578
+
579
+ line do
580
+ plain "to respond to "
581
+ expected ":foo"
582
+ plain ", "
583
+ expected ":bar"
584
+ plain ", "
585
+ expected ":baz"
586
+ plain ", "
587
+ expected ":qux"
588
+ plain ", "
589
+ expected ":fizz"
590
+ plain " and "
591
+ expected ":buzz"
592
+ plain " with "
593
+ expected "any"
594
+ plain " keywords "
595
+ end
596
+ end
597
+ )
598
+
599
+ expect(program).to produce_output_when_run(expected_output).in_color(
600
+ color_enabled
562
601
  )
563
-
564
- expected_output = build_expected_output(
565
- color_enabled: color_enabled,
566
- snippet: %|expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz, :qux, :fizz, :buzz).with_any_keywords|,
567
- newline_before_expectation: true,
568
- expectation: proc {
569
- line do
570
- plain %| Expected |
571
- actual %|#<Double :something_really_long>|
572
- end
573
-
574
- line do
575
- plain %|to respond to |
576
- expected %|:foo|
577
- plain %|, |
578
- expected %|:bar|
579
- plain %|, |
580
- expected %|:baz|
581
- plain %|, |
582
- expected %|:qux|
583
- plain %|, |
584
- expected %|:fizz|
585
- plain %| and |
586
- expected %|:buzz|
587
- plain %| with |
588
- expected %|any|
589
- plain %| keywords |
590
- end
591
- },
592
- )
593
-
594
- expect(program).
595
- to produce_output_when_run(expected_output).
596
- in_color(color_enabled)
597
602
  end
598
603
  end
599
604
 
@@ -607,37 +612,37 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
607
612
 
608
613
  expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_any_keywords
609
614
  TEST
610
- program = make_plain_test_program(
611
- snippet,
612
- color_enabled: color_enabled,
613
- )
614
-
615
- expected_output = build_expected_output(
616
- color_enabled: color_enabled,
617
- snippet: %|expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_any_keywords|,
618
- newline_before_expectation: true,
619
- expectation: proc {
620
- line do
621
- plain %| Expected |
622
- actual %|#<B>|
623
- end
624
-
625
- line do
626
- plain %|not to respond to |
627
- expected %|:some_really_long_method_and_stuff|
628
- plain %| and |
629
- expected %|:another_method_or_whatever|
630
- plain %| with |
631
- expected %|any|
632
- plain %| keywords |
633
- end
634
- },
635
- )
636
-
637
- expect(program).
638
- to produce_output_when_run(expected_output).
639
- removing_object_ids.
640
- in_color(color_enabled)
615
+ program =
616
+ make_plain_test_program(snippet, color_enabled: color_enabled)
617
+
618
+ expected_output =
619
+ build_expected_output(
620
+ color_enabled: color_enabled,
621
+ snippet:
622
+ "expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_any_keywords",
623
+ newline_before_expectation: true,
624
+ expectation:
625
+ proc do
626
+ line do
627
+ plain " Expected "
628
+ actual "#<B>"
629
+ end
630
+
631
+ line do
632
+ plain "not to respond to "
633
+ expected ":some_really_long_method_and_stuff"
634
+ plain " and "
635
+ expected ":another_method_or_whatever"
636
+ plain " with "
637
+ expected "any"
638
+ plain " keywords "
639
+ end
640
+ end
641
+ )
642
+
643
+ expect(program).to produce_output_when_run(
644
+ expected_output
645
+ ).removing_object_ids.in_color(color_enabled)
641
646
  end
642
647
  end
643
648
  end
@@ -650,30 +655,31 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
650
655
  snippet = <<~TEST.strip
651
656
  expect(double).to respond_to(:foo).with_unlimited_arguments
652
657
  TEST
653
- program = make_plain_test_program(
654
- snippet,
655
- color_enabled: color_enabled,
656
- )
657
-
658
- expected_output = build_expected_output(
659
- color_enabled: color_enabled,
660
- snippet: %|expect(double).to respond_to(:foo).with_unlimited_arguments|,
661
- expectation: proc {
662
- line do
663
- plain %|Expected |
664
- actual %|#<Double (anonymous)>|
665
- plain %| to respond to |
666
- expected %|:foo|
667
- plain %| with |
668
- expected %|unlimited|
669
- plain %| arguments.|
670
- end
671
- },
658
+ program =
659
+ make_plain_test_program(snippet, color_enabled: color_enabled)
660
+
661
+ expected_output =
662
+ build_expected_output(
663
+ color_enabled: color_enabled,
664
+ snippet:
665
+ "expect(double).to respond_to(:foo).with_unlimited_arguments",
666
+ expectation:
667
+ proc do
668
+ line do
669
+ plain "Expected "
670
+ actual "#<Double (anonymous)>"
671
+ plain " to respond to "
672
+ expected ":foo"
673
+ plain " with "
674
+ expected "unlimited"
675
+ plain " arguments."
676
+ end
677
+ end
678
+ )
679
+
680
+ expect(program).to produce_output_when_run(expected_output).in_color(
681
+ color_enabled
672
682
  )
673
-
674
- expect(program).
675
- to produce_output_when_run(expected_output).
676
- in_color(color_enabled)
677
683
  end
678
684
  end
679
685
 
@@ -686,31 +692,31 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
686
692
 
687
693
  expect(B.new).not_to respond_to(:foo).with_unlimited_arguments
688
694
  TEST
689
- program = make_plain_test_program(
690
- snippet,
691
- color_enabled: color_enabled,
692
- )
693
-
694
- expected_output = build_expected_output(
695
- color_enabled: color_enabled,
696
- snippet: %|expect(B.new).not_to respond_to(:foo).with_unlimited_arguments|,
697
- expectation: proc {
698
- line do
699
- plain %|Expected |
700
- actual %|#<B>|
701
- plain %| not to respond to |
702
- expected %|:foo|
703
- plain %| with |
704
- expected %|unlimited|
705
- plain %| arguments.|
706
- end
707
- },
708
- )
709
-
710
- expect(program).
711
- to produce_output_when_run(expected_output).
712
- removing_object_ids.
713
- in_color(color_enabled)
695
+ program =
696
+ make_plain_test_program(snippet, color_enabled: color_enabled)
697
+
698
+ expected_output =
699
+ build_expected_output(
700
+ color_enabled: color_enabled,
701
+ snippet:
702
+ "expect(B.new).not_to respond_to(:foo).with_unlimited_arguments",
703
+ expectation:
704
+ proc do
705
+ line do
706
+ plain "Expected "
707
+ actual "#<B>"
708
+ plain " not to respond to "
709
+ expected ":foo"
710
+ plain " with "
711
+ expected "unlimited"
712
+ plain " arguments."
713
+ end
714
+ end
715
+ )
716
+
717
+ expect(program).to produce_output_when_run(
718
+ expected_output
719
+ ).removing_object_ids.in_color(color_enabled)
714
720
  end
715
721
  end
716
722
  end
@@ -721,38 +727,39 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
721
727
  snippet = <<~TEST.strip
722
728
  expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_unlimited_arguments
723
729
  TEST
724
- program = make_plain_test_program(
725
- snippet,
726
- color_enabled: color_enabled,
727
- )
728
-
729
- expected_output = build_expected_output(
730
- color_enabled: color_enabled,
731
- snippet: %|expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_unlimited_arguments|,
732
- newline_before_expectation: true,
733
- expectation: proc {
734
- line do
735
- plain %| Expected |
736
- actual %|#<Double :something_really_long>|
737
- end
738
-
739
- line do
740
- plain %|to respond to |
741
- expected %|:foo|
742
- plain %|, |
743
- expected %|:bar|
744
- plain %| and |
745
- expected %|:baz|
746
- plain %| with |
747
- expected %|unlimited|
748
- plain %| arguments|
749
- end
750
- },
730
+ program =
731
+ make_plain_test_program(snippet, color_enabled: color_enabled)
732
+
733
+ expected_output =
734
+ build_expected_output(
735
+ color_enabled: color_enabled,
736
+ snippet:
737
+ "expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_unlimited_arguments",
738
+ newline_before_expectation: true,
739
+ expectation:
740
+ proc do
741
+ line do
742
+ plain " Expected "
743
+ actual "#<Double :something_really_long>"
744
+ end
745
+
746
+ line do
747
+ plain "to respond to "
748
+ expected ":foo"
749
+ plain ", "
750
+ expected ":bar"
751
+ plain " and "
752
+ expected ":baz"
753
+ plain " with "
754
+ expected "unlimited"
755
+ plain " arguments"
756
+ end
757
+ end
758
+ )
759
+
760
+ expect(program).to produce_output_when_run(expected_output).in_color(
761
+ color_enabled
751
762
  )
752
-
753
- expect(program).
754
- to produce_output_when_run(expected_output).
755
- in_color(color_enabled)
756
763
  end
757
764
  end
758
765
 
@@ -766,37 +773,37 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
766
773
 
767
774
  expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_unlimited_arguments
768
775
  TEST
769
- program = make_plain_test_program(
770
- snippet,
771
- color_enabled: color_enabled,
772
- )
773
-
774
- expected_output = build_expected_output(
775
- color_enabled: color_enabled,
776
- snippet: %|expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_unlimited_arguments|,
777
- newline_before_expectation: true,
778
- expectation: proc {
779
- line do
780
- plain %| Expected |
781
- actual %|#<B>|
782
- end
783
-
784
- line do
785
- plain %|not to respond to |
786
- expected %|:some_really_long_method_and_stuff|
787
- plain %| and |
788
- expected %|:another_method_or_whatever|
789
- plain %| with |
790
- expected %|unlimited|
791
- plain %| arguments|
792
- end
793
- },
794
- )
795
-
796
- expect(program).
797
- to produce_output_when_run(expected_output).
798
- removing_object_ids.
799
- in_color(color_enabled)
776
+ program =
777
+ make_plain_test_program(snippet, color_enabled: color_enabled)
778
+
779
+ expected_output =
780
+ build_expected_output(
781
+ color_enabled: color_enabled,
782
+ snippet:
783
+ "expect(B.new).not_to respond_to(:some_really_long_method_and_stuff, :another_method_or_whatever).with_unlimited_arguments",
784
+ newline_before_expectation: true,
785
+ expectation:
786
+ proc do
787
+ line do
788
+ plain " Expected "
789
+ actual "#<B>"
790
+ end
791
+
792
+ line do
793
+ plain "not to respond to "
794
+ expected ":some_really_long_method_and_stuff"
795
+ plain " and "
796
+ expected ":another_method_or_whatever"
797
+ plain " with "
798
+ expected "unlimited"
799
+ plain " arguments"
800
+ end
801
+ end
802
+ )
803
+
804
+ expect(program).to produce_output_when_run(
805
+ expected_output
806
+ ).removing_object_ids.in_color(color_enabled)
800
807
  end
801
808
  end
802
809
  end
@@ -808,40 +815,40 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
808
815
  snippet = <<~TEST.strip
809
816
  expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_any_keywords.with_unlimited_arguments
810
817
  TEST
811
- program = make_plain_test_program(
812
- snippet,
813
- color_enabled: color_enabled,
814
- )
818
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
815
819
 
816
- expected_output = build_expected_output(
817
- color_enabled: color_enabled,
818
- snippet: %|expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_any_keywords.with_unlimited_arguments|,
819
- newline_before_expectation: true,
820
- expectation: proc {
821
- line do
822
- plain %| Expected |
823
- actual %|#<Double :something_really_long>|
824
- end
820
+ expected_output =
821
+ build_expected_output(
822
+ color_enabled: color_enabled,
823
+ snippet:
824
+ "expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_any_keywords.with_unlimited_arguments",
825
+ newline_before_expectation: true,
826
+ expectation:
827
+ proc do
828
+ line do
829
+ plain " Expected "
830
+ actual "#<Double :something_really_long>"
831
+ end
832
+
833
+ line do
834
+ plain "to respond to "
835
+ expected ":foo"
836
+ plain ", "
837
+ expected ":bar"
838
+ plain " and "
839
+ expected ":baz"
840
+ plain " with "
841
+ expected "any"
842
+ plain " keywords and "
843
+ expected "unlimited"
844
+ plain " arguments"
845
+ end
846
+ end
847
+ )
825
848
 
826
- line do
827
- plain %|to respond to |
828
- expected %|:foo|
829
- plain %|, |
830
- expected %|:bar|
831
- plain %| and |
832
- expected %|:baz|
833
- plain %| with |
834
- expected %|any|
835
- plain %| keywords and |
836
- expected %|unlimited|
837
- plain %| arguments|
838
- end
839
- },
849
+ expect(program).to produce_output_when_run(expected_output).in_color(
850
+ color_enabled
840
851
  )
841
-
842
- expect(program).
843
- to produce_output_when_run(expected_output).
844
- in_color(color_enabled)
845
852
  end
846
853
  end
847
854
 
@@ -856,41 +863,40 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
856
863
 
857
864
  expect(B.new).not_to respond_to(:foo, :bar, :baz).with_any_keywords.with_unlimited_arguments
858
865
  TEST
859
- program = make_plain_test_program(
860
- snippet,
861
- color_enabled: color_enabled,
862
- )
863
-
864
- expected_output = build_expected_output(
865
- color_enabled: color_enabled,
866
- snippet: %|expect(B.new).not_to respond_to(:foo, :bar, :baz).with_any_keywords.with_unlimited_arguments|,
867
- newline_before_expectation: true,
868
- expectation: proc {
869
- line do
870
- plain %| Expected |
871
- actual %|#<B>|
872
- end
866
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
873
867
 
874
- line do
875
- plain %|not to respond to |
876
- expected %|:foo|
877
- plain %|, |
878
- expected %|:bar|
879
- plain %| and |
880
- expected %|:baz|
881
- plain %| with |
882
- expected %|any|
883
- plain %| keywords and |
884
- expected %|unlimited|
885
- plain %| arguments|
886
- end
887
- },
888
- )
868
+ expected_output =
869
+ build_expected_output(
870
+ color_enabled: color_enabled,
871
+ snippet:
872
+ "expect(B.new).not_to respond_to(:foo, :bar, :baz).with_any_keywords.with_unlimited_arguments",
873
+ newline_before_expectation: true,
874
+ expectation:
875
+ proc do
876
+ line do
877
+ plain " Expected "
878
+ actual "#<B>"
879
+ end
880
+
881
+ line do
882
+ plain "not to respond to "
883
+ expected ":foo"
884
+ plain ", "
885
+ expected ":bar"
886
+ plain " and "
887
+ expected ":baz"
888
+ plain " with "
889
+ expected "any"
890
+ plain " keywords and "
891
+ expected "unlimited"
892
+ plain " arguments"
893
+ end
894
+ end
895
+ )
889
896
 
890
- expect(program).
891
- to produce_output_when_run(expected_output).
892
- removing_object_ids.
893
- in_color(color_enabled)
897
+ expect(program).to produce_output_when_run(
898
+ expected_output
899
+ ).removing_object_ids.in_color(color_enabled)
894
900
  end
895
901
  end
896
902
  end
@@ -901,42 +907,42 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
901
907
  snippet = <<~TEST.strip
902
908
  expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_keywords(:qux, :blargh).with_unlimited_arguments
903
909
  TEST
904
- program = make_plain_test_program(
905
- snippet,
906
- color_enabled: color_enabled,
907
- )
910
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
908
911
 
909
- expected_output = build_expected_output(
910
- color_enabled: color_enabled,
911
- snippet: %|expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_keywords(:qux, :blargh).with_unlimited_arguments|,
912
- newline_before_expectation: true,
913
- expectation: proc {
914
- line do
915
- plain %| Expected |
916
- actual %|#<Double :something_really_long>|
917
- end
912
+ expected_output =
913
+ build_expected_output(
914
+ color_enabled: color_enabled,
915
+ snippet:
916
+ "expect(double(:something_really_long)).to respond_to(:foo, :bar, :baz).with_keywords(:qux, :blargh).with_unlimited_arguments",
917
+ newline_before_expectation: true,
918
+ expectation:
919
+ proc do
920
+ line do
921
+ plain " Expected "
922
+ actual "#<Double :something_really_long>"
923
+ end
924
+
925
+ line do
926
+ plain "to respond to "
927
+ expected ":foo"
928
+ plain ", "
929
+ expected ":bar"
930
+ plain " and "
931
+ expected ":baz"
932
+ plain " with keywords "
933
+ expected ":qux"
934
+ plain " and "
935
+ expected ":blargh"
936
+ plain " and "
937
+ expected "unlimited"
938
+ plain " arguments"
939
+ end
940
+ end
941
+ )
918
942
 
919
- line do
920
- plain %|to respond to |
921
- expected %|:foo|
922
- plain %|, |
923
- expected %|:bar|
924
- plain %| and |
925
- expected %|:baz|
926
- plain %| with keywords |
927
- expected %|:qux|
928
- plain %| and |
929
- expected %|:blargh|
930
- plain %| and |
931
- expected %|unlimited|
932
- plain %| arguments|
933
- end
934
- },
943
+ expect(program).to produce_output_when_run(expected_output).in_color(
944
+ color_enabled
935
945
  )
936
-
937
- expect(program).
938
- to produce_output_when_run(expected_output).
939
- in_color(color_enabled)
940
946
  end
941
947
  end
942
948
 
@@ -951,43 +957,42 @@ RSpec.describe "Integration with RSpec's #respond_to matcher", type: :integratio
951
957
 
952
958
  expect(B.new).not_to respond_to(:foo, :bar, :baz).with_keywords(:qux, :blargh).with_unlimited_arguments
953
959
  TEST
954
- program = make_plain_test_program(
955
- snippet,
956
- color_enabled: color_enabled,
957
- )
958
-
959
- expected_output = build_expected_output(
960
- color_enabled: color_enabled,
961
- snippet: %|expect(B.new).not_to respond_to(:foo, :bar, :baz).with_keywords(:qux, :blargh).with_unlimited_arguments|,
962
- newline_before_expectation: true,
963
- expectation: proc {
964
- line do
965
- plain %| Expected |
966
- actual %|#<B>|
967
- end
960
+ program = make_plain_test_program(snippet, color_enabled: color_enabled)
968
961
 
969
- line do
970
- plain %|not to respond to |
971
- expected %|:foo|
972
- plain %|, |
973
- expected %|:bar|
974
- plain %| and |
975
- expected %|:baz|
976
- plain %| with keywords |
977
- expected %|:qux|
978
- plain %| and |
979
- expected %|:blargh|
980
- plain %| and |
981
- expected %|unlimited|
982
- plain %| arguments|
983
- end
984
- },
985
- )
962
+ expected_output =
963
+ build_expected_output(
964
+ color_enabled: color_enabled,
965
+ snippet:
966
+ "expect(B.new).not_to respond_to(:foo, :bar, :baz).with_keywords(:qux, :blargh).with_unlimited_arguments",
967
+ newline_before_expectation: true,
968
+ expectation:
969
+ proc do
970
+ line do
971
+ plain " Expected "
972
+ actual "#<B>"
973
+ end
974
+
975
+ line do
976
+ plain "not to respond to "
977
+ expected ":foo"
978
+ plain ", "
979
+ expected ":bar"
980
+ plain " and "
981
+ expected ":baz"
982
+ plain " with keywords "
983
+ expected ":qux"
984
+ plain " and "
985
+ expected ":blargh"
986
+ plain " and "
987
+ expected "unlimited"
988
+ plain " arguments"
989
+ end
990
+ end
991
+ )
986
992
 
987
- expect(program).
988
- to produce_output_when_run(expected_output).
989
- removing_object_ids.
990
- in_color(color_enabled)
993
+ expect(program).to produce_output_when_run(
994
+ expected_output
995
+ ).removing_object_ids.in_color(color_enabled)
991
996
  end
992
997
  end
993
998
  end