super_diff 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -26
- data/lib/super_diff/active_record/differs/active_record_relation.rb +1 -2
- data/lib/super_diff/active_record/differs.rb +1 -1
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_model.rb +5 -13
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders/active_record_relation.rb +1 -3
- data/lib/super_diff/active_record/object_inspection/inspection_tree_builders.rb +2 -2
- data/lib/super_diff/active_record/object_inspection.rb +1 -1
- data/lib/super_diff/active_record/operation_tree_builders/active_record_model.rb +1 -2
- data/lib/super_diff/active_record/operation_tree_builders/active_record_relation.rb +1 -2
- data/lib/super_diff/active_record/operation_tree_builders.rb +2 -2
- data/lib/super_diff/active_record/operation_tree_flatteners.rb +1 -1
- data/lib/super_diff/active_record/operation_trees.rb +1 -1
- data/lib/super_diff/active_record.rb +7 -15
- data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +5 -6
- data/lib/super_diff/active_support/differs.rb +1 -1
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders/hash_with_indifferent_access.rb +3 -9
- data/lib/super_diff/active_support/object_inspection/inspection_tree_builders.rb +1 -1
- data/lib/super_diff/active_support/object_inspection.rb +1 -1
- data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +5 -6
- data/lib/super_diff/active_support/operation_tree_builders.rb +1 -1
- data/lib/super_diff/active_support/operation_tree_flatteners.rb +1 -1
- data/lib/super_diff/active_support/operation_trees.rb +1 -1
- data/lib/super_diff/active_support.rb +6 -11
- data/lib/super_diff/colorized_document_extensions.rb +2 -4
- data/lib/super_diff/configuration.rb +14 -8
- data/lib/super_diff/csi/color.rb +4 -4
- data/lib/super_diff/csi/colorized_document.rb +12 -16
- data/lib/super_diff/csi/document.rb +8 -19
- data/lib/super_diff/csi/eight_bit_color.rb +19 -19
- data/lib/super_diff/csi/four_bit_color.rb +82 -31
- data/lib/super_diff/csi/twenty_four_bit_color.rb +12 -11
- data/lib/super_diff/csi/uncolorized_document.rb +2 -6
- data/lib/super_diff/csi.rb +10 -14
- data/lib/super_diff/diff_formatters/collection.rb +35 -41
- data/lib/super_diff/differs/default_object.rb +1 -1
- data/lib/super_diff/differs/defaults.rb +1 -1
- data/lib/super_diff/differs/main.rb +2 -13
- data/lib/super_diff/equality_matchers/array.rb +10 -12
- data/lib/super_diff/equality_matchers/base.rb +1 -1
- data/lib/super_diff/equality_matchers/default.rb +2 -4
- data/lib/super_diff/equality_matchers/defaults.rb +1 -1
- data/lib/super_diff/equality_matchers/hash.rb +10 -12
- data/lib/super_diff/equality_matchers/multiline_string.rb +11 -13
- data/lib/super_diff/equality_matchers/primitive.rb +10 -12
- data/lib/super_diff/equality_matchers/singleline_string.rb +10 -12
- data/lib/super_diff/equality_matchers.rb +1 -1
- data/lib/super_diff/errors.rb +3 -3
- data/lib/super_diff/gem_version.rb +3 -3
- data/lib/super_diff/helpers.rb +10 -10
- data/lib/super_diff/implementation_checks.rb +2 -2
- data/lib/super_diff/line.rb +3 -3
- data/lib/super_diff/object_inspection/inspection_tree.rb +46 -60
- data/lib/super_diff/object_inspection/inspection_tree_builders/array.rb +2 -6
- data/lib/super_diff/object_inspection/inspection_tree_builders/custom_object.rb +3 -9
- data/lib/super_diff/object_inspection/inspection_tree_builders/default_object.rb +5 -14
- data/lib/super_diff/object_inspection/inspection_tree_builders/defaults.rb +1 -1
- data/lib/super_diff/object_inspection/inspection_tree_builders/hash.rb +4 -12
- data/lib/super_diff/object_inspection/inspection_tree_builders/time_like.rb +6 -23
- data/lib/super_diff/object_inspection/inspection_tree_builders.rb +9 -9
- data/lib/super_diff/object_inspection/nodes/as_lines_when_rendering_to_lines.rb +8 -20
- data/lib/super_diff/object_inspection/nodes/as_prefix_when_rendering_to_lines.rb +1 -5
- data/lib/super_diff/object_inspection/nodes/as_prelude_when_rendering_to_lines.rb +1 -5
- data/lib/super_diff/object_inspection/nodes/as_single_line.rb +3 -7
- data/lib/super_diff/object_inspection/nodes/base.rb +9 -14
- data/lib/super_diff/object_inspection/nodes/inspection.rb +26 -34
- data/lib/super_diff/object_inspection/nodes/nesting.rb +1 -1
- data/lib/super_diff/object_inspection/nodes/only_when.rb +2 -6
- data/lib/super_diff/object_inspection/nodes/text.rb +1 -5
- data/lib/super_diff/object_inspection/nodes/when_empty.rb +2 -6
- data/lib/super_diff/object_inspection/nodes/when_non_empty.rb +2 -6
- data/lib/super_diff/object_inspection/nodes/when_rendering_to_lines.rb +1 -1
- data/lib/super_diff/object_inspection/nodes/when_rendering_to_string.rb +1 -5
- data/lib/super_diff/object_inspection/nodes.rb +7 -7
- data/lib/super_diff/object_inspection.rb +3 -3
- data/lib/super_diff/operation_tree_builders/array.rb +12 -11
- data/lib/super_diff/operation_tree_builders/base.rb +17 -15
- data/lib/super_diff/operation_tree_builders/custom_object.rb +8 -6
- data/lib/super_diff/operation_tree_builders/default_object.rb +29 -21
- data/lib/super_diff/operation_tree_builders/hash.rb +23 -24
- data/lib/super_diff/operation_tree_builders/main.rb +4 -11
- data/lib/super_diff/operation_tree_builders/multiline_string.rb +3 -3
- data/lib/super_diff/operation_tree_builders/time_like.rb +1 -11
- data/lib/super_diff/operation_tree_builders.rb +1 -1
- data/lib/super_diff/operation_tree_flatteners/base.rb +1 -5
- data/lib/super_diff/operation_tree_flatteners/collection.rb +13 -16
- data/lib/super_diff/operation_tree_flatteners/default_object.rb +1 -2
- data/lib/super_diff/operation_tree_flatteners/hash.rb +2 -10
- data/lib/super_diff/operation_tree_flatteners/multiline_string.rb +2 -1
- data/lib/super_diff/operation_tree_flatteners.rb +3 -3
- data/lib/super_diff/operation_trees/base.rb +3 -5
- data/lib/super_diff/operation_trees/default_object.rb +1 -3
- data/lib/super_diff/operations/binary_operation.rb +2 -2
- data/lib/super_diff/operations/unary_operation.rb +1 -1
- data/lib/super_diff/rails.rb +2 -1
- data/lib/super_diff/recursion_guard.rb +5 -4
- data/lib/super_diff/rspec/augmented_matcher.rb +4 -5
- data/lib/super_diff/rspec/differ.rb +6 -13
- data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +3 -2
- data/lib/super_diff/rspec/differs/collection_including.rb +1 -1
- data/lib/super_diff/rspec/differs/hash_including.rb +1 -1
- data/lib/super_diff/rspec/differs.rb +3 -3
- data/lib/super_diff/rspec/matcher_text_builders/base.rb +13 -15
- data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +5 -7
- data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +3 -5
- data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +1 -5
- data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +2 -6
- data/lib/super_diff/rspec/matcher_text_builders.rb +5 -8
- data/lib/super_diff/rspec/matcher_text_template.rb +13 -16
- data/lib/super_diff/rspec/monkey_patches.rb +122 -116
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/collection_including.rb +8 -6
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/double.rb +11 -16
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/hash_including.rb +2 -1
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/instance_of.rb +8 -6
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders/kind_of.rb +8 -6
- data/lib/super_diff/rspec/object_inspection/inspection_tree_builders.rb +9 -9
- data/lib/super_diff/rspec/object_inspection.rb +1 -1
- data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +11 -10
- data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +7 -6
- data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +11 -10
- data/lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb +22 -17
- data/lib/super_diff/rspec/operation_tree_builders.rb +4 -4
- data/lib/super_diff/rspec.rb +11 -13
- data/lib/super_diff/tiered_lines_elider.rb +87 -115
- data/lib/super_diff/tiered_lines_formatter.rb +5 -9
- data/lib/super_diff/version.rb +1 -1
- data/lib/super_diff.rb +4 -9
- data/spec/examples.txt +493 -485
- data/spec/integration/rails/active_record_spec.rb +3 -1
- data/spec/integration/rails/engines_spec.rb +20 -0
- data/spec/integration/rails/hash_with_indifferent_access_spec.rb +3 -1
- data/spec/integration/rspec/be_falsey_matcher_spec.rb +40 -35
- data/spec/integration/rspec/be_matcher_spec.rb +360 -320
- data/spec/integration/rspec/be_nil_matcher_spec.rb +38 -34
- data/spec/integration/rspec/be_predicate_matcher_spec.rb +376 -359
- data/spec/integration/rspec/be_truthy_matcher_spec.rb +38 -33
- data/spec/integration/rspec/contain_exactly_matcher_spec.rb +242 -239
- data/spec/integration/rspec/eq_matcher_spec.rb +595 -557
- data/spec/integration/rspec/have_attributes_matcher_spec.rb +294 -286
- data/spec/integration/rspec/have_predicate_matcher_spec.rb +291 -297
- data/spec/integration/rspec/include_matcher_spec.rb +317 -215
- data/spec/integration/rspec/match_array_matcher_spec.rb +276 -273
- data/spec/integration/rspec/match_matcher_spec.rb +847 -834
- data/spec/integration/rspec/raise_error_matcher_spec.rb +468 -453
- data/spec/integration/rspec/respond_to_matcher_spec.rb +702 -697
- data/spec/integration/rspec/third_party_matcher_spec.rb +142 -138
- data/spec/integration/rspec/unhandled_errors_spec.rb +88 -84
- data/spec/spec_helper.rb +17 -20
- data/spec/support/command_runner.rb +34 -57
- data/spec/support/integration/helpers.rb +35 -28
- data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +28 -23
- data/spec/support/integration/test_programs/base.rb +12 -17
- data/spec/support/integration/test_programs/plain.rb +6 -0
- data/spec/support/integration/test_programs/rspec_active_record.rb +4 -1
- data/spec/support/integration/test_programs/rspec_active_support.rb +4 -1
- data/spec/support/integration/test_programs/rspec_rails.rb +4 -1
- data/spec/support/integration/test_programs/rspec_rails_engine.rb +30 -0
- data/spec/support/models/active_record/person.rb +6 -4
- data/spec/support/models/active_record/shipping_address.rb +9 -10
- data/spec/support/models/customer.rb +2 -4
- data/spec/support/models/player.rb +3 -6
- data/spec/support/models/shipping_address.rb +4 -13
- data/spec/support/shared_examples/active_record.rb +232 -214
- data/spec/support/shared_examples/active_support.rb +53 -51
- data/spec/support/shared_examples/elided_diffs.rb +405 -381
- data/spec/support/shared_examples/hash_with_indifferent_access.rb +424 -388
- data/spec/support/shared_examples/key.rb +123 -0
- data/spec/support/unit/helpers.rb +1 -3
- data/spec/support/unit/matchers/match_output.rb +12 -13
- data/spec/unit/active_record/object_inspection_spec.rb +222 -206
- data/spec/unit/equality_matchers/main_spec.rb +1049 -984
- data/spec/unit/helpers_spec.rb +14 -21
- data/spec/unit/operation_tree_flatteners/array_spec.rb +557 -524
- data/spec/unit/operation_tree_flatteners/custom_object_spec.rb +619 -601
- data/spec/unit/operation_tree_flatteners/default_object_spec.rb +619 -621
- data/spec/unit/operation_tree_flatteners/hash_spec.rb +595 -556
- data/spec/unit/operation_tree_flatteners/multiline_string_spec.rb +102 -92
- data/spec/unit/rspec/matchers/be_compared_to_spec.rb +3 -3
- data/spec/unit/rspec/matchers/be_predicate_spec.rb +3 -3
- data/spec/unit/rspec/matchers/contain_exactly_spec.rb +1 -1
- data/spec/unit/rspec/matchers/have_attributes_spec.rb +1 -1
- data/spec/unit/rspec/matchers/have_predicate_spec.rb +2 -2
- data/spec/unit/rspec/matchers/include_spec.rb +2 -2
- data/spec/unit/rspec/matchers/match_array_spec.rb +2 -2
- data/spec/unit/rspec/matchers/raise_error_spec.rb +5 -5
- data/spec/unit/rspec/matchers/respond_to_spec.rb +23 -16
- data/spec/unit/rspec/object_inspection_spec.rb +349 -324
- data/spec/unit/super_diff_spec.rb +1542 -1449
- data/spec/unit/tiered_lines_elider_spec.rb +3508 -3536
- data/spec/unit/tiered_lines_formatter_spec.rb +54 -116
- data/super_diff.gemspec +13 -12
- metadata +73 -73
- 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",
|
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 =
|
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 =
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
34
|
-
|
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 =
|
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 =
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
-
|
69
|
-
|
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 =
|
82
|
-
snippet,
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
expect(program).
|
99
|
-
|
100
|
-
|
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 =
|
114
|
-
snippet,
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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 =
|
146
|
-
snippet,
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
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 =
|
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 =
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
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
|
-
|
206
|
-
|
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 =
|
221
|
-
snippet,
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
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 =
|
264
|
-
snippet,
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
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 =
|
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 =
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
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
|
-
|
324
|
-
|
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 =
|
338
|
-
snippet,
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
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 =
|
374
|
-
snippet,
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
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 =
|
413
|
-
snippet,
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
expect(program).
|
432
|
-
|
433
|
-
|
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 =
|
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 =
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
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
|
-
|
470
|
-
|
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 =
|
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 =
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
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
|
-
|
509
|
-
|
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 =
|
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 =
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
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
|
-
|
548
|
-
|
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 =
|
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 =
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
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
|
-
|
584
|
-
|
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 =
|
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 =
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
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
|
-
|
616
|
-
|
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 =
|
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
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
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
|
-
|
651
|
-
|
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 =
|
667
|
-
snippet,
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
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 =
|
700
|
-
snippet,
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
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
|