super_diff 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,46 +1,48 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "spec_helper"
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            RSpec.describe "Integration with RSpec's #include matcher", 
     | 
| 
      
 3 
     | 
    
         
            +
            RSpec.describe "Integration with RSpec's #include matcher",
         
     | 
| 
      
 4 
     | 
    
         
            +
                           type: :integration do
         
     | 
| 
       4 
5 
     | 
    
         
             
              context "when used against an array" do
         
     | 
| 
       5 
6 
     | 
    
         
             
                context "that is small" do
         
     | 
| 
       6 
7 
     | 
    
         
             
                  it "produces the correct failure message when used in the positive" do
         
     | 
| 
       7 
8 
     | 
    
         
             
                    as_both_colored_and_uncolored do |color_enabled|
         
     | 
| 
       8 
9 
     | 
    
         
             
                      snippet = <<~TEST.strip
         
     | 
| 
       9 
10 
     | 
    
         
             
                        expected = ["Marty", "Einie"]
         
     | 
| 
       10 
     | 
    
         
            -
                        actual 
     | 
| 
      
 11 
     | 
    
         
            +
                        actual = ["Marty", "Jennifer", "Doc"]
         
     | 
| 
       11 
12 
     | 
    
         
             
                        expect(actual).to include(*expected)
         
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                           
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 18 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 19 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 20 
     | 
    
         
            +
                          snippet: "expect(actual).to include(*expected)",
         
     | 
| 
      
 21 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 22 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 23 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 24 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 25 
     | 
    
         
            +
                                actual %|["Marty", "Jennifer", "Doc"]|
         
     | 
| 
      
 26 
     | 
    
         
            +
                                plain " to include "
         
     | 
| 
      
 27 
     | 
    
         
            +
                                expected %|"Einie"|
         
     | 
| 
      
 28 
     | 
    
         
            +
                                plain "."
         
     | 
| 
      
 29 
     | 
    
         
            +
                              end
         
     | 
| 
      
 30 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 31 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 32 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 33 
     | 
    
         
            +
                              plain_line "  ["
         
     | 
| 
      
 34 
     | 
    
         
            +
                              plain_line %|    "Marty",|
         
     | 
| 
      
 35 
     | 
    
         
            +
                              plain_line %|    "Jennifer",|
         
     | 
| 
      
 36 
     | 
    
         
            +
                              # plain_line    %|    "Doc",|   # FIXME
         
     | 
| 
      
 37 
     | 
    
         
            +
                              plain_line %|    "Doc"|
         
     | 
| 
      
 38 
     | 
    
         
            +
                              expected_line %|-   "Einie"|
         
     | 
| 
      
 39 
     | 
    
         
            +
                              plain_line "  ]"
         
     | 
| 
      
 40 
     | 
    
         
            +
                            end
         
     | 
| 
      
 41 
     | 
    
         
            +
                        )
         
     | 
| 
       40 
42 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       42 
     | 
    
         
            -
                         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 43 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 44 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 45 
     | 
    
         
            +
                      )
         
     | 
| 
       44 
46 
     | 
    
         
             
                    end
         
     | 
| 
       45 
47 
     | 
    
         
             
                  end
         
     | 
| 
       46 
48 
     | 
    
         | 
| 
         @@ -50,28 +52,28 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       50 
52 
     | 
    
         
             
                        values = ["Marty", "Einie"]
         
     | 
| 
       51 
53 
     | 
    
         
             
                        expect(values).not_to include(*values)
         
     | 
| 
       52 
54 
     | 
    
         
             
                      TEST
         
     | 
| 
       53 
     | 
    
         
            -
                      program = 
     | 
| 
       54 
     | 
    
         
            -
                        snippet,
         
     | 
| 
       55 
     | 
    
         
            -
                        color_enabled: color_enabled,
         
     | 
| 
       56 
     | 
    
         
            -
                      )
         
     | 
| 
      
 55 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 56 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       59 
     | 
    
         
            -
                         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                           
     | 
| 
       63 
     | 
    
         
            -
                             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 59 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 60 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 61 
     | 
    
         
            +
                          snippet: "expect(values).not_to include(*values)",
         
     | 
| 
      
 62 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 63 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 64 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 65 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 66 
     | 
    
         
            +
                                actual %|["Marty", "Einie"]|
         
     | 
| 
      
 67 
     | 
    
         
            +
                                plain " not to include "
         
     | 
| 
      
 68 
     | 
    
         
            +
                                expected %|"Marty" and "Einie"|
         
     | 
| 
      
 69 
     | 
    
         
            +
                                plain "."
         
     | 
| 
      
 70 
     | 
    
         
            +
                              end
         
     | 
| 
      
 71 
     | 
    
         
            +
                            end
         
     | 
| 
      
 72 
     | 
    
         
            +
                        )
         
     | 
| 
       71 
73 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       73 
     | 
    
         
            -
                         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 75 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 76 
     | 
    
         
            +
                      )
         
     | 
| 
       75 
77 
     | 
    
         
             
                    end
         
     | 
| 
       76 
78 
     | 
    
         
             
                  end
         
     | 
| 
       77 
79 
     | 
    
         
             
                end
         
     | 
| 
         @@ -88,7 +90,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       88 
90 
     | 
    
         
             
                          "George McFly",
         
     | 
| 
       89 
91 
     | 
    
         
             
                          "Lorraine McFly"
         
     | 
| 
       90 
92 
     | 
    
         
             
                        ]
         
     | 
| 
       91 
     | 
    
         
            -
                        actual 
     | 
| 
      
 93 
     | 
    
         
            +
                        actual = [
         
     | 
| 
       92 
94 
     | 
    
         
             
                          "Marty McFly",
         
     | 
| 
       93 
95 
     | 
    
         
             
                          "Doc Brown",
         
     | 
| 
       94 
96 
     | 
    
         
             
                          "Einie",
         
     | 
| 
         @@ -96,41 +98,42 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       96 
98 
     | 
    
         
             
                        ]
         
     | 
| 
       97 
99 
     | 
    
         
             
                        expect(actual).to include(*expected)
         
     | 
| 
       98 
100 
     | 
    
         
             
                      TEST
         
     | 
| 
       99 
     | 
    
         
            -
                      program = 
     | 
| 
       100 
     | 
    
         
            -
                        snippet,
         
     | 
| 
       101 
     | 
    
         
            -
                        color_enabled: color_enabled,
         
     | 
| 
       102 
     | 
    
         
            -
                      )
         
     | 
| 
      
 101 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 102 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
       104 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       105 
     | 
    
         
            -
                         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                           
     | 
| 
       109 
     | 
    
         
            -
                             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                           
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 105 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 106 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 107 
     | 
    
         
            +
                          snippet: "expect(actual).to include(*expected)",
         
     | 
| 
      
 108 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 109 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 110 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 111 
     | 
    
         
            +
                                plain "  Expected "
         
     | 
| 
      
 112 
     | 
    
         
            +
                                actual %|["Marty McFly", "Doc Brown", "Einie", "Lorraine McFly"]|
         
     | 
| 
      
 113 
     | 
    
         
            +
                              end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 116 
     | 
    
         
            +
                                plain "to include "
         
     | 
| 
      
 117 
     | 
    
         
            +
                                expected %|"Biff Tannen" and "George McFly"|
         
     | 
| 
      
 118 
     | 
    
         
            +
                              end
         
     | 
| 
      
 119 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 120 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 121 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 122 
     | 
    
         
            +
                              plain_line "  ["
         
     | 
| 
      
 123 
     | 
    
         
            +
                              plain_line %|    "Marty McFly",|
         
     | 
| 
      
 124 
     | 
    
         
            +
                              plain_line %|    "Doc Brown",|
         
     | 
| 
      
 125 
     | 
    
         
            +
                              plain_line %|    "Einie",|
         
     | 
| 
      
 126 
     | 
    
         
            +
                              # plain_line    %|    "Lorraine McFly",|   # FIXME
         
     | 
| 
      
 127 
     | 
    
         
            +
                              plain_line %|    "Lorraine McFly"|
         
     | 
| 
      
 128 
     | 
    
         
            +
                              expected_line %|-   "Biff Tannen",|
         
     | 
| 
      
 129 
     | 
    
         
            +
                              expected_line %|-   "George McFly"|
         
     | 
| 
      
 130 
     | 
    
         
            +
                              plain_line "  ]"
         
     | 
| 
      
 131 
     | 
    
         
            +
                            end
         
     | 
| 
      
 132 
     | 
    
         
            +
                        )
         
     | 
| 
       130 
133 
     | 
    
         | 
| 
       131 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       132 
     | 
    
         
            -
                         
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
      
 134 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 135 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 136 
     | 
    
         
            +
                      )
         
     | 
| 
       134 
137 
     | 
    
         
             
                    end
         
     | 
| 
       135 
138 
     | 
    
         
             
                  end
         
     | 
| 
       136 
139 
     | 
    
         | 
| 
         @@ -143,7 +146,7 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       143 
146 
     | 
    
         
             
                          "Einie",
         
     | 
| 
       144 
147 
     | 
    
         
             
                          "Lorraine McFly"
         
     | 
| 
       145 
148 
     | 
    
         
             
                        ]
         
     | 
| 
       146 
     | 
    
         
            -
                        actual 
     | 
| 
      
 149 
     | 
    
         
            +
                        actual = [
         
     | 
| 
       147 
150 
     | 
    
         
             
                          "Marty McFly",
         
     | 
| 
       148 
151 
     | 
    
         
             
                          "Doc Brown",
         
     | 
| 
       149 
152 
     | 
    
         
             
                          "Einie",
         
     | 
| 
         @@ -153,31 +156,31 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       153 
156 
     | 
    
         
             
                        ]
         
     | 
| 
       154 
157 
     | 
    
         
             
                        expect(actual).not_to include(*expected)
         
     | 
| 
       155 
158 
     | 
    
         
             
                      TEST
         
     | 
| 
       156 
     | 
    
         
            -
                      program = 
     | 
| 
       157 
     | 
    
         
            -
                        snippet,
         
     | 
| 
       158 
     | 
    
         
            -
                        color_enabled: color_enabled,
         
     | 
| 
       159 
     | 
    
         
            -
                      )
         
     | 
| 
      
 159 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 160 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       160 
161 
     | 
    
         | 
| 
       161 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       162 
     | 
    
         
            -
                         
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
                           
     | 
| 
       167 
     | 
    
         
            -
                             
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
      
 162 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 163 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 164 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 165 
     | 
    
         
            +
                          snippet: "expect(actual).not_to include(*expected)",
         
     | 
| 
      
 166 
     | 
    
         
            +
                          newline_before_expectation: true,
         
     | 
| 
      
 167 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 168 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 169 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 170 
     | 
    
         
            +
                                plain "      Expected "
         
     | 
| 
      
 171 
     | 
    
         
            +
                                actual %|["Marty McFly", "Doc Brown", "Einie", "Biff Tannen", "George McFly", "Lorraine McFly"]|
         
     | 
| 
      
 172 
     | 
    
         
            +
                              end
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 175 
     | 
    
         
            +
                                plain "not to include "
         
     | 
| 
      
 176 
     | 
    
         
            +
                                expected %|"Marty McFly", "Doc Brown", "Einie", and "Lorraine McFly"|
         
     | 
| 
      
 177 
     | 
    
         
            +
                              end
         
     | 
| 
      
 178 
     | 
    
         
            +
                            end
         
     | 
| 
      
 179 
     | 
    
         
            +
                        )
         
     | 
| 
       177 
180 
     | 
    
         | 
| 
       178 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       179 
     | 
    
         
            -
                         
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
      
 181 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 182 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 183 
     | 
    
         
            +
                      )
         
     | 
| 
       181 
184 
     | 
    
         
             
                    end
         
     | 
| 
       182 
185 
     | 
    
         
             
                  end
         
     | 
| 
       183 
186 
     | 
    
         
             
                end
         
     | 
| 
         @@ -189,41 +192,42 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       189 
192 
     | 
    
         
             
                    as_both_colored_and_uncolored do |color_enabled|
         
     | 
| 
       190 
193 
     | 
    
         
             
                      snippet = <<~TEST.strip
         
     | 
| 
       191 
194 
     | 
    
         
             
                        expected = { city: "Hill Valley", state: "CA" }
         
     | 
| 
       192 
     | 
    
         
            -
                        actual 
     | 
| 
      
 195 
     | 
    
         
            +
                        actual = { city: "Burbank", zip: "90210" }
         
     | 
| 
       193 
196 
     | 
    
         
             
                        expect(actual).to include(expected)
         
     | 
| 
       194 
197 
     | 
    
         
             
                      TEST
         
     | 
| 
       195 
     | 
    
         
            -
                      program = 
     | 
| 
       196 
     | 
    
         
            -
                        snippet,
         
     | 
| 
       197 
     | 
    
         
            -
                        color_enabled: color_enabled,
         
     | 
| 
       198 
     | 
    
         
            -
                      )
         
     | 
| 
      
 198 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 199 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       199 
200 
     | 
    
         | 
| 
       200 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       201 
     | 
    
         
            -
                         
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
                           
     | 
| 
       205 
     | 
    
         
            -
                             
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
             
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
                           
     | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
             
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
      
 201 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 202 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 203 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 204 
     | 
    
         
            +
                          snippet: "expect(actual).to include(expected)",
         
     | 
| 
      
 205 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 206 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 207 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 208 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 209 
     | 
    
         
            +
                                actual %|{ city: "Burbank", zip: "90210" }|
         
     | 
| 
      
 210 
     | 
    
         
            +
                                plain " to include "
         
     | 
| 
      
 211 
     | 
    
         
            +
                                expected %|(city: "Hill Valley", state: "CA")|
         
     | 
| 
      
 212 
     | 
    
         
            +
                                plain "."
         
     | 
| 
      
 213 
     | 
    
         
            +
                              end
         
     | 
| 
      
 214 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 215 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 216 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 217 
     | 
    
         
            +
                              plain_line "  {"
         
     | 
| 
      
 218 
     | 
    
         
            +
                              expected_line %|-   city: "Hill Valley",|
         
     | 
| 
      
 219 
     | 
    
         
            +
                              actual_line %|+   city: "Burbank",|
         
     | 
| 
      
 220 
     | 
    
         
            +
                              # FIXME
         
     | 
| 
      
 221 
     | 
    
         
            +
                              # expected_line %|-   state: "CA",|
         
     | 
| 
      
 222 
     | 
    
         
            +
                              expected_line %|-   state: "CA"|
         
     | 
| 
      
 223 
     | 
    
         
            +
                              plain_line %|    zip: "90210"|
         
     | 
| 
      
 224 
     | 
    
         
            +
                              plain_line "  }"
         
     | 
| 
      
 225 
     | 
    
         
            +
                            end
         
     | 
| 
      
 226 
     | 
    
         
            +
                        )
         
     | 
| 
       223 
227 
     | 
    
         | 
| 
       224 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       225 
     | 
    
         
            -
                         
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
      
 228 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 229 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 230 
     | 
    
         
            +
                      )
         
     | 
| 
       227 
231 
     | 
    
         
             
                    end
         
     | 
| 
       228 
232 
     | 
    
         
             
                  end
         
     | 
| 
       229 
233 
     | 
    
         | 
| 
         @@ -231,31 +235,72 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       231 
235 
     | 
    
         
             
                    as_both_colored_and_uncolored do |color_enabled|
         
     | 
| 
       232 
236 
     | 
    
         
             
                      snippet = <<~TEST.strip
         
     | 
| 
       233 
237 
     | 
    
         
             
                        expected = { city: "Burbank" }
         
     | 
| 
       234 
     | 
    
         
            -
                        actual 
     | 
| 
      
 238 
     | 
    
         
            +
                        actual = { city: "Burbank", zip: "90210" }
         
     | 
| 
       235 
239 
     | 
    
         
             
                        expect(actual).not_to include(expected)
         
     | 
| 
       236 
240 
     | 
    
         
             
                      TEST
         
     | 
| 
       237 
     | 
    
         
            -
                      program = 
     | 
| 
       238 
     | 
    
         
            -
                        snippet,
         
     | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
       240 
     | 
    
         
            -
                       
     | 
| 
      
 241 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 242 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 245 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 246 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 247 
     | 
    
         
            +
                          snippet: "expect(actual).not_to include(expected)",
         
     | 
| 
      
 248 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 249 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 250 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 251 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 252 
     | 
    
         
            +
                                actual %|{ city: "Burbank", zip: "90210" }|
         
     | 
| 
      
 253 
     | 
    
         
            +
                                plain " not to include "
         
     | 
| 
      
 254 
     | 
    
         
            +
                                expected %|(city: "Burbank")|
         
     | 
| 
      
 255 
     | 
    
         
            +
                                plain "."
         
     | 
| 
      
 256 
     | 
    
         
            +
                              end
         
     | 
| 
      
 257 
     | 
    
         
            +
                            end
         
     | 
| 
      
 258 
     | 
    
         
            +
                        )
         
     | 
| 
       241 
259 
     | 
    
         | 
| 
       242 
     | 
    
         
            -
                       
     | 
| 
       243 
     | 
    
         
            -
                        color_enabled 
     | 
| 
       244 
     | 
    
         
            -
                        snippet: %|expect(actual).not_to include(expected)|,
         
     | 
| 
       245 
     | 
    
         
            -
                        expectation: proc {
         
     | 
| 
       246 
     | 
    
         
            -
                          line do
         
     | 
| 
       247 
     | 
    
         
            -
                            plain    %|Expected |
         
     | 
| 
       248 
     | 
    
         
            -
                            actual   %|{ city: "Burbank", zip: "90210" }|
         
     | 
| 
       249 
     | 
    
         
            -
                            plain    %| not to include |
         
     | 
| 
       250 
     | 
    
         
            -
                            expected %|(city: "Burbank")|
         
     | 
| 
       251 
     | 
    
         
            -
                            plain    %|.|
         
     | 
| 
       252 
     | 
    
         
            -
                          end
         
     | 
| 
       253 
     | 
    
         
            -
                        },
         
     | 
| 
      
 260 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 261 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
       254 
262 
     | 
    
         
             
                      )
         
     | 
| 
      
 263 
     | 
    
         
            +
                    end
         
     | 
| 
      
 264 
     | 
    
         
            +
                  end
         
     | 
| 
      
 265 
     | 
    
         
            +
             
     | 
| 
      
 266 
     | 
    
         
            +
                  it "produces the correct failure message when fuzzy matching" do
         
     | 
| 
      
 267 
     | 
    
         
            +
                    as_both_colored_and_uncolored do |color_enabled|
         
     | 
| 
      
 268 
     | 
    
         
            +
                      snippet = <<~TEST.strip
         
     | 
| 
      
 269 
     | 
    
         
            +
                        expected = { number: a_kind_of(Numeric), city: /burb/i, state: "CA" }
         
     | 
| 
      
 270 
     | 
    
         
            +
                        actual = { number: 42, city: "Burbank", zip: "90210" }
         
     | 
| 
      
 271 
     | 
    
         
            +
                        expect(actual).to include(expected)
         
     | 
| 
      
 272 
     | 
    
         
            +
                      TEST
         
     | 
| 
      
 273 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 274 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       255 
275 
     | 
    
         | 
| 
       256 
     | 
    
         
            -
                       
     | 
| 
       257 
     | 
    
         
            -
                         
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
      
 276 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 277 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 278 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 279 
     | 
    
         
            +
                          snippet: "expect(actual).to include(expected)",
         
     | 
| 
      
 280 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 281 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 282 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 283 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 284 
     | 
    
         
            +
                                actual %|{ number: 42, city: "Burbank", zip: "90210" }|
         
     | 
| 
      
 285 
     | 
    
         
            +
                                plain " to include "
         
     | 
| 
      
 286 
     | 
    
         
            +
                                expected %|(state: "CA")|
         
     | 
| 
      
 287 
     | 
    
         
            +
                                plain "."
         
     | 
| 
      
 288 
     | 
    
         
            +
                              end
         
     | 
| 
      
 289 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 290 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 291 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 292 
     | 
    
         
            +
                              plain_line "  {"
         
     | 
| 
      
 293 
     | 
    
         
            +
                              plain_line "    number: 42,"
         
     | 
| 
      
 294 
     | 
    
         
            +
                              plain_line %|    city: "Burbank",|
         
     | 
| 
      
 295 
     | 
    
         
            +
                              plain_line %|    zip: "90210"|
         
     | 
| 
      
 296 
     | 
    
         
            +
                              expected_line %|-   state: "CA"|
         
     | 
| 
      
 297 
     | 
    
         
            +
                              plain_line "  }"
         
     | 
| 
      
 298 
     | 
    
         
            +
                            end
         
     | 
| 
      
 299 
     | 
    
         
            +
                        )
         
     | 
| 
      
 300 
     | 
    
         
            +
             
     | 
| 
      
 301 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 302 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 303 
     | 
    
         
            +
                      )
         
     | 
| 
       259 
304 
     | 
    
         
             
                    end
         
     | 
| 
       260 
305 
     | 
    
         
             
                  end
         
     | 
| 
       261 
306 
     | 
    
         
             
                end
         
     | 
| 
         @@ -268,46 +313,47 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       268 
313 
     | 
    
         
             
                          city: "Hill Valley",
         
     | 
| 
       269 
314 
     | 
    
         
             
                          zip: "90382"
         
     | 
| 
       270 
315 
     | 
    
         
             
                        }
         
     | 
| 
       271 
     | 
    
         
            -
                        actual 
     | 
| 
      
 316 
     | 
    
         
            +
                        actual = {
         
     | 
| 
       272 
317 
     | 
    
         
             
                          city: "Burbank",
         
     | 
| 
       273 
318 
     | 
    
         
             
                          state: "CA",
         
     | 
| 
       274 
319 
     | 
    
         
             
                          zip: "90210"
         
     | 
| 
       275 
320 
     | 
    
         
             
                        }
         
     | 
| 
       276 
321 
     | 
    
         
             
                        expect(actual).to include(expected)
         
     | 
| 
       277 
322 
     | 
    
         
             
                      TEST
         
     | 
| 
       278 
     | 
    
         
            -
                      program = 
     | 
| 
       279 
     | 
    
         
            -
                        snippet,
         
     | 
| 
       280 
     | 
    
         
            -
                        color_enabled: color_enabled,
         
     | 
| 
       281 
     | 
    
         
            -
                      )
         
     | 
| 
      
 323 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 324 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       282 
325 
     | 
    
         | 
| 
       283 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       284 
     | 
    
         
            -
                         
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
                           
     | 
| 
       288 
     | 
    
         
            -
                             
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
                            plain    %|to include |
         
     | 
| 
       294 
     | 
    
         
            -
                            expected %|(city: "Hill Valley", zip: "90382")|
         
     | 
| 
       295 
     | 
    
         
            -
                          end
         
     | 
| 
       296 
     | 
    
         
            -
                        },
         
     | 
| 
       297 
     | 
    
         
            -
                        diff: proc {
         
     | 
| 
       298 
     | 
    
         
            -
                          plain_line    %|  {|
         
     | 
| 
       299 
     | 
    
         
            -
                          expected_line %|-   city: "Hill Valley",|
         
     | 
| 
       300 
     | 
    
         
            -
                          actual_line   %|+   city: "Burbank",|
         
     | 
| 
       301 
     | 
    
         
            -
                          plain_line    %|    state: "CA",|
         
     | 
| 
       302 
     | 
    
         
            -
                          expected_line %|-   zip: "90382"|
         
     | 
| 
       303 
     | 
    
         
            -
                          actual_line   %|+   zip: "90210"|
         
     | 
| 
       304 
     | 
    
         
            -
                          plain_line    %|  }|
         
     | 
| 
       305 
     | 
    
         
            -
                        },
         
     | 
| 
       306 
     | 
    
         
            -
                      )
         
     | 
| 
      
 326 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 327 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 328 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 329 
     | 
    
         
            +
                          snippet: "expect(actual).to include(expected)",
         
     | 
| 
      
 330 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 331 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 332 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 333 
     | 
    
         
            +
                                plain "  Expected "
         
     | 
| 
      
 334 
     | 
    
         
            +
                                actual %|{ city: "Burbank", state: "CA", zip: "90210" }|
         
     | 
| 
      
 335 
     | 
    
         
            +
                              end
         
     | 
| 
       307 
336 
     | 
    
         | 
| 
       308 
     | 
    
         
            -
             
     | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
      
 337 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 338 
     | 
    
         
            +
                                plain "to include "
         
     | 
| 
      
 339 
     | 
    
         
            +
                                expected %|(city: "Hill Valley", zip: "90382")|
         
     | 
| 
      
 340 
     | 
    
         
            +
                              end
         
     | 
| 
      
 341 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 342 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 343 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 344 
     | 
    
         
            +
                              plain_line "  {"
         
     | 
| 
      
 345 
     | 
    
         
            +
                              expected_line %|-   city: "Hill Valley",|
         
     | 
| 
      
 346 
     | 
    
         
            +
                              actual_line %|+   city: "Burbank",|
         
     | 
| 
      
 347 
     | 
    
         
            +
                              plain_line %|    state: "CA",|
         
     | 
| 
      
 348 
     | 
    
         
            +
                              expected_line %|-   zip: "90382"|
         
     | 
| 
      
 349 
     | 
    
         
            +
                              actual_line %|+   zip: "90210"|
         
     | 
| 
      
 350 
     | 
    
         
            +
                              plain_line "  }"
         
     | 
| 
      
 351 
     | 
    
         
            +
                            end
         
     | 
| 
      
 352 
     | 
    
         
            +
                        )
         
     | 
| 
      
 353 
     | 
    
         
            +
             
     | 
| 
      
 354 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 355 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 356 
     | 
    
         
            +
                      )
         
     | 
| 
       311 
357 
     | 
    
         
             
                    end
         
     | 
| 
       312 
358 
     | 
    
         
             
                  end
         
     | 
| 
       313 
359 
     | 
    
         | 
| 
         @@ -315,34 +361,90 @@ RSpec.describe "Integration with RSpec's #include matcher", type: :integration d 
     | 
|
| 
       315 
361 
     | 
    
         
             
                    as_both_colored_and_uncolored do |color_enabled|
         
     | 
| 
       316 
362 
     | 
    
         
             
                      snippet = <<~TEST.strip
         
     | 
| 
       317 
363 
     | 
    
         
             
                        expected = { city: "Hill Valley", state: "CA" }
         
     | 
| 
       318 
     | 
    
         
            -
                        actual 
     | 
| 
      
 364 
     | 
    
         
            +
                        actual = { city: "Hill Valley", state: "CA", zip: "90210" }
         
     | 
| 
       319 
365 
     | 
    
         
             
                        expect(actual).not_to include(expected)
         
     | 
| 
       320 
366 
     | 
    
         
             
                      TEST
         
     | 
| 
       321 
     | 
    
         
            -
                      program = 
     | 
| 
       322 
     | 
    
         
            -
                        snippet,
         
     | 
| 
       323 
     | 
    
         
            -
                        color_enabled: color_enabled,
         
     | 
| 
       324 
     | 
    
         
            -
                      )
         
     | 
| 
      
 367 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 368 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       325 
369 
     | 
    
         | 
| 
       326 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       327 
     | 
    
         
            -
                         
     | 
| 
       328 
     | 
    
         
            -
             
     | 
| 
       329 
     | 
    
         
            -
             
     | 
| 
       330 
     | 
    
         
            -
             
     | 
| 
       331 
     | 
    
         
            -
                           
     | 
| 
       332 
     | 
    
         
            -
                             
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
       334 
     | 
    
         
            -
             
     | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
     | 
    
         
            -
             
     | 
| 
       338 
     | 
    
         
            -
             
     | 
| 
       339 
     | 
    
         
            -
             
     | 
| 
       340 
     | 
    
         
            -
             
     | 
| 
      
 370 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 371 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 372 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 373 
     | 
    
         
            +
                          snippet: "expect(actual).not_to include(expected)",
         
     | 
| 
      
 374 
     | 
    
         
            +
                          newline_before_expectation: true,
         
     | 
| 
      
 375 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 376 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 377 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 378 
     | 
    
         
            +
                                plain "      Expected "
         
     | 
| 
      
 379 
     | 
    
         
            +
                                actual %|{ city: "Hill Valley", state: "CA", zip: "90210" }|
         
     | 
| 
      
 380 
     | 
    
         
            +
                              end
         
     | 
| 
      
 381 
     | 
    
         
            +
             
     | 
| 
      
 382 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 383 
     | 
    
         
            +
                                plain "not to include "
         
     | 
| 
      
 384 
     | 
    
         
            +
                                expected %|(city: "Hill Valley", state: "CA")|
         
     | 
| 
      
 385 
     | 
    
         
            +
                              end
         
     | 
| 
      
 386 
     | 
    
         
            +
                            end
         
     | 
| 
      
 387 
     | 
    
         
            +
                        )
         
     | 
| 
      
 388 
     | 
    
         
            +
             
     | 
| 
      
 389 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 390 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
       341 
391 
     | 
    
         
             
                      )
         
     | 
| 
      
 392 
     | 
    
         
            +
                    end
         
     | 
| 
      
 393 
     | 
    
         
            +
                  end
         
     | 
| 
      
 394 
     | 
    
         
            +
             
     | 
| 
      
 395 
     | 
    
         
            +
                  it "produces the correct failure message when fuzzy matching" do
         
     | 
| 
      
 396 
     | 
    
         
            +
                    as_both_colored_and_uncolored do |color_enabled|
         
     | 
| 
      
 397 
     | 
    
         
            +
                      snippet = <<~TEST.strip
         
     | 
| 
      
 398 
     | 
    
         
            +
                        expected = {
         
     | 
| 
      
 399 
     | 
    
         
            +
                          number: a_kind_of(Numeric),
         
     | 
| 
      
 400 
     | 
    
         
            +
                          street: "Yoshie Circles",
         
     | 
| 
      
 401 
     | 
    
         
            +
                          city: /burb/i,
         
     | 
| 
      
 402 
     | 
    
         
            +
                          zip: "90382"
         
     | 
| 
      
 403 
     | 
    
         
            +
                        }
         
     | 
| 
      
 404 
     | 
    
         
            +
                        actual = {
         
     | 
| 
      
 405 
     | 
    
         
            +
                          number: 42,
         
     | 
| 
      
 406 
     | 
    
         
            +
                          street: "Yoshie Circles",
         
     | 
| 
      
 407 
     | 
    
         
            +
                          city: "Burbank",
         
     | 
| 
      
 408 
     | 
    
         
            +
                          state: "CA",
         
     | 
| 
      
 409 
     | 
    
         
            +
                          zip: "90210"
         
     | 
| 
      
 410 
     | 
    
         
            +
                        }
         
     | 
| 
      
 411 
     | 
    
         
            +
                        expect(actual).to include(expected)
         
     | 
| 
      
 412 
     | 
    
         
            +
                      TEST
         
     | 
| 
      
 413 
     | 
    
         
            +
                      program =
         
     | 
| 
      
 414 
     | 
    
         
            +
                        make_plain_test_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       342 
415 
     | 
    
         | 
| 
       343 
     | 
    
         
            -
                       
     | 
| 
       344 
     | 
    
         
            -
                         
     | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
      
 416 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 417 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 418 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 419 
     | 
    
         
            +
                          snippet: "expect(actual).to include(expected)",
         
     | 
| 
      
 420 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 421 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 422 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 423 
     | 
    
         
            +
                                plain "  Expected "
         
     | 
| 
      
 424 
     | 
    
         
            +
                                actual %|{ number: 42, street: "Yoshie Circles", city: "Burbank", state: "CA", zip: "90210" }|
         
     | 
| 
      
 425 
     | 
    
         
            +
                              end
         
     | 
| 
      
 426 
     | 
    
         
            +
             
     | 
| 
      
 427 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 428 
     | 
    
         
            +
                                plain "to include "
         
     | 
| 
      
 429 
     | 
    
         
            +
                                expected %|(zip: "90382")|
         
     | 
| 
      
 430 
     | 
    
         
            +
                              end
         
     | 
| 
      
 431 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 432 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 433 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 434 
     | 
    
         
            +
                              plain_line "  {"
         
     | 
| 
      
 435 
     | 
    
         
            +
                              plain_line "    number: 42,"
         
     | 
| 
      
 436 
     | 
    
         
            +
                              plain_line %|    street: "Yoshie Circles",|
         
     | 
| 
      
 437 
     | 
    
         
            +
                              plain_line %|    city: "Burbank",|
         
     | 
| 
      
 438 
     | 
    
         
            +
                              plain_line %|    state: "CA",|
         
     | 
| 
      
 439 
     | 
    
         
            +
                              expected_line %|-   zip: "90382"|
         
     | 
| 
      
 440 
     | 
    
         
            +
                              actual_line %|+   zip: "90210"|
         
     | 
| 
      
 441 
     | 
    
         
            +
                              plain_line "  }"
         
     | 
| 
      
 442 
     | 
    
         
            +
                            end
         
     | 
| 
      
 443 
     | 
    
         
            +
                        )
         
     | 
| 
      
 444 
     | 
    
         
            +
             
     | 
| 
      
 445 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 446 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 447 
     | 
    
         
            +
                      )
         
     | 
| 
       346 
448 
     | 
    
         
             
                    end
         
     | 
| 
       347 
449 
     | 
    
         
             
                  end
         
     | 
| 
       348 
450 
     | 
    
         
             
                end
         
     |