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,6 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integration do
3
+ RSpec.describe "Integration with RSpec's #raise_error matcher",
4
+ type: :integration do
4
5
  context "given only an exception class" do
5
6
  context "when used in the positive" do
6
7
  context "when the block raises a different error than what is given" do
@@ -10,28 +11,29 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
10
11
  snippet = <<~TEST.strip
11
12
  expect { raise StandardError.new('boo') }.to raise_error(RuntimeError)
12
13
  TEST
13
- program = make_plain_test_program(
14
- snippet,
15
- color_enabled: color_enabled,
16
- )
14
+ program =
15
+ make_plain_test_program(snippet, color_enabled: color_enabled)
17
16
 
18
- expected_output = build_expected_output(
19
- color_enabled: color_enabled,
20
- snippet: %|expect { raise StandardError.new('boo') }.to raise_error(RuntimeError)|,
21
- expectation: proc {
22
- line do
23
- plain %|Expected raised exception |
24
- actual %|#<StandardError "boo">|
25
- plain %| to match |
26
- expected %|#<RuntimeError>|
27
- plain %|.|
28
- end
29
- },
30
- )
17
+ expected_output =
18
+ build_expected_output(
19
+ color_enabled: color_enabled,
20
+ snippet:
21
+ "expect { raise StandardError.new('boo') }.to raise_error(RuntimeError)",
22
+ expectation:
23
+ proc do
24
+ line do
25
+ plain "Expected raised exception "
26
+ actual %|#<StandardError "boo">|
27
+ plain " to match "
28
+ expected "#<RuntimeError>"
29
+ plain "."
30
+ end
31
+ end
32
+ )
31
33
 
32
- expect(program).
33
- to produce_output_when_run(expected_output).
34
- in_color(color_enabled)
34
+ expect(program).to produce_output_when_run(
35
+ expected_output
36
+ ).in_color(color_enabled)
35
37
  end
36
38
  end
37
39
  end
@@ -42,31 +44,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
42
44
  snippet = <<~TEST.strip
43
45
  expect { raise StandardError.new('this is a super super super long message') }.to raise_error(RuntimeError)
44
46
  TEST
45
- program = make_plain_test_program(
46
- snippet,
47
- color_enabled: color_enabled,
48
- )
47
+ program =
48
+ make_plain_test_program(snippet, color_enabled: color_enabled)
49
49
 
50
- expected_output = build_expected_output(
51
- color_enabled: color_enabled,
52
- snippet: %|expect { raise StandardError.new('this is a super super super long message') }.to raise_error(RuntimeError)|,
53
- newline_before_expectation: true,
54
- expectation: proc {
55
- line do
56
- plain %|Expected raised exception |
57
- actual %|#<StandardError "this is a super super super long message">|
58
- end
59
-
60
- line do
61
- plain %| to match |
62
- expected %|#<RuntimeError>|
63
- end
64
- },
65
- )
50
+ expected_output =
51
+ build_expected_output(
52
+ color_enabled: color_enabled,
53
+ snippet:
54
+ "expect { raise StandardError.new('this is a super super super long message') }.to raise_error(RuntimeError)",
55
+ newline_before_expectation: true,
56
+ expectation:
57
+ proc do
58
+ line do
59
+ plain "Expected raised exception "
60
+ actual %|#<StandardError "this is a super super super long message">|
61
+ end
62
+
63
+ line do
64
+ plain " to match "
65
+ expected "#<RuntimeError>"
66
+ end
67
+ end
68
+ )
66
69
 
67
- expect(program).
68
- to produce_output_when_run(expected_output).
69
- in_color(color_enabled)
70
+ expect(program).to produce_output_when_run(
71
+ expected_output
72
+ ).in_color(color_enabled)
70
73
  end
71
74
  end
72
75
  end
@@ -78,26 +81,26 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
78
81
  snippet = <<~TEST.strip
79
82
  expect { }.to raise_error(RuntimeError)
80
83
  TEST
81
- program = make_plain_test_program(
82
- snippet,
83
- color_enabled: color_enabled,
84
- )
85
-
86
- expected_output = build_expected_output(
87
- color_enabled: color_enabled,
88
- snippet: %|expect { }.to raise_error(RuntimeError)|,
89
- expectation: proc {
90
- line do
91
- plain %|Expected block to raise error |
92
- expected %|#<RuntimeError>|
93
- plain %|.|
94
- end
95
- },
96
- )
97
-
98
- expect(program).
99
- to produce_output_when_run(expected_output).
100
- in_color(color_enabled)
84
+ program =
85
+ make_plain_test_program(snippet, color_enabled: color_enabled)
86
+
87
+ expected_output =
88
+ build_expected_output(
89
+ color_enabled: color_enabled,
90
+ snippet: "expect { }.to raise_error(RuntimeError)",
91
+ expectation:
92
+ proc do
93
+ line do
94
+ plain "Expected block to raise error "
95
+ expected "#<RuntimeError>"
96
+ plain "."
97
+ end
98
+ end
99
+ )
100
+
101
+ expect(program).to produce_output_when_run(
102
+ expected_output
103
+ ).in_color(color_enabled)
101
104
  end
102
105
  end
103
106
  end
@@ -110,28 +113,29 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
110
113
  snippet = <<~TEST.strip
111
114
  expect { raise StandardError.new('boo') }.not_to raise_error(StandardError)
112
115
  TEST
113
- program = make_plain_test_program(
114
- snippet,
115
- color_enabled: color_enabled,
116
- )
117
-
118
- expected_output = build_expected_output(
119
- color_enabled: color_enabled,
120
- snippet: %|expect { raise StandardError.new('boo') }.not_to raise_error(StandardError)|,
121
- expectation: proc {
122
- line do
123
- plain %|Expected raised exception |
124
- actual %|#<StandardError "boo">|
125
- plain %| not to match |
126
- expected %|#<StandardError>|
127
- plain %|.|
128
- end
129
- },
130
- )
131
-
132
- expect(program).
133
- to produce_output_when_run(expected_output).
134
- in_color(color_enabled)
116
+ program =
117
+ make_plain_test_program(snippet, color_enabled: color_enabled)
118
+
119
+ expected_output =
120
+ build_expected_output(
121
+ color_enabled: color_enabled,
122
+ snippet:
123
+ "expect { raise StandardError.new('boo') }.not_to raise_error(StandardError)",
124
+ expectation:
125
+ proc do
126
+ line do
127
+ plain "Expected raised exception "
128
+ actual %|#<StandardError "boo">|
129
+ plain " not to match "
130
+ expected "#<StandardError>"
131
+ plain "."
132
+ end
133
+ end
134
+ )
135
+
136
+ expect(program).to produce_output_when_run(
137
+ expected_output
138
+ ).in_color(color_enabled)
135
139
  end
136
140
  end
137
141
  end
@@ -142,31 +146,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
142
146
  snippet = <<~TEST.strip
143
147
  expect { raise StandardError.new('this is a super super long message') }.not_to raise_error(StandardError)
144
148
  TEST
145
- program = make_plain_test_program(
146
- snippet,
147
- color_enabled: color_enabled,
148
- )
149
-
150
- expected_output = build_expected_output(
151
- color_enabled: color_enabled,
152
- snippet: %|expect { raise StandardError.new('this is a super super long message') }.not_to raise_error(StandardError)|,
153
- newline_before_expectation: true,
154
- expectation: proc {
155
- line do
156
- plain %|Expected raised exception |
157
- actual %|#<StandardError "this is a super super long message">|
158
- end
159
-
160
- line do
161
- plain %| not to match |
162
- expected %|#<StandardError>|
163
- end
164
- },
165
- )
166
-
167
- expect(program).
168
- to produce_output_when_run(expected_output).
169
- in_color(color_enabled)
149
+ program =
150
+ make_plain_test_program(snippet, color_enabled: color_enabled)
151
+
152
+ expected_output =
153
+ build_expected_output(
154
+ color_enabled: color_enabled,
155
+ snippet:
156
+ "expect { raise StandardError.new('this is a super super long message') }.not_to raise_error(StandardError)",
157
+ newline_before_expectation: true,
158
+ expectation:
159
+ proc do
160
+ line do
161
+ plain "Expected raised exception "
162
+ actual %|#<StandardError "this is a super super long message">|
163
+ end
164
+
165
+ line do
166
+ plain " not to match "
167
+ expected "#<StandardError>"
168
+ end
169
+ end
170
+ )
171
+
172
+ expect(program).to produce_output_when_run(
173
+ expected_output
174
+ ).in_color(color_enabled)
170
175
  end
171
176
  end
172
177
  end
@@ -182,28 +187,28 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
182
187
  snippet = <<~TEST.strip
183
188
  expect { raise 'boo' }.to raise_error('hell')
184
189
  TEST
185
- program = make_plain_test_program(
186
- snippet,
187
- color_enabled: color_enabled,
188
- )
190
+ program =
191
+ make_plain_test_program(snippet, color_enabled: color_enabled)
189
192
 
190
- expected_output = build_expected_output(
191
- color_enabled: color_enabled,
192
- snippet: %|expect { raise 'boo' }.to raise_error('hell')|,
193
- expectation: proc {
194
- line do
195
- plain %|Expected raised exception |
196
- actual %|#<RuntimeError "boo">|
197
- plain %| to match |
198
- expected %|#<Exception "hell">|
199
- plain %|.|
200
- end
201
- },
202
- )
193
+ expected_output =
194
+ build_expected_output(
195
+ color_enabled: color_enabled,
196
+ snippet: "expect { raise 'boo' }.to raise_error('hell')",
197
+ expectation:
198
+ proc do
199
+ line do
200
+ plain "Expected raised exception "
201
+ actual %|#<RuntimeError "boo">|
202
+ plain " to match "
203
+ expected %|#<Exception "hell">|
204
+ plain "."
205
+ end
206
+ end
207
+ )
203
208
 
204
- expect(program).
205
- to produce_output_when_run(expected_output).
206
- in_color(color_enabled)
209
+ expect(program).to produce_output_when_run(
210
+ expected_output
211
+ ).in_color(color_enabled)
207
212
  end
208
213
  end
209
214
  end
@@ -217,31 +222,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
217
222
  expected_message = "whatever"
218
223
  expect { raise(actual_message) }.to raise_error(expected_message)
219
224
  TEST
220
- program = make_plain_test_program(
221
- snippet,
222
- color_enabled: color_enabled,
223
- )
224
-
225
- expected_output = build_expected_output(
226
- color_enabled: color_enabled,
227
- snippet: %|expect { raise(actual_message) }.to raise_error(expected_message)|,
228
- newline_before_expectation: true,
229
- expectation: proc {
230
- line do
231
- plain %|Expected raised exception |
232
- actual %|#<RuntimeError "some really really really long message">|
233
- end
234
-
235
- line do
236
- plain %| to match |
237
- expected %|#<Exception "whatever">|
238
- end
239
- },
240
- )
241
-
242
- expect(program).
243
- to produce_output_when_run(expected_output).
244
- in_color(color_enabled)
225
+ program =
226
+ make_plain_test_program(snippet, color_enabled: color_enabled)
227
+
228
+ expected_output =
229
+ build_expected_output(
230
+ color_enabled: color_enabled,
231
+ snippet:
232
+ "expect { raise(actual_message) }.to raise_error(expected_message)",
233
+ newline_before_expectation: true,
234
+ expectation:
235
+ proc do
236
+ line do
237
+ plain "Expected raised exception "
238
+ actual %|#<RuntimeError "some really really really long message">|
239
+ end
240
+
241
+ line do
242
+ plain " to match "
243
+ expected %|#<Exception "whatever">|
244
+ end
245
+ end
246
+ )
247
+
248
+ expect(program).to produce_output_when_run(
249
+ expected_output
250
+ ).in_color(color_enabled)
245
251
  end
246
252
  end
247
253
  end
@@ -260,35 +266,37 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
260
266
  MESSAGE
261
267
  expect { raise(actual_message) }.to raise_error(expected_message)
262
268
  TEST
263
- program = make_plain_test_program(
264
- snippet,
265
- color_enabled: color_enabled,
266
- )
267
-
268
- expected_output = build_expected_output(
269
- color_enabled: color_enabled,
270
- snippet: %|expect { raise(actual_message) }.to raise_error(expected_message)|,
271
- expectation: proc {
272
- line do
273
- plain %|Expected raised exception |
274
- actual %|#<RuntimeError "This is fun\\nSo is this">|
275
- end
276
-
277
- line do
278
- plain %| to match |
279
- expected %|#<Exception "This is fun\\nAnd so is this">|
280
- end
281
- },
282
- diff: proc {
283
- plain_line %| This is fun\\n|
284
- expected_line %|- And so is this|
285
- actual_line %|+ So is this|
286
- },
287
- )
288
-
289
- expect(program).
290
- to produce_output_when_run(expected_output).
291
- in_color(color_enabled)
269
+ program =
270
+ make_plain_test_program(snippet, color_enabled: color_enabled)
271
+
272
+ expected_output =
273
+ build_expected_output(
274
+ color_enabled: color_enabled,
275
+ snippet:
276
+ "expect { raise(actual_message) }.to raise_error(expected_message)",
277
+ expectation:
278
+ proc do
279
+ line do
280
+ plain "Expected raised exception "
281
+ actual %|#<RuntimeError "This is fun\\nSo is this">|
282
+ end
283
+
284
+ line do
285
+ plain " to match "
286
+ expected %|#<Exception "This is fun\\nAnd so is this">|
287
+ end
288
+ end,
289
+ diff:
290
+ proc do
291
+ plain_line %| This is fun\\n|
292
+ expected_line "- And so is this"
293
+ actual_line "+ So is this"
294
+ end
295
+ )
296
+
297
+ expect(program).to produce_output_when_run(
298
+ expected_output
299
+ ).in_color(color_enabled)
292
300
  end
293
301
  end
294
302
  end
@@ -302,29 +310,28 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
302
310
  snippet = <<~TEST.strip
303
311
  expect { }.to raise_error('hell')
304
312
  TEST
305
- program = make_plain_test_program(
306
- snippet,
307
- color_enabled: color_enabled,
308
- )
313
+ program =
314
+ make_plain_test_program(snippet, color_enabled: color_enabled)
309
315
 
310
- expected_output = build_expected_output(
311
- color_enabled: color_enabled,
312
- snippet: %|expect { }.to raise_error('hell')|,
313
- expectation: proc {
314
- line do
315
- plain %|Expected block to raise error |
316
- expected %|#<Exception "hell">|
317
- plain %|.|
318
- end
319
- },
320
- )
316
+ expected_output =
317
+ build_expected_output(
318
+ color_enabled: color_enabled,
319
+ snippet: "expect { }.to raise_error('hell')",
320
+ expectation:
321
+ proc do
322
+ line do
323
+ plain "Expected block to raise error "
324
+ expected %|#<Exception "hell">|
325
+ plain "."
326
+ end
327
+ end
328
+ )
321
329
 
322
- expect(program).
323
- to produce_output_when_run(expected_output).
324
- in_color(color_enabled)
330
+ expect(program).to produce_output_when_run(
331
+ expected_output
332
+ ).in_color(color_enabled)
325
333
  end
326
334
  end
327
-
328
335
  end
329
336
 
330
337
  context "when the message is long" do
@@ -334,31 +341,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
334
341
  snippet = <<~TEST.strip
335
342
  expect { }.to raise_error("this is a super super super super super super long message")
336
343
  TEST
337
- program = make_plain_test_program(
338
- snippet,
339
- color_enabled: color_enabled,
340
- )
341
-
342
- expected_output = build_expected_output(
343
- color_enabled: color_enabled,
344
- snippet: %|expect { }.to raise_error("this is a super super super super super super long message")|,
345
- newline_before_expectation: true,
346
- expectation: proc {
347
- line do
348
- plain %| Expected |
349
- plain %|block|
350
- end
351
-
352
- line do
353
- plain %|to raise error |
354
- expected %|#<Exception "this is a super super super super super super long message">|
355
- end
356
- },
357
- )
358
-
359
- expect(program).
360
- to produce_output_when_run(expected_output).
361
- in_color(color_enabled)
344
+ program =
345
+ make_plain_test_program(snippet, color_enabled: color_enabled)
346
+
347
+ expected_output =
348
+ build_expected_output(
349
+ color_enabled: color_enabled,
350
+ snippet:
351
+ %|expect { }.to raise_error("this is a super super super super super super long message")|,
352
+ newline_before_expectation: true,
353
+ expectation:
354
+ proc do
355
+ line do
356
+ plain " Expected "
357
+ plain "block"
358
+ end
359
+
360
+ line do
361
+ plain "to raise error "
362
+ expected %|#<Exception "this is a super super super super super super long message">|
363
+ end
364
+ end
365
+ )
366
+
367
+ expect(program).to produce_output_when_run(
368
+ expected_output
369
+ ).in_color(color_enabled)
362
370
  end
363
371
  end
364
372
  end
@@ -370,31 +378,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
370
378
  message = "some really long message"
371
379
  expect { raise(message) }.not_to raise_error(message)
372
380
  TEST
373
- program = make_plain_test_program(
374
- snippet,
375
- color_enabled: color_enabled,
376
- )
377
-
378
- expected_output = build_expected_output(
379
- color_enabled: color_enabled,
380
- snippet: %|expect { raise(message) }.not_to raise_error(message)|,
381
- newline_before_expectation: true,
382
- expectation: proc {
383
- line do
384
- plain %|Expected raised exception |
385
- actual %|#<RuntimeError "some really long message">|
386
- end
387
-
388
- line do
389
- plain %| not to match |
390
- expected %|#<Exception "some really long message">|
391
- end
392
- },
393
- )
394
-
395
- expect(program).
396
- to produce_output_when_run(expected_output).
397
- in_color(color_enabled)
381
+ program =
382
+ make_plain_test_program(snippet, color_enabled: color_enabled)
383
+
384
+ expected_output =
385
+ build_expected_output(
386
+ color_enabled: color_enabled,
387
+ snippet:
388
+ "expect { raise(message) }.not_to raise_error(message)",
389
+ newline_before_expectation: true,
390
+ expectation:
391
+ proc do
392
+ line do
393
+ plain "Expected raised exception "
394
+ actual %|#<RuntimeError "some really long message">|
395
+ end
396
+
397
+ line do
398
+ plain " not to match "
399
+ expected %|#<Exception "some really long message">|
400
+ end
401
+ end
402
+ )
403
+
404
+ expect(program).to produce_output_when_run(
405
+ expected_output
406
+ ).in_color(color_enabled)
398
407
  end
399
408
  end
400
409
  end
@@ -409,28 +418,28 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
409
418
  snippet = <<~TEST.strip
410
419
  expect { raise 'boo' }.not_to raise_error('boo')
411
420
  TEST
412
- program = make_plain_test_program(
413
- snippet,
414
- color_enabled: color_enabled,
415
- )
416
-
417
- expected_output = build_expected_output(
418
- color_enabled: color_enabled,
419
- snippet: %|expect { raise 'boo' }.not_to raise_error('boo')|,
420
- expectation: proc {
421
- line do
422
- plain %|Expected raised exception |
423
- actual %|#<RuntimeError "boo">|
424
- plain %| not to match |
425
- expected %|#<Exception "boo">|
426
- plain %|.|
427
- end
428
- },
429
- )
430
-
431
- expect(program).
432
- to produce_output_when_run(expected_output).
433
- in_color(color_enabled)
421
+ program =
422
+ make_plain_test_program(snippet, color_enabled: color_enabled)
423
+
424
+ expected_output =
425
+ build_expected_output(
426
+ color_enabled: color_enabled,
427
+ snippet: "expect { raise 'boo' }.not_to raise_error('boo')",
428
+ expectation:
429
+ proc do
430
+ line do
431
+ plain "Expected raised exception "
432
+ actual %|#<RuntimeError "boo">|
433
+ plain " not to match "
434
+ expected %|#<Exception "boo">|
435
+ plain "."
436
+ end
437
+ end
438
+ )
439
+
440
+ expect(program).to produce_output_when_run(
441
+ expected_output
442
+ ).in_color(color_enabled)
434
443
  end
435
444
  end
436
445
  end
@@ -443,31 +452,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
443
452
  message = "some really long message"
444
453
  expect { raise(message) }.not_to raise_error(message)
445
454
  TEST
446
- program = make_plain_test_program(
447
- snippet,
448
- color_enabled: color_enabled,
449
- )
455
+ program =
456
+ make_plain_test_program(snippet, color_enabled: color_enabled)
450
457
 
451
- expected_output = build_expected_output(
452
- color_enabled: color_enabled,
453
- snippet: %|expect { raise(message) }.not_to raise_error(message)|,
454
- newline_before_expectation: true,
455
- expectation: proc {
456
- line do
457
- plain %|Expected raised exception |
458
- actual %|#<RuntimeError "some really long message">|
459
- end
460
-
461
- line do
462
- plain %| not to match |
463
- expected %|#<Exception "some really long message">|
464
- end
465
- },
466
- )
458
+ expected_output =
459
+ build_expected_output(
460
+ color_enabled: color_enabled,
461
+ snippet:
462
+ "expect { raise(message) }.not_to raise_error(message)",
463
+ newline_before_expectation: true,
464
+ expectation:
465
+ proc do
466
+ line do
467
+ plain "Expected raised exception "
468
+ actual %|#<RuntimeError "some really long message">|
469
+ end
470
+
471
+ line do
472
+ plain " not to match "
473
+ expected %|#<Exception "some really long message">|
474
+ end
475
+ end
476
+ )
467
477
 
468
- expect(program).
469
- to produce_output_when_run(expected_output).
470
- in_color(color_enabled)
478
+ expect(program).to produce_output_when_run(
479
+ expected_output
480
+ ).in_color(color_enabled)
471
481
  end
472
482
  end
473
483
  end
@@ -482,31 +492,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
482
492
  MESSAGE
483
493
  expect { raise(message) }.not_to raise_error(message)
484
494
  TEST
485
- program = make_plain_test_program(
486
- snippet,
487
- color_enabled: color_enabled,
488
- )
495
+ program =
496
+ make_plain_test_program(snippet, color_enabled: color_enabled)
489
497
 
490
- expected_output = build_expected_output(
491
- color_enabled: color_enabled,
492
- snippet: %|expect { raise(message) }.not_to raise_error(message)|,
493
- newline_before_expectation: true,
494
- expectation: proc {
495
- line do
496
- plain %|Expected raised exception |
497
- actual %|#<RuntimeError "This is fun\\nSo is this">|
498
- end
499
-
500
- line do
501
- plain %| not to match |
502
- expected %|#<Exception "This is fun\\nSo is this">|
503
- end
504
- },
505
- )
498
+ expected_output =
499
+ build_expected_output(
500
+ color_enabled: color_enabled,
501
+ snippet:
502
+ "expect { raise(message) }.not_to raise_error(message)",
503
+ newline_before_expectation: true,
504
+ expectation:
505
+ proc do
506
+ line do
507
+ plain "Expected raised exception "
508
+ actual %|#<RuntimeError "This is fun\\nSo is this">|
509
+ end
510
+
511
+ line do
512
+ plain " not to match "
513
+ expected %|#<Exception "This is fun\\nSo is this">|
514
+ end
515
+ end
516
+ )
506
517
 
507
- expect(program).
508
- to produce_output_when_run(expected_output).
509
- in_color(color_enabled)
518
+ expect(program).to produce_output_when_run(
519
+ expected_output
520
+ ).in_color(color_enabled)
510
521
  end
511
522
  end
512
523
  end
@@ -524,28 +535,28 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
524
535
  block = -> { raise StandardError.new('a') }
525
536
  expect(&block).to raise_error(RuntimeError, 'b')
526
537
  TEST
527
- program = make_plain_test_program(
528
- snippet,
529
- color_enabled: color_enabled,
530
- )
538
+ program =
539
+ make_plain_test_program(snippet, color_enabled: color_enabled)
531
540
 
532
- expected_output = build_expected_output(
533
- color_enabled: color_enabled,
534
- snippet: %|expect(&block).to raise_error(RuntimeError, 'b')|,
535
- expectation: proc {
536
- line do
537
- plain %|Expected raised exception |
538
- actual %|#<StandardError "a">|
539
- plain %| to match |
540
- expected %|#<RuntimeError "b">|
541
- plain %|.|
542
- end
543
- },
544
- )
541
+ expected_output =
542
+ build_expected_output(
543
+ color_enabled: color_enabled,
544
+ snippet: "expect(&block).to raise_error(RuntimeError, 'b')",
545
+ expectation:
546
+ proc do
547
+ line do
548
+ plain "Expected raised exception "
549
+ actual %|#<StandardError "a">|
550
+ plain " to match "
551
+ expected %|#<RuntimeError "b">|
552
+ plain "."
553
+ end
554
+ end
555
+ )
545
556
 
546
- expect(program).
547
- to produce_output_when_run(expected_output).
548
- in_color(color_enabled)
557
+ expect(program).to produce_output_when_run(
558
+ expected_output
559
+ ).in_color(color_enabled)
549
560
  end
550
561
  end
551
562
  end
@@ -557,31 +568,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
557
568
  block = -> { raise StandardError.new('this is a long message') }
558
569
  expect(&block).to raise_error(RuntimeError, 'this is another long message')
559
570
  TEST
560
- program = make_plain_test_program(
561
- snippet,
562
- color_enabled: color_enabled,
563
- )
571
+ program =
572
+ make_plain_test_program(snippet, color_enabled: color_enabled)
564
573
 
565
- expected_output = build_expected_output(
566
- color_enabled: color_enabled,
567
- snippet: %|expect(&block).to raise_error(RuntimeError, 'this is another long message')|,
568
- newline_before_expectation: true,
569
- expectation: proc {
570
- line do
571
- plain %|Expected raised exception |
572
- actual %|#<StandardError "this is a long message">|
573
- end
574
-
575
- line do
576
- plain %| to match |
577
- expected %|#<RuntimeError "this is another long message">|
578
- end
579
- },
580
- )
574
+ expected_output =
575
+ build_expected_output(
576
+ color_enabled: color_enabled,
577
+ snippet:
578
+ "expect(&block).to raise_error(RuntimeError, 'this is another long message')",
579
+ newline_before_expectation: true,
580
+ expectation:
581
+ proc do
582
+ line do
583
+ plain "Expected raised exception "
584
+ actual %|#<StandardError "this is a long message">|
585
+ end
586
+
587
+ line do
588
+ plain " to match "
589
+ expected %|#<RuntimeError "this is another long message">|
590
+ end
591
+ end
592
+ )
581
593
 
582
- expect(program).
583
- to produce_output_when_run(expected_output).
584
- in_color(color_enabled)
594
+ expect(program).to produce_output_when_run(
595
+ expected_output
596
+ ).in_color(color_enabled)
585
597
  end
586
598
  end
587
599
  end
@@ -594,26 +606,26 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
594
606
  snippet = <<~TEST.strip
595
607
  expect { }.to raise_error(RuntimeError, 'b')
596
608
  TEST
597
- program = make_plain_test_program(
598
- snippet,
599
- color_enabled: color_enabled,
600
- )
609
+ program =
610
+ make_plain_test_program(snippet, color_enabled: color_enabled)
601
611
 
602
- expected_output = build_expected_output(
603
- color_enabled: color_enabled,
604
- snippet: %|expect { }.to raise_error(RuntimeError, 'b')|,
605
- expectation: proc {
606
- line do
607
- plain %|Expected block to raise error |
608
- expected %|#<RuntimeError "b">|
609
- plain %|.|
610
- end
611
- },
612
- )
612
+ expected_output =
613
+ build_expected_output(
614
+ color_enabled: color_enabled,
615
+ snippet: "expect { }.to raise_error(RuntimeError, 'b')",
616
+ expectation:
617
+ proc do
618
+ line do
619
+ plain "Expected block to raise error "
620
+ expected %|#<RuntimeError "b">|
621
+ plain "."
622
+ end
623
+ end
624
+ )
613
625
 
614
- expect(program).
615
- to produce_output_when_run(expected_output).
616
- in_color(color_enabled)
626
+ expect(program).to produce_output_when_run(
627
+ expected_output
628
+ ).in_color(color_enabled)
617
629
  end
618
630
  end
619
631
  end
@@ -624,31 +636,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
624
636
  snippet = <<~TEST.strip
625
637
  expect { }.to raise_error(RuntimeError, 'this is a super super super super super super long message')
626
638
  TEST
627
- program = make_plain_test_program(
628
- snippet,
629
- color_enabled: color_enabled,
630
- )
631
-
632
- expected_output = build_expected_output(
633
- color_enabled: color_enabled,
634
- snippet: %|expect { }.to raise_error(RuntimeError, 'this is a super super super super super super long message')|,
635
- newline_before_expectation: true,
636
- expectation: proc {
637
- line do
638
- plain %| Expected |
639
- plain %|block|
640
- end
639
+ program =
640
+ make_plain_test_program(snippet, color_enabled: color_enabled)
641
641
 
642
- line do
643
- plain %|to raise error |
644
- expected %|#<RuntimeError "this is a super super super super super super long message">|
645
- end
646
- },
647
- )
642
+ expected_output =
643
+ build_expected_output(
644
+ color_enabled: color_enabled,
645
+ snippet:
646
+ "expect { }.to raise_error(RuntimeError, 'this is a super super super super super super long message')",
647
+ newline_before_expectation: true,
648
+ expectation:
649
+ proc do
650
+ line do
651
+ plain " Expected "
652
+ plain "block"
653
+ end
654
+
655
+ line do
656
+ plain "to raise error "
657
+ expected %|#<RuntimeError "this is a super super super super super super long message">|
658
+ end
659
+ end
660
+ )
648
661
 
649
- expect(program).
650
- to produce_output_when_run(expected_output).
651
- in_color(color_enabled)
662
+ expect(program).to produce_output_when_run(
663
+ expected_output
664
+ ).in_color(color_enabled)
652
665
  end
653
666
  end
654
667
  end
@@ -663,28 +676,29 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
663
676
  block = -> { raise StandardError.new('a') }
664
677
  expect(&block).not_to raise_error(StandardError, 'a')
665
678
  TEST
666
- program = make_plain_test_program(
667
- snippet,
668
- color_enabled: color_enabled,
669
- )
670
-
671
- expected_output = build_expected_output(
672
- color_enabled: color_enabled,
673
- snippet: %|expect(&block).not_to raise_error(StandardError, 'a')|,
674
- expectation: proc {
675
- line do
676
- plain %|Expected raised exception |
677
- actual %|#<StandardError "a">|
678
- plain %| not to match |
679
- expected %|#<StandardError "a">|
680
- plain %|.|
681
- end
682
- },
683
- )
684
-
685
- expect(program).
686
- to produce_output_when_run(expected_output).
687
- in_color(color_enabled)
679
+ program =
680
+ make_plain_test_program(snippet, color_enabled: color_enabled)
681
+
682
+ expected_output =
683
+ build_expected_output(
684
+ color_enabled: color_enabled,
685
+ snippet:
686
+ "expect(&block).not_to raise_error(StandardError, 'a')",
687
+ expectation:
688
+ proc do
689
+ line do
690
+ plain "Expected raised exception "
691
+ actual %|#<StandardError "a">|
692
+ plain " not to match "
693
+ expected %|#<StandardError "a">|
694
+ plain "."
695
+ end
696
+ end
697
+ )
698
+
699
+ expect(program).to produce_output_when_run(
700
+ expected_output
701
+ ).in_color(color_enabled)
688
702
  end
689
703
  end
690
704
  end
@@ -696,31 +710,32 @@ RSpec.describe "Integration with RSpec's #raise_error matcher", type: :integrati
696
710
  block = -> { raise StandardError.new('this is a long message') }
697
711
  expect(&block).not_to raise_error(StandardError, 'this is a long message')
698
712
  TEST
699
- program = make_plain_test_program(
700
- snippet,
701
- color_enabled: color_enabled,
702
- )
703
-
704
- expected_output = build_expected_output(
705
- color_enabled: color_enabled,
706
- snippet: %|expect(&block).not_to raise_error(StandardError, 'this is a long message')|,
707
- newline_before_expectation: true,
708
- expectation: proc {
709
- line do
710
- plain %|Expected raised exception |
711
- actual %|#<StandardError "this is a long message">|
712
- end
713
-
714
- line do
715
- plain %| not to match |
716
- expected %|#<StandardError "this is a long message">|
717
- end
718
- },
719
- )
720
-
721
- expect(program).
722
- to produce_output_when_run(expected_output).
723
- in_color(color_enabled)
713
+ program =
714
+ make_plain_test_program(snippet, color_enabled: color_enabled)
715
+
716
+ expected_output =
717
+ build_expected_output(
718
+ color_enabled: color_enabled,
719
+ snippet:
720
+ "expect(&block).not_to raise_error(StandardError, 'this is a long message')",
721
+ newline_before_expectation: true,
722
+ expectation:
723
+ proc do
724
+ line do
725
+ plain "Expected raised exception "
726
+ actual %|#<StandardError "this is a long message">|
727
+ end
728
+
729
+ line do
730
+ plain " not to match "
731
+ expected %|#<StandardError "this is a long message">|
732
+ end
733
+ end
734
+ )
735
+
736
+ expect(program).to produce_output_when_run(
737
+ expected_output
738
+ ).in_color(color_enabled)
724
739
  end
725
740
  end
726
741
  end