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,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",
|
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 =
|
10
|
-
program =
|
11
|
-
snippet,
|
12
|
-
|
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 =
|
38
|
-
program =
|
39
|
-
snippet,
|
40
|
-
|
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 =
|
71
|
-
snippet,
|
72
|
-
|
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 =
|
121
|
-
snippet,
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
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 =
|
161
|
-
snippet,
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
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 =
|
197
|
-
snippet,
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
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 =
|
232
|
-
snippet,
|
233
|
-
|
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 =
|
281
|
-
snippet,
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
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 =
|
324
|
-
snippet,
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
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 =
|
360
|
-
snippet,
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
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 =
|
395
|
-
snippet,
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
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 =
|
445
|
-
snippet,
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
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 =
|
489
|
-
snippet,
|
490
|
-
|
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 =
|
525
|
-
snippet,
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
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 =
|
560
|
-
snippet,
|
561
|
-
|
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 =
|
611
|
-
snippet,
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
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 =
|
654
|
-
snippet,
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
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 =
|
690
|
-
snippet,
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
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 =
|
725
|
-
snippet,
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
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 =
|
770
|
-
snippet,
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
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 =
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
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
|
-
|
827
|
-
|
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
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
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
|
-
|
892
|
-
|
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 =
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
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
|
-
|
920
|
-
|
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
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
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
|
-
|
989
|
-
|
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
|