super_diff 0.13.0 → 0.15.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 +1 -1
- data/lib/super_diff/active_record/differs/active_record_relation.rb +2 -0
- data/lib/super_diff/active_record/differs.rb +3 -1
- data/lib/super_diff/active_record/inspection_tree_builders/active_record_model.rb +7 -5
- data/lib/super_diff/active_record/inspection_tree_builders/active_record_relation.rb +12 -10
- data/lib/super_diff/active_record/inspection_tree_builders.rb +4 -2
- data/lib/super_diff/active_record/monkey_patches.rb +4 -2
- data/lib/super_diff/active_record/object_inspection.rb +6 -4
- data/lib/super_diff/active_record/operation_tree_builders/active_record_model.rb +3 -1
- data/lib/super_diff/active_record/operation_tree_builders/active_record_relation.rb +3 -1
- data/lib/super_diff/active_record/operation_tree_builders.rb +4 -2
- data/lib/super_diff/active_record/operation_tree_flatteners/active_record_relation.rb +4 -2
- data/lib/super_diff/active_record/operation_tree_flatteners.rb +3 -1
- data/lib/super_diff/active_record/operation_trees/active_record_relation.rb +2 -0
- data/lib/super_diff/active_record/operation_trees.rb +3 -1
- data/lib/super_diff/active_record.rb +10 -8
- data/lib/super_diff/active_support/differs/hash_with_indifferent_access.rb +2 -0
- data/lib/super_diff/active_support/differs.rb +3 -1
- data/lib/super_diff/active_support/inspection_tree_builders/hash_with_indifferent_access.rb +16 -14
- data/lib/super_diff/active_support/inspection_tree_builders/ordered_options.rb +16 -14
- data/lib/super_diff/active_support/inspection_tree_builders.rb +4 -2
- data/lib/super_diff/active_support/object_inspection.rb +6 -4
- data/lib/super_diff/active_support/operation_tree_builders/hash_with_indifferent_access.rb +6 -4
- data/lib/super_diff/active_support/operation_tree_builders.rb +3 -1
- data/lib/super_diff/active_support/operation_tree_flatteners/hash_with_indifferent_access.rb +4 -2
- data/lib/super_diff/active_support/operation_tree_flatteners.rb +3 -1
- data/lib/super_diff/active_support/operation_trees/hash_with_indifferent_access.rb +2 -0
- data/lib/super_diff/active_support/operation_trees.rb +3 -1
- data/lib/super_diff/active_support.rb +8 -6
- data/lib/super_diff/basic/diff_formatters/collection.rb +18 -18
- data/lib/super_diff/basic/diff_formatters/multiline_string.rb +2 -0
- data/lib/super_diff/basic/diff_formatters.rb +4 -2
- data/lib/super_diff/basic/differs/array.rb +2 -0
- data/lib/super_diff/basic/differs/custom_object.rb +3 -1
- data/lib/super_diff/basic/differs/date_like.rb +2 -0
- data/lib/super_diff/basic/differs/default_object.rb +3 -1
- data/lib/super_diff/basic/differs/hash.rb +2 -0
- data/lib/super_diff/basic/differs/multiline_string.rb +2 -0
- data/lib/super_diff/basic/differs/time_like.rb +2 -0
- data/lib/super_diff/basic/differs.rb +11 -9
- data/lib/super_diff/basic/inspection_tree_builders/array.rb +5 -3
- data/lib/super_diff/basic/inspection_tree_builders/custom_object.rb +5 -3
- data/lib/super_diff/basic/inspection_tree_builders/data_object.rb +6 -4
- data/lib/super_diff/basic/inspection_tree_builders/date_like.rb +7 -5
- data/lib/super_diff/basic/inspection_tree_builders/default_object.rb +7 -5
- data/lib/super_diff/basic/inspection_tree_builders/hash.rb +7 -5
- data/lib/super_diff/basic/inspection_tree_builders/primitive.rb +2 -0
- data/lib/super_diff/basic/inspection_tree_builders/range_object.rb +19 -0
- data/lib/super_diff/basic/inspection_tree_builders/time_like.rb +8 -8
- data/lib/super_diff/basic/inspection_tree_builders.rb +15 -9
- data/lib/super_diff/basic/operation_tree_builders/array.rb +6 -4
- data/lib/super_diff/basic/operation_tree_builders/custom_object.rb +3 -1
- data/lib/super_diff/basic/operation_tree_builders/data_object.rb +4 -2
- data/lib/super_diff/basic/operation_tree_builders/date_like.rb +2 -0
- data/lib/super_diff/basic/operation_tree_builders/default_object.rb +32 -31
- data/lib/super_diff/basic/operation_tree_builders/hash.rb +49 -46
- data/lib/super_diff/basic/operation_tree_builders/multiline_string.rb +5 -3
- data/lib/super_diff/basic/operation_tree_builders/time_like.rb +5 -3
- data/lib/super_diff/basic/operation_tree_builders.rb +12 -10
- data/lib/super_diff/basic/operation_tree_flatteners/array.rb +4 -2
- data/lib/super_diff/basic/operation_tree_flatteners/collection.rb +11 -11
- data/lib/super_diff/basic/operation_tree_flatteners/custom_object.rb +5 -3
- data/lib/super_diff/basic/operation_tree_flatteners/default_object.rb +6 -5
- data/lib/super_diff/basic/operation_tree_flatteners/hash.rb +5 -3
- data/lib/super_diff/basic/operation_tree_flatteners/multiline_string.rb +3 -1
- data/lib/super_diff/basic/operation_tree_flatteners.rb +8 -6
- data/lib/super_diff/basic/operation_trees/array.rb +2 -0
- data/lib/super_diff/basic/operation_trees/custom_object.rb +2 -0
- data/lib/super_diff/basic/operation_trees/default_object.rb +6 -4
- data/lib/super_diff/basic/operation_trees/hash.rb +2 -0
- data/lib/super_diff/basic/operation_trees/multiline_string.rb +3 -1
- data/lib/super_diff/basic/operation_trees.rb +9 -7
- data/lib/super_diff/basic.rb +9 -6
- data/lib/super_diff/core/abstract_differ.rb +2 -0
- data/lib/super_diff/core/abstract_inspection_tree_builder.rb +2 -0
- data/lib/super_diff/core/abstract_operation_tree.rb +4 -2
- data/lib/super_diff/core/abstract_operation_tree_builder.rb +15 -18
- data/lib/super_diff/core/abstract_operation_tree_flattener.rb +5 -3
- data/lib/super_diff/core/binary_operation.rb +3 -1
- data/lib/super_diff/core/colorized_document_extensions.rb +2 -0
- data/lib/super_diff/core/configuration.rb +14 -38
- data/lib/super_diff/core/differ_dispatcher.rb +4 -2
- data/lib/super_diff/core/gem_version.rb +2 -0
- data/lib/super_diff/core/helpers.rb +13 -11
- data/lib/super_diff/core/implementation_checks.rb +6 -2
- data/lib/super_diff/core/inspection_tree.rb +38 -38
- data/lib/super_diff/core/inspection_tree_builder_dispatcher.rb +5 -5
- data/lib/super_diff/core/inspection_tree_nodes/as_lines_when_rendering_to_lines.rb +3 -1
- data/lib/super_diff/core/inspection_tree_nodes/as_prefix_when_rendering_to_lines.rb +2 -0
- data/lib/super_diff/core/inspection_tree_nodes/as_prelude_when_rendering_to_lines.rb +2 -0
- data/lib/super_diff/core/inspection_tree_nodes/as_single_line.rb +2 -0
- data/lib/super_diff/core/inspection_tree_nodes/base.rb +9 -9
- data/lib/super_diff/core/inspection_tree_nodes/inspection.rb +2 -0
- data/lib/super_diff/core/inspection_tree_nodes/nesting.rb +2 -0
- data/lib/super_diff/core/inspection_tree_nodes/only_when.rb +5 -1
- data/lib/super_diff/core/inspection_tree_nodes/text.rb +2 -0
- data/lib/super_diff/core/inspection_tree_nodes/when_empty.rb +3 -1
- data/lib/super_diff/core/inspection_tree_nodes/when_non_empty.rb +3 -1
- data/lib/super_diff/core/inspection_tree_nodes/when_rendering_to_lines.rb +3 -1
- data/lib/super_diff/core/inspection_tree_nodes/when_rendering_to_string.rb +2 -0
- data/lib/super_diff/core/inspection_tree_nodes.rb +16 -14
- data/lib/super_diff/core/line.rb +9 -7
- data/lib/super_diff/core/no_differ_available_error.rb +7 -5
- data/lib/super_diff/core/no_inspection_tree_builder_available_error.rb +5 -3
- data/lib/super_diff/core/no_operation_tree_available_error.rb +4 -2
- data/lib/super_diff/core/no_operation_tree_builder_available_error.rb +7 -5
- data/lib/super_diff/core/operation_tree_builder_dispatcher.rb +3 -3
- data/lib/super_diff/core/operation_tree_finder.rb +8 -8
- data/lib/super_diff/core/prefix_for_next_inspection_tree_node.rb +2 -0
- data/lib/super_diff/core/prelude_for_next_inspection_tree_node.rb +2 -0
- data/lib/super_diff/core/recursion_guard.rb +6 -4
- data/lib/super_diff/core/tiered_lines.rb +2 -0
- data/lib/super_diff/core/tiered_lines_elider.rb +53 -54
- data/lib/super_diff/core/tiered_lines_formatter.rb +6 -4
- data/lib/super_diff/core/unary_operation.rb +2 -0
- data/lib/super_diff/core.rb +31 -29
- data/lib/super_diff/csi/bold_sequence.rb +2 -0
- data/lib/super_diff/csi/color.rb +4 -4
- data/lib/super_diff/csi/color_sequence_block.rb +3 -1
- data/lib/super_diff/csi/colorized_document.rb +7 -9
- data/lib/super_diff/csi/document.rb +15 -18
- data/lib/super_diff/csi/eight_bit_color.rb +32 -37
- data/lib/super_diff/csi/four_bit_color.rb +12 -9
- data/lib/super_diff/csi/reset_sequence.rb +2 -0
- data/lib/super_diff/csi/twenty_four_bit_color.rb +22 -21
- data/lib/super_diff/csi/uncolorized_document.rb +2 -0
- data/lib/super_diff/csi.rb +12 -10
- data/lib/super_diff/differs.rb +6 -4
- data/lib/super_diff/equality_matchers/array.rb +18 -16
- data/lib/super_diff/equality_matchers/base.rb +6 -4
- data/lib/super_diff/equality_matchers/default.rb +5 -3
- data/lib/super_diff/equality_matchers/defaults.rb +2 -0
- data/lib/super_diff/equality_matchers/hash.rb +18 -16
- data/lib/super_diff/equality_matchers/main.rb +3 -1
- data/lib/super_diff/equality_matchers/multiline_string.rb +18 -16
- data/lib/super_diff/equality_matchers/primitive.rb +15 -13
- data/lib/super_diff/equality_matchers/singleline_string.rb +16 -14
- data/lib/super_diff/equality_matchers.rb +11 -9
- data/lib/super_diff/errors.rb +4 -2
- data/lib/super_diff/object_inspection.rb +17 -15
- data/lib/super_diff/operation_tree_builders.rb +6 -4
- data/lib/super_diff/operation_tree_flatteners.rb +6 -4
- data/lib/super_diff/operation_trees.rb +6 -4
- data/lib/super_diff/operations.rb +4 -2
- data/lib/super_diff/rails.rb +4 -2
- data/lib/super_diff/rspec/augmented_matcher.rb +3 -1
- data/lib/super_diff/rspec/differ.rb +16 -7
- data/lib/super_diff/rspec/differs/collection_containing_exactly.rb +2 -0
- data/lib/super_diff/rspec/differs/collection_including.rb +2 -0
- data/lib/super_diff/rspec/differs/hash_including.rb +2 -0
- data/lib/super_diff/rspec/differs/object_having_attributes.rb +2 -0
- data/lib/super_diff/rspec/differs.rb +6 -4
- data/lib/super_diff/rspec/inspection_tree_builders/collection_containing_exactly.rb +12 -10
- data/lib/super_diff/rspec/inspection_tree_builders/collection_including.rb +10 -8
- data/lib/super_diff/rspec/inspection_tree_builders/double.rb +20 -18
- data/lib/super_diff/rspec/inspection_tree_builders/generic_describable_matcher.rb +2 -0
- data/lib/super_diff/rspec/inspection_tree_builders/hash_including.rb +10 -8
- data/lib/super_diff/rspec/inspection_tree_builders/instance_of.rb +2 -0
- data/lib/super_diff/rspec/inspection_tree_builders/kind_of.rb +2 -0
- data/lib/super_diff/rspec/inspection_tree_builders/object_having_attributes.rb +12 -10
- data/lib/super_diff/rspec/inspection_tree_builders/primitive.rb +2 -0
- data/lib/super_diff/rspec/inspection_tree_builders/value_within.rb +6 -4
- data/lib/super_diff/rspec/inspection_tree_builders.rb +12 -10
- data/lib/super_diff/rspec/matcher_text_builders/base.rb +12 -12
- data/lib/super_diff/rspec/matcher_text_builders/be_predicate.rb +19 -17
- data/lib/super_diff/rspec/matcher_text_builders/contain_exactly.rb +3 -1
- data/lib/super_diff/rspec/matcher_text_builders/have_predicate.rb +7 -5
- data/lib/super_diff/rspec/matcher_text_builders/match.rb +6 -4
- data/lib/super_diff/rspec/matcher_text_builders/raise_error.rb +5 -3
- data/lib/super_diff/rspec/matcher_text_builders/respond_to.rb +20 -18
- data/lib/super_diff/rspec/matcher_text_builders.rb +9 -7
- data/lib/super_diff/rspec/matcher_text_template.rb +34 -39
- data/lib/super_diff/rspec/monkey_patches.rb +129 -56
- data/lib/super_diff/rspec/object_inspection.rb +7 -5
- data/lib/super_diff/rspec/operation_tree_builders/collection_containing_exactly.rb +4 -4
- data/lib/super_diff/rspec/operation_tree_builders/collection_including.rb +2 -0
- data/lib/super_diff/rspec/operation_tree_builders/hash_including.rb +2 -0
- data/lib/super_diff/rspec/operation_tree_builders/object_having_attributes.rb +2 -0
- data/lib/super_diff/rspec/operation_tree_builders.rb +6 -4
- data/lib/super_diff/rspec-rails.rb +4 -2
- data/lib/super_diff/rspec.rb +27 -14
- data/lib/super_diff/version.rb +3 -1
- data/lib/super_diff.rb +24 -26
- data/super_diff.gemspec +20 -19
- metadata +6 -185
- data/spec/examples.txt +0 -450
- data/spec/integration/rails/active_record_spec.rb +0 -21
- data/spec/integration/rails/active_support_spec.rb +0 -19
- data/spec/integration/rails/engines_spec.rb +0 -25
- data/spec/integration/rails/hash_with_indifferent_access_spec.rb +0 -21
- data/spec/integration/rspec/be_falsey_matcher_spec.rb +0 -58
- data/spec/integration/rspec/be_matcher_spec.rb +0 -605
- data/spec/integration/rspec/be_nil_matcher_spec.rb +0 -57
- data/spec/integration/rspec/be_predicate_matcher_spec.rb +0 -615
- data/spec/integration/rspec/be_truthy_matcher_spec.rb +0 -62
- data/spec/integration/rspec/contain_exactly_matcher_spec.rb +0 -377
- data/spec/integration/rspec/eq_matcher_spec.rb +0 -1066
- data/spec/integration/rspec/generic_describable_matchers_spec.rb +0 -177
- data/spec/integration/rspec/have_attributes_matcher_spec.rb +0 -443
- data/spec/integration/rspec/have_predicate_matcher_spec.rb +0 -478
- data/spec/integration/rspec/include_matcher_spec.rb +0 -452
- data/spec/integration/rspec/magic_metadata_spec.rb +0 -51
- data/spec/integration/rspec/match_array_matcher_spec.rb +0 -424
- data/spec/integration/rspec/match_matcher_spec.rb +0 -1359
- data/spec/integration/rspec/raise_error_matcher_spec.rb +0 -1488
- data/spec/integration/rspec/respond_to_matcher_spec.rb +0 -999
- data/spec/integration/rspec/third_party_matcher_spec.rb +0 -245
- data/spec/integration/rspec/unhandled_errors_spec.rb +0 -150
- data/spec/spec_helper.rb +0 -91
- data/spec/support/colorizer.rb +0 -9
- data/spec/support/command_runner.rb +0 -253
- data/spec/support/helpers.rb +0 -21
- data/spec/support/integration/helpers.rb +0 -124
- data/spec/support/integration/matchers/produce_output_when_run_matcher.rb +0 -104
- data/spec/support/integration/matchers.rb +0 -177
- data/spec/support/integration/test_programs/base.rb +0 -143
- data/spec/support/integration/test_programs/plain.rb +0 -19
- data/spec/support/integration/test_programs/rspec_active_record.rb +0 -20
- data/spec/support/integration/test_programs/rspec_active_support.rb +0 -20
- data/spec/support/integration/test_programs/rspec_rails.rb +0 -20
- data/spec/support/integration/test_programs/rspec_rails_engine.rb +0 -20
- data/spec/support/models/a.rb +0 -11
- data/spec/support/models/active_record/person.rb +0 -28
- data/spec/support/models/active_record/query.rb +0 -15
- data/spec/support/models/active_record/shipping_address.rb +0 -24
- data/spec/support/models/customer.rb +0 -22
- data/spec/support/models/empty_class.rb +0 -6
- data/spec/support/models/item.rb +0 -10
- data/spec/support/models/order.rb +0 -9
- data/spec/support/models/person.rb +0 -20
- data/spec/support/models/player.rb +0 -30
- data/spec/support/models/point.rb +0 -7
- data/spec/support/models/shipping_address.rb +0 -25
- data/spec/support/shared_examples/active_record.rb +0 -428
- data/spec/support/shared_examples/active_support.rb +0 -188
- data/spec/support/shared_examples/elided_diffs.rb +0 -938
- data/spec/support/shared_examples/hash_with_indifferent_access.rb +0 -749
- data/spec/support/shared_examples/key.rb +0 -123
- data/spec/support/unit/helpers.rb +0 -24
- data/spec/support/unit/matchers/be_deprecated_in_favor_of.rb +0 -39
- data/spec/support/unit/matchers/match_output.rb +0 -40
- data/spec/unit/active_record/object_inspection_spec.rb +0 -289
- data/spec/unit/active_support/object_inspection_spec.rb +0 -170
- data/spec/unit/basic/inspection_tree_builders/data_object_spec.rb +0 -146
- data/spec/unit/basic/operation_tree_builders/data_object_spec.rb +0 -82
- data/spec/unit/basic/operation_tree_flatteners/array_spec.rb +0 -637
- data/spec/unit/basic/operation_tree_flatteners/custom_object_spec.rb +0 -685
- data/spec/unit/basic/operation_tree_flatteners/default_object_spec.rb +0 -685
- data/spec/unit/basic/operation_tree_flatteners/hash_spec.rb +0 -671
- data/spec/unit/basic/operation_tree_flatteners/multiline_string_spec.rb +0 -131
- data/spec/unit/core/configuration_no_rspec_spec.rb +0 -58
- data/spec/unit/core/configuration_spec.rb +0 -176
- data/spec/unit/core/helpers_spec.rb +0 -68
- data/spec/unit/core/tiered_lines_elider_spec.rb +0 -6328
- data/spec/unit/core/tiered_lines_formatter_spec.rb +0 -131
- data/spec/unit/deprecations_spec.rb +0 -176
- data/spec/unit/equality_matchers/main_spec.rb +0 -1842
- data/spec/unit/rspec/matchers/be_compared_to_spec.rb +0 -23
- data/spec/unit/rspec/matchers/be_falsey_spec.rb +0 -9
- data/spec/unit/rspec/matchers/be_nil_spec.rb +0 -9
- data/spec/unit/rspec/matchers/be_predicate_spec.rb +0 -31
- data/spec/unit/rspec/matchers/be_spec.rb +0 -17
- data/spec/unit/rspec/matchers/be_truthy_spec.rb +0 -9
- data/spec/unit/rspec/matchers/contain_exactly_spec.rb +0 -11
- data/spec/unit/rspec/matchers/eq_spec.rb +0 -9
- data/spec/unit/rspec/matchers/have_attributes_spec.rb +0 -11
- data/spec/unit/rspec/matchers/have_predicate_spec.rb +0 -21
- data/spec/unit/rspec/matchers/include_spec.rb +0 -21
- data/spec/unit/rspec/matchers/match_array_spec.rb +0 -11
- data/spec/unit/rspec/matchers/match_spec.rb +0 -9
- data/spec/unit/rspec/matchers/raise_error_spec.rb +0 -77
- data/spec/unit/rspec/matchers/respond_to_spec.rb +0 -85
- data/spec/unit/rspec/object_inspection/rspec_matcher_spec.rb +0 -91
- data/spec/unit/rspec/object_inspection_spec.rb +0 -471
- data/spec/unit/super_diff_spec.rb +0 -2115
@@ -1,605 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe "Integration with RSpec's #be matcher", type: :integration do
|
4
|
-
context "with a boolean" do
|
5
|
-
context "when comparing with false" do
|
6
|
-
it "produces the correct failure message when used in the positive" do
|
7
|
-
as_both_colored_and_uncolored do |color_enabled|
|
8
|
-
program =
|
9
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
10
|
-
expect(true).to be(false)
|
11
|
-
TEST
|
12
|
-
|
13
|
-
expected_output =
|
14
|
-
build_expected_output(
|
15
|
-
color_enabled: color_enabled,
|
16
|
-
snippet: "expect(true).to be(false)",
|
17
|
-
expectation:
|
18
|
-
proc do
|
19
|
-
line do
|
20
|
-
plain "Expected "
|
21
|
-
actual "true"
|
22
|
-
plain " to equal "
|
23
|
-
expected "false"
|
24
|
-
plain "."
|
25
|
-
end
|
26
|
-
end
|
27
|
-
)
|
28
|
-
|
29
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
30
|
-
color_enabled
|
31
|
-
)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
it "produces the correct failure message when used in the negative" do
|
36
|
-
as_both_colored_and_uncolored do |color_enabled|
|
37
|
-
program =
|
38
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
39
|
-
expect(false).not_to be(false)
|
40
|
-
TEST
|
41
|
-
|
42
|
-
expected_output =
|
43
|
-
build_expected_output(
|
44
|
-
color_enabled: color_enabled,
|
45
|
-
snippet: "expect(false).not_to be(false)",
|
46
|
-
expectation:
|
47
|
-
proc do
|
48
|
-
line do
|
49
|
-
plain "Expected "
|
50
|
-
actual "false"
|
51
|
-
plain " not to equal "
|
52
|
-
expected "false"
|
53
|
-
plain "."
|
54
|
-
end
|
55
|
-
end
|
56
|
-
)
|
57
|
-
|
58
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
59
|
-
color_enabled
|
60
|
-
)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context "when comparing with true" do
|
66
|
-
it "produces the correct failure message when used in the positive" do
|
67
|
-
as_both_colored_and_uncolored do |color_enabled|
|
68
|
-
program =
|
69
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
70
|
-
expect(false).to be(true)
|
71
|
-
TEST
|
72
|
-
|
73
|
-
expected_output =
|
74
|
-
build_expected_output(
|
75
|
-
color_enabled: color_enabled,
|
76
|
-
snippet: "expect(false).to be(true)",
|
77
|
-
expectation:
|
78
|
-
proc do
|
79
|
-
line do
|
80
|
-
plain "Expected "
|
81
|
-
actual "false"
|
82
|
-
plain " to equal "
|
83
|
-
expected "true"
|
84
|
-
plain "."
|
85
|
-
end
|
86
|
-
end
|
87
|
-
)
|
88
|
-
|
89
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
90
|
-
color_enabled
|
91
|
-
)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it "produces the correct failure message when used in the negative" do
|
96
|
-
as_both_colored_and_uncolored do |color_enabled|
|
97
|
-
program =
|
98
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
99
|
-
expect(true).not_to be(true)
|
100
|
-
TEST
|
101
|
-
|
102
|
-
expected_output =
|
103
|
-
build_expected_output(
|
104
|
-
color_enabled: color_enabled,
|
105
|
-
snippet: "expect(true).not_to be(true)",
|
106
|
-
expectation:
|
107
|
-
proc do
|
108
|
-
line do
|
109
|
-
plain "Expected "
|
110
|
-
actual "true"
|
111
|
-
plain " not to equal "
|
112
|
-
expected "true"
|
113
|
-
plain "."
|
114
|
-
end
|
115
|
-
end
|
116
|
-
)
|
117
|
-
|
118
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
119
|
-
color_enabled
|
120
|
-
)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context "with no arguments" do
|
127
|
-
it "produces the correct failure message when used in the positive" do
|
128
|
-
as_both_colored_and_uncolored do |color_enabled|
|
129
|
-
program =
|
130
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
131
|
-
expect(nil).to be
|
132
|
-
TEST
|
133
|
-
|
134
|
-
expected_output =
|
135
|
-
build_expected_output(
|
136
|
-
color_enabled: color_enabled,
|
137
|
-
snippet: "expect(nil).to be",
|
138
|
-
expectation:
|
139
|
-
proc do
|
140
|
-
line do
|
141
|
-
plain "Expected "
|
142
|
-
actual "nil"
|
143
|
-
plain " to be "
|
144
|
-
expected "truthy"
|
145
|
-
plain "."
|
146
|
-
end
|
147
|
-
end
|
148
|
-
)
|
149
|
-
|
150
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
151
|
-
color_enabled
|
152
|
-
)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
it "produces the correct failure message when used in the negative" do
|
157
|
-
as_both_colored_and_uncolored do |color_enabled|
|
158
|
-
program =
|
159
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
160
|
-
expect(:something).not_to be
|
161
|
-
TEST
|
162
|
-
|
163
|
-
expected_output =
|
164
|
-
build_expected_output(
|
165
|
-
color_enabled: color_enabled,
|
166
|
-
snippet: "expect(:something).not_to be",
|
167
|
-
expectation:
|
168
|
-
proc do
|
169
|
-
line do
|
170
|
-
plain "Expected "
|
171
|
-
actual ":something"
|
172
|
-
plain " not to be "
|
173
|
-
expected "truthy"
|
174
|
-
plain "."
|
175
|
-
end
|
176
|
-
end
|
177
|
-
)
|
178
|
-
|
179
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
180
|
-
color_enabled
|
181
|
-
)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
context "with ==" do
|
187
|
-
it "produces the correct failure message when used in the positive" do
|
188
|
-
as_both_colored_and_uncolored do |color_enabled|
|
189
|
-
program =
|
190
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
191
|
-
expect(nil).to be == :foo
|
192
|
-
TEST
|
193
|
-
|
194
|
-
expected_output =
|
195
|
-
build_expected_output(
|
196
|
-
color_enabled: color_enabled,
|
197
|
-
snippet: "expect(nil).to be == :foo",
|
198
|
-
expectation:
|
199
|
-
proc do
|
200
|
-
line do
|
201
|
-
plain "Expected "
|
202
|
-
actual "nil"
|
203
|
-
plain " to == "
|
204
|
-
expected ":foo"
|
205
|
-
plain "."
|
206
|
-
end
|
207
|
-
end
|
208
|
-
)
|
209
|
-
|
210
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
211
|
-
color_enabled
|
212
|
-
)
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
it "produces the correct failure message when used in the negative" do
|
217
|
-
as_both_colored_and_uncolored do |color_enabled|
|
218
|
-
program =
|
219
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
220
|
-
expect(:foo).not_to be == :foo
|
221
|
-
TEST
|
222
|
-
|
223
|
-
expected_output =
|
224
|
-
build_expected_output(
|
225
|
-
color_enabled: color_enabled,
|
226
|
-
snippet: "expect(:foo).not_to be == :foo",
|
227
|
-
expectation:
|
228
|
-
proc do
|
229
|
-
line do
|
230
|
-
plain "Expected "
|
231
|
-
actual ":foo"
|
232
|
-
plain " not to == "
|
233
|
-
expected ":foo"
|
234
|
-
plain "."
|
235
|
-
end
|
236
|
-
end
|
237
|
-
)
|
238
|
-
|
239
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
240
|
-
color_enabled
|
241
|
-
)
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
context "with <" do
|
247
|
-
it "produces the correct failure message when used in the positive" do
|
248
|
-
as_both_colored_and_uncolored do |color_enabled|
|
249
|
-
program =
|
250
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
251
|
-
expect(1).to be < 1
|
252
|
-
TEST
|
253
|
-
|
254
|
-
expected_output =
|
255
|
-
build_expected_output(
|
256
|
-
color_enabled: color_enabled,
|
257
|
-
snippet: "expect(1).to be < 1",
|
258
|
-
expectation:
|
259
|
-
proc do
|
260
|
-
line do
|
261
|
-
plain "Expected "
|
262
|
-
actual "1"
|
263
|
-
plain " to be < "
|
264
|
-
expected "1"
|
265
|
-
plain "."
|
266
|
-
end
|
267
|
-
end
|
268
|
-
)
|
269
|
-
|
270
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
271
|
-
color_enabled
|
272
|
-
)
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
it "produces the correct failure message when used in the negative" do
|
277
|
-
as_both_colored_and_uncolored do |color_enabled|
|
278
|
-
program =
|
279
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
280
|
-
expect(0).not_to be < 1
|
281
|
-
TEST
|
282
|
-
|
283
|
-
expected_output =
|
284
|
-
build_expected_output(
|
285
|
-
color_enabled: color_enabled,
|
286
|
-
snippet: "expect(0).not_to be < 1",
|
287
|
-
expectation:
|
288
|
-
proc do
|
289
|
-
line do
|
290
|
-
plain "Expected "
|
291
|
-
actual "0"
|
292
|
-
plain " not to be < "
|
293
|
-
expected "1"
|
294
|
-
plain "."
|
295
|
-
end
|
296
|
-
end
|
297
|
-
)
|
298
|
-
|
299
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
300
|
-
color_enabled
|
301
|
-
)
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
context "with <=" do
|
307
|
-
it "produces the correct failure message when used in the positive" do
|
308
|
-
as_both_colored_and_uncolored do |color_enabled|
|
309
|
-
program =
|
310
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
311
|
-
expect(1).to be <= 0
|
312
|
-
TEST
|
313
|
-
|
314
|
-
expected_output =
|
315
|
-
build_expected_output(
|
316
|
-
color_enabled: color_enabled,
|
317
|
-
snippet: "expect(1).to be <= 0",
|
318
|
-
expectation:
|
319
|
-
proc do
|
320
|
-
line do
|
321
|
-
plain "Expected "
|
322
|
-
actual "1"
|
323
|
-
plain " to be <= "
|
324
|
-
expected "0"
|
325
|
-
plain "."
|
326
|
-
end
|
327
|
-
end
|
328
|
-
)
|
329
|
-
|
330
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
331
|
-
color_enabled
|
332
|
-
)
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
it "produces the correct failure message when used in the negative" do
|
337
|
-
as_both_colored_and_uncolored do |color_enabled|
|
338
|
-
program =
|
339
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
340
|
-
expect(0).not_to be <= 0
|
341
|
-
TEST
|
342
|
-
|
343
|
-
expected_output =
|
344
|
-
build_expected_output(
|
345
|
-
color_enabled: color_enabled,
|
346
|
-
snippet: "expect(0).not_to be <= 0",
|
347
|
-
expectation:
|
348
|
-
proc do
|
349
|
-
line do
|
350
|
-
plain "Expected "
|
351
|
-
actual "0"
|
352
|
-
plain " not to be <= "
|
353
|
-
expected "0"
|
354
|
-
plain "."
|
355
|
-
end
|
356
|
-
end
|
357
|
-
)
|
358
|
-
|
359
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
360
|
-
color_enabled
|
361
|
-
)
|
362
|
-
end
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
context "with >=" do
|
367
|
-
it "produces the correct failure message when used in the positive" do
|
368
|
-
as_both_colored_and_uncolored do |color_enabled|
|
369
|
-
program =
|
370
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
371
|
-
expect(1).to be >= 2
|
372
|
-
TEST
|
373
|
-
|
374
|
-
expected_output =
|
375
|
-
build_expected_output(
|
376
|
-
color_enabled: color_enabled,
|
377
|
-
snippet: "expect(1).to be >= 2",
|
378
|
-
expectation:
|
379
|
-
proc do
|
380
|
-
line do
|
381
|
-
plain "Expected "
|
382
|
-
actual "1"
|
383
|
-
plain " to be >= "
|
384
|
-
expected "2"
|
385
|
-
plain "."
|
386
|
-
end
|
387
|
-
end
|
388
|
-
)
|
389
|
-
|
390
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
391
|
-
color_enabled
|
392
|
-
)
|
393
|
-
end
|
394
|
-
end
|
395
|
-
|
396
|
-
it "produces the correct failure message when used in the negative" do
|
397
|
-
as_both_colored_and_uncolored do |color_enabled|
|
398
|
-
program =
|
399
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
400
|
-
expect(2).not_to be >= 2
|
401
|
-
TEST
|
402
|
-
|
403
|
-
expected_output =
|
404
|
-
build_expected_output(
|
405
|
-
color_enabled: color_enabled,
|
406
|
-
snippet: "expect(2).not_to be >= 2",
|
407
|
-
expectation:
|
408
|
-
proc do
|
409
|
-
line do
|
410
|
-
plain "Expected "
|
411
|
-
actual "2"
|
412
|
-
plain " not to be >= "
|
413
|
-
expected "2"
|
414
|
-
plain "."
|
415
|
-
end
|
416
|
-
end
|
417
|
-
)
|
418
|
-
|
419
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
420
|
-
color_enabled
|
421
|
-
)
|
422
|
-
end
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
context "with >" do
|
427
|
-
it "produces the correct failure message when used in the positive" do
|
428
|
-
as_both_colored_and_uncolored do |color_enabled|
|
429
|
-
program =
|
430
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
431
|
-
expect(1).to be > 2
|
432
|
-
TEST
|
433
|
-
|
434
|
-
expected_output =
|
435
|
-
build_expected_output(
|
436
|
-
color_enabled: color_enabled,
|
437
|
-
snippet: "expect(1).to be > 2",
|
438
|
-
expectation:
|
439
|
-
proc do
|
440
|
-
line do
|
441
|
-
plain "Expected "
|
442
|
-
actual "1"
|
443
|
-
plain " to be > "
|
444
|
-
expected "2"
|
445
|
-
plain "."
|
446
|
-
end
|
447
|
-
end
|
448
|
-
)
|
449
|
-
|
450
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
451
|
-
color_enabled
|
452
|
-
)
|
453
|
-
end
|
454
|
-
end
|
455
|
-
|
456
|
-
it "produces the correct failure message when used in the negative" do
|
457
|
-
as_both_colored_and_uncolored do |color_enabled|
|
458
|
-
program =
|
459
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
460
|
-
expect(3).not_to be > 2
|
461
|
-
TEST
|
462
|
-
|
463
|
-
expected_output =
|
464
|
-
build_expected_output(
|
465
|
-
color_enabled: color_enabled,
|
466
|
-
snippet: "expect(3).not_to be > 2",
|
467
|
-
expectation:
|
468
|
-
proc do
|
469
|
-
line do
|
470
|
-
plain "Expected "
|
471
|
-
actual "3"
|
472
|
-
plain " not to be > "
|
473
|
-
expected "2"
|
474
|
-
plain "."
|
475
|
-
end
|
476
|
-
end
|
477
|
-
)
|
478
|
-
|
479
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
480
|
-
color_enabled
|
481
|
-
)
|
482
|
-
end
|
483
|
-
end
|
484
|
-
end
|
485
|
-
|
486
|
-
context "with ===" do
|
487
|
-
it "produces the correct failure message when used in the positive" do
|
488
|
-
as_both_colored_and_uncolored do |color_enabled|
|
489
|
-
program =
|
490
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
491
|
-
expect(String).to be === :foo
|
492
|
-
TEST
|
493
|
-
|
494
|
-
expected_output =
|
495
|
-
build_expected_output(
|
496
|
-
color_enabled: color_enabled,
|
497
|
-
snippet: "expect(String).to be === :foo",
|
498
|
-
expectation:
|
499
|
-
proc do
|
500
|
-
line do
|
501
|
-
plain "Expected "
|
502
|
-
actual "String"
|
503
|
-
plain " to === "
|
504
|
-
expected ":foo"
|
505
|
-
plain "."
|
506
|
-
end
|
507
|
-
end
|
508
|
-
)
|
509
|
-
|
510
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
511
|
-
color_enabled
|
512
|
-
)
|
513
|
-
end
|
514
|
-
end
|
515
|
-
|
516
|
-
it "produces the correct failure message when used in the negative" do
|
517
|
-
as_both_colored_and_uncolored do |color_enabled|
|
518
|
-
program =
|
519
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
520
|
-
expect(String).not_to be === "foo"
|
521
|
-
TEST
|
522
|
-
|
523
|
-
expected_output =
|
524
|
-
build_expected_output(
|
525
|
-
color_enabled: color_enabled,
|
526
|
-
snippet: %|expect(String).not_to be === "foo"|,
|
527
|
-
expectation:
|
528
|
-
proc do
|
529
|
-
line do
|
530
|
-
plain "Expected "
|
531
|
-
actual "String"
|
532
|
-
plain " not to === "
|
533
|
-
expected %|"foo"|
|
534
|
-
plain "."
|
535
|
-
end
|
536
|
-
end
|
537
|
-
)
|
538
|
-
|
539
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
540
|
-
color_enabled
|
541
|
-
)
|
542
|
-
end
|
543
|
-
end
|
544
|
-
end
|
545
|
-
|
546
|
-
context "with =~" do
|
547
|
-
it "produces the correct failure message when used in the positive" do
|
548
|
-
as_both_colored_and_uncolored do |color_enabled|
|
549
|
-
program =
|
550
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
551
|
-
expect("foo").to be =~ /bar/
|
552
|
-
TEST
|
553
|
-
|
554
|
-
expected_output =
|
555
|
-
build_expected_output(
|
556
|
-
color_enabled: color_enabled,
|
557
|
-
snippet: %|expect("foo").to be =~ /bar/|,
|
558
|
-
expectation:
|
559
|
-
proc do
|
560
|
-
line do
|
561
|
-
plain "Expected "
|
562
|
-
actual %|"foo"|
|
563
|
-
plain " to =~ "
|
564
|
-
expected "/bar/"
|
565
|
-
plain "."
|
566
|
-
end
|
567
|
-
end
|
568
|
-
)
|
569
|
-
|
570
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
571
|
-
color_enabled
|
572
|
-
)
|
573
|
-
end
|
574
|
-
end
|
575
|
-
|
576
|
-
it "produces the correct failure message when used in the negative" do
|
577
|
-
as_both_colored_and_uncolored do |color_enabled|
|
578
|
-
program =
|
579
|
-
make_plain_test_program(<<~TEST.strip, color_enabled: color_enabled)
|
580
|
-
expect("bar").not_to be =~ /bar/
|
581
|
-
TEST
|
582
|
-
|
583
|
-
expected_output =
|
584
|
-
build_expected_output(
|
585
|
-
color_enabled: color_enabled,
|
586
|
-
snippet: %|expect("bar").not_to be =~ /bar/|,
|
587
|
-
expectation:
|
588
|
-
proc do
|
589
|
-
line do
|
590
|
-
plain "Expected "
|
591
|
-
actual %|"bar"|
|
592
|
-
plain " not to =~ "
|
593
|
-
expected "/bar/"
|
594
|
-
plain "."
|
595
|
-
end
|
596
|
-
end
|
597
|
-
)
|
598
|
-
|
599
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
600
|
-
color_enabled
|
601
|
-
)
|
602
|
-
end
|
603
|
-
end
|
604
|
-
end
|
605
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe "Integration with RSpec's #be_nil matcher", type: :integration do
|
4
|
-
it "produces the correct failure message when used the positive" do
|
5
|
-
as_both_colored_and_uncolored do |color_enabled|
|
6
|
-
snippet = "expect(:foo).to be_nil"
|
7
|
-
program = make_plain_test_program(snippet, color_enabled: color_enabled)
|
8
|
-
|
9
|
-
expected_output =
|
10
|
-
build_expected_output(
|
11
|
-
color_enabled: color_enabled,
|
12
|
-
snippet: "expect(:foo).to be_nil",
|
13
|
-
expectation:
|
14
|
-
proc do
|
15
|
-
line do
|
16
|
-
plain "Expected "
|
17
|
-
actual ":foo"
|
18
|
-
plain " to be "
|
19
|
-
expected "nil"
|
20
|
-
plain "."
|
21
|
-
end
|
22
|
-
end
|
23
|
-
)
|
24
|
-
|
25
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
26
|
-
color_enabled
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it "produces the correct failure message when used in the negative" do
|
32
|
-
as_both_colored_and_uncolored do |color_enabled|
|
33
|
-
snippet = "expect(nil).not_to be_nil"
|
34
|
-
program = make_plain_test_program(snippet, color_enabled: color_enabled)
|
35
|
-
|
36
|
-
expected_output =
|
37
|
-
build_expected_output(
|
38
|
-
color_enabled: color_enabled,
|
39
|
-
snippet: "expect(nil).not_to be_nil",
|
40
|
-
expectation:
|
41
|
-
proc do
|
42
|
-
line do
|
43
|
-
plain "Expected "
|
44
|
-
actual "nil"
|
45
|
-
plain " not to be "
|
46
|
-
expected "nil"
|
47
|
-
plain "."
|
48
|
-
end
|
49
|
-
end
|
50
|
-
)
|
51
|
-
|
52
|
-
expect(program).to produce_output_when_run(expected_output).in_color(
|
53
|
-
color_enabled
|
54
|
-
)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|