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
 
| 
         @@ -10,7 +10,7 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       10 
10 
     | 
    
         
             
                          state: "CA",
         
     | 
| 
       11 
11 
     | 
    
         
             
                          zip: "90382",
         
     | 
| 
       12 
12 
     | 
    
         
             
                        )
         
     | 
| 
       13 
     | 
    
         
            -
                        actual 
     | 
| 
      
 13 
     | 
    
         
            +
                        actual = SuperDiff::Test::Models::ActiveRecord::ShippingAddress.new(
         
     | 
| 
       14 
14 
     | 
    
         
             
                          line_1: "456 Ponderosa Ct.",
         
     | 
| 
       15 
15 
     | 
    
         
             
                          city: "Oakland",
         
     | 
| 
       16 
16 
     | 
    
         
             
                          state: "CA",
         
     | 
| 
         @@ -20,38 +20,41 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       20 
20 
     | 
    
         
             
                      TEST
         
     | 
| 
       21 
21 
     | 
    
         
             
                      program = make_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       24 
     | 
    
         
            -
                         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                           
     | 
| 
       28 
     | 
    
         
            -
                             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 24 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 25 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 26 
     | 
    
         
            +
                          snippet: "expect(actual).to eq(expected)",
         
     | 
| 
      
 27 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 28 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 29 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 30 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 31 
     | 
    
         
            +
                                actual %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Oakland", line_1: "456 Ponderosa Ct.", line_2: "", state: "CA", zip: "91234">|
         
     | 
| 
      
 32 
     | 
    
         
            +
                              end
         
     | 
| 
       31 
33 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 35 
     | 
    
         
            +
                                plain "   to eq "
         
     | 
| 
      
 36 
     | 
    
         
            +
                                expected %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">|
         
     | 
| 
      
 37 
     | 
    
         
            +
                              end
         
     | 
| 
      
 38 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 39 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 40 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 41 
     | 
    
         
            +
                              plain_line "  #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {"
         
     | 
| 
      
 42 
     | 
    
         
            +
                              plain_line "    id: nil,"
         
     | 
| 
      
 43 
     | 
    
         
            +
                              expected_line %|-   city: "Hill Valley",|
         
     | 
| 
      
 44 
     | 
    
         
            +
                              actual_line %|+   city: "Oakland",|
         
     | 
| 
      
 45 
     | 
    
         
            +
                              expected_line %|-   line_1: "123 Main St.",|
         
     | 
| 
      
 46 
     | 
    
         
            +
                              actual_line %|+   line_1: "456 Ponderosa Ct.",|
         
     | 
| 
      
 47 
     | 
    
         
            +
                              plain_line %|    line_2: "",|
         
     | 
| 
      
 48 
     | 
    
         
            +
                              plain_line %|    state: "CA",|
         
     | 
| 
      
 49 
     | 
    
         
            +
                              expected_line %|-   zip: "90382"|
         
     | 
| 
      
 50 
     | 
    
         
            +
                              actual_line %|+   zip: "91234"|
         
     | 
| 
      
 51 
     | 
    
         
            +
                              plain_line "  }>"
         
     | 
| 
      
 52 
     | 
    
         
            +
                            end
         
     | 
| 
      
 53 
     | 
    
         
            +
                        )
         
     | 
| 
       51 
54 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       53 
     | 
    
         
            -
                         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 55 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 56 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 57 
     | 
    
         
            +
                      )
         
     | 
| 
       55 
58 
     | 
    
         
             
                    end
         
     | 
| 
       56 
59 
     | 
    
         
             
                  end
         
     | 
| 
       57 
60 
     | 
    
         
             
                end
         
     | 
| 
         @@ -66,7 +69,7 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       66 
69 
     | 
    
         
             
                          state: "CA",
         
     | 
| 
       67 
70 
     | 
    
         
             
                          zip: "90382",
         
     | 
| 
       68 
71 
     | 
    
         
             
                        )
         
     | 
| 
       69 
     | 
    
         
            -
                        actual 
     | 
| 
      
 72 
     | 
    
         
            +
                        actual = SuperDiff::Test::Models::ActiveRecord::Person.new(
         
     | 
| 
       70 
73 
     | 
    
         
             
                          name: "Elliot",
         
     | 
| 
       71 
74 
     | 
    
         
             
                          age: 31,
         
     | 
| 
       72 
75 
     | 
    
         
             
                        )
         
     | 
| 
         @@ -74,26 +77,28 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       74 
77 
     | 
    
         
             
                      TEST
         
     | 
| 
       75 
78 
     | 
    
         
             
                      program = make_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       76 
79 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       78 
     | 
    
         
            -
                         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                           
     | 
| 
       83 
     | 
    
         
            -
                             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
      
 80 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 81 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 82 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 83 
     | 
    
         
            +
                          snippet: "expect(actual).to eq(expected)",
         
     | 
| 
      
 84 
     | 
    
         
            +
                          newline_before_expectation: true,
         
     | 
| 
      
 85 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 86 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 87 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 88 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 89 
     | 
    
         
            +
                                actual %|#<SuperDiff::Test::Models::ActiveRecord::Person id: nil, age: 31, name: "Elliot">|
         
     | 
| 
      
 90 
     | 
    
         
            +
                              end
         
     | 
| 
       86 
91 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
      
 92 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 93 
     | 
    
         
            +
                                plain "   to eq "
         
     | 
| 
      
 94 
     | 
    
         
            +
                                expected %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">|
         
     | 
| 
      
 95 
     | 
    
         
            +
                              end
         
     | 
| 
      
 96 
     | 
    
         
            +
                            end
         
     | 
| 
      
 97 
     | 
    
         
            +
                        )
         
     | 
| 
       93 
98 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       95 
     | 
    
         
            -
                         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
      
 99 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 100 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 101 
     | 
    
         
            +
                      )
         
     | 
| 
       97 
102 
     | 
    
         
             
                    end
         
     | 
| 
       98 
103 
     | 
    
         
             
                  end
         
     | 
| 
       99 
104 
     | 
    
         
             
                end
         
     | 
| 
         @@ -108,31 +113,33 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       108 
113 
     | 
    
         
             
                          state: "CA",
         
     | 
| 
       109 
114 
     | 
    
         
             
                          zip: "90382"
         
     | 
| 
       110 
115 
     | 
    
         
             
                        )
         
     | 
| 
       111 
     | 
    
         
            -
                        actual 
     | 
| 
      
 116 
     | 
    
         
            +
                        actual = nil
         
     | 
| 
       112 
117 
     | 
    
         
             
                        expect(actual).to eq(expected)
         
     | 
| 
       113 
118 
     | 
    
         
             
                      TEST
         
     | 
| 
       114 
119 
     | 
    
         
             
                      program = make_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       115 
120 
     | 
    
         | 
| 
       116 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       117 
     | 
    
         
            -
                         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
                           
     | 
| 
       122 
     | 
    
         
            -
                             
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
      
 121 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 122 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 123 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 124 
     | 
    
         
            +
                          snippet: "expect(actual).to eq(expected)",
         
     | 
| 
      
 125 
     | 
    
         
            +
                          newline_before_expectation: true,
         
     | 
| 
      
 126 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 127 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 128 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 129 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 130 
     | 
    
         
            +
                                actual "nil"
         
     | 
| 
      
 131 
     | 
    
         
            +
                              end
         
     | 
| 
       125 
132 
     | 
    
         | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
      
 133 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 134 
     | 
    
         
            +
                                plain "   to eq "
         
     | 
| 
      
 135 
     | 
    
         
            +
                                expected %|#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">|
         
     | 
| 
      
 136 
     | 
    
         
            +
                              end
         
     | 
| 
      
 137 
     | 
    
         
            +
                            end
         
     | 
| 
      
 138 
     | 
    
         
            +
                        )
         
     | 
| 
       132 
139 
     | 
    
         | 
| 
       133 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       134 
     | 
    
         
            -
                         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
      
 140 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 141 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 142 
     | 
    
         
            +
                      )
         
     | 
| 
       136 
143 
     | 
    
         
             
                    end
         
     | 
| 
       137 
144 
     | 
    
         
             
                  end
         
     | 
| 
       138 
145 
     | 
    
         
             
                end
         
     | 
| 
         @@ -150,7 +157,7 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       150 
157 
     | 
    
         
             
                            zip: "90382",
         
     | 
| 
       151 
158 
     | 
    
         
             
                          )
         
     | 
| 
       152 
159 
     | 
    
         
             
                        }
         
     | 
| 
       153 
     | 
    
         
            -
                        actual 
     | 
| 
      
 160 
     | 
    
         
            +
                        actual = {
         
     | 
| 
       154 
161 
     | 
    
         
             
                          name: "Marty McFly",
         
     | 
| 
       155 
162 
     | 
    
         
             
                          shipping_address: SuperDiff::Test::Models::ActiveRecord::ShippingAddress.new(
         
     | 
| 
       156 
163 
     | 
    
         
             
                            line_1: "456 Ponderosa Ct.",
         
     | 
| 
         @@ -163,41 +170,44 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       163 
170 
     | 
    
         
             
                      TEST
         
     | 
| 
       164 
171 
     | 
    
         
             
                      program = make_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       165 
172 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       167 
     | 
    
         
            -
                         
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                           
     | 
| 
       171 
     | 
    
         
            -
                             
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
      
 173 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 174 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 175 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 176 
     | 
    
         
            +
                          snippet: "expect(actual).to eq(expected)",
         
     | 
| 
      
 177 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 178 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 179 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 180 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 181 
     | 
    
         
            +
                                actual %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Oakland", line_1: "456 Ponderosa Ct.", line_2: "", state: "CA", zip: "91234"> }|
         
     | 
| 
      
 182 
     | 
    
         
            +
                              end
         
     | 
| 
       174 
183 
     | 
    
         | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
      
 184 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 185 
     | 
    
         
            +
                                plain "   to eq "
         
     | 
| 
      
 186 
     | 
    
         
            +
                                expected %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382"> }|
         
     | 
| 
      
 187 
     | 
    
         
            +
                              end
         
     | 
| 
      
 188 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 189 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 190 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 191 
     | 
    
         
            +
                              plain_line "  {"
         
     | 
| 
      
 192 
     | 
    
         
            +
                              plain_line %|    name: "Marty McFly",|
         
     | 
| 
      
 193 
     | 
    
         
            +
                              plain_line "    shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {"
         
     | 
| 
      
 194 
     | 
    
         
            +
                              plain_line "      id: nil,"
         
     | 
| 
      
 195 
     | 
    
         
            +
                              expected_line %|-     city: "Hill Valley",|
         
     | 
| 
      
 196 
     | 
    
         
            +
                              actual_line %|+     city: "Oakland",|
         
     | 
| 
      
 197 
     | 
    
         
            +
                              expected_line %|-     line_1: "123 Main St.",|
         
     | 
| 
      
 198 
     | 
    
         
            +
                              actual_line %|+     line_1: "456 Ponderosa Ct.",|
         
     | 
| 
      
 199 
     | 
    
         
            +
                              plain_line %|      line_2: "",|
         
     | 
| 
      
 200 
     | 
    
         
            +
                              plain_line %|      state: "CA",|
         
     | 
| 
      
 201 
     | 
    
         
            +
                              expected_line %|-     zip: "90382"|
         
     | 
| 
      
 202 
     | 
    
         
            +
                              actual_line %|+     zip: "91234"|
         
     | 
| 
      
 203 
     | 
    
         
            +
                              plain_line "    }>"
         
     | 
| 
      
 204 
     | 
    
         
            +
                              plain_line "  }"
         
     | 
| 
      
 205 
     | 
    
         
            +
                            end
         
     | 
| 
      
 206 
     | 
    
         
            +
                        )
         
     | 
| 
       197 
207 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       199 
     | 
    
         
            -
                         
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
      
 208 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 209 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 210 
     | 
    
         
            +
                      )
         
     | 
| 
       201 
211 
     | 
    
         
             
                    end
         
     | 
| 
       202 
212 
     | 
    
         
             
                  end
         
     | 
| 
       203 
213 
     | 
    
         
             
                end
         
     | 
| 
         @@ -215,7 +225,7 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       215 
225 
     | 
    
         
             
                            zip: "90382",
         
     | 
| 
       216 
226 
     | 
    
         
             
                          )
         
     | 
| 
       217 
227 
     | 
    
         
             
                        }
         
     | 
| 
       218 
     | 
    
         
            -
                        actual 
     | 
| 
      
 228 
     | 
    
         
            +
                        actual = {
         
     | 
| 
       219 
229 
     | 
    
         
             
                          name: "Marty McFly",
         
     | 
| 
       220 
230 
     | 
    
         
             
                          shipping_address: SuperDiff::Test::Models::ActiveRecord::Person.new(
         
     | 
| 
       221 
231 
     | 
    
         
             
                            name: "Elliot",
         
     | 
| 
         @@ -226,43 +236,46 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       226 
236 
     | 
    
         
             
                      TEST
         
     | 
| 
       227 
237 
     | 
    
         
             
                      program = make_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       228 
238 
     | 
    
         | 
| 
       229 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       230 
     | 
    
         
            -
                         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
                           
     | 
| 
       234 
     | 
    
         
            -
                             
     | 
| 
       235 
     | 
    
         
            -
             
     | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
      
 239 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 240 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 241 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 242 
     | 
    
         
            +
                          snippet: "expect(actual).to eq(expected)",
         
     | 
| 
      
 243 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 244 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 245 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 246 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 247 
     | 
    
         
            +
                                actual %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::Person id: nil, age: 31, name: "Elliot"> }|
         
     | 
| 
      
 248 
     | 
    
         
            +
                              end
         
     | 
| 
       237 
249 
     | 
    
         | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
             
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
       244 
     | 
    
         
            -
             
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
     | 
    
         
            -
             
     | 
| 
       248 
     | 
    
         
            -
             
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
             
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
       260 
     | 
    
         
            -
             
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
      
 250 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 251 
     | 
    
         
            +
                                plain "   to eq "
         
     | 
| 
      
 252 
     | 
    
         
            +
                                expected %|{ name: "Marty McFly", shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: nil, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382"> }|
         
     | 
| 
      
 253 
     | 
    
         
            +
                              end
         
     | 
| 
      
 254 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 255 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 256 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 257 
     | 
    
         
            +
                              plain_line "  {"
         
     | 
| 
      
 258 
     | 
    
         
            +
                              plain_line %|    name: "Marty McFly",|
         
     | 
| 
      
 259 
     | 
    
         
            +
                              expected_line "-   shipping_address: #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {"
         
     | 
| 
      
 260 
     | 
    
         
            +
                              expected_line "-     id: nil,"
         
     | 
| 
      
 261 
     | 
    
         
            +
                              expected_line %|-     city: "Hill Valley",|
         
     | 
| 
      
 262 
     | 
    
         
            +
                              expected_line %|-     line_1: "123 Main St.",|
         
     | 
| 
      
 263 
     | 
    
         
            +
                              expected_line %|-     line_2: "",|
         
     | 
| 
      
 264 
     | 
    
         
            +
                              expected_line %|-     state: "CA",|
         
     | 
| 
      
 265 
     | 
    
         
            +
                              expected_line %|-     zip: "90382"|
         
     | 
| 
      
 266 
     | 
    
         
            +
                              expected_line "-   }>"
         
     | 
| 
      
 267 
     | 
    
         
            +
                              actual_line "+   shipping_address: #<SuperDiff::Test::Models::ActiveRecord::Person {"
         
     | 
| 
      
 268 
     | 
    
         
            +
                              actual_line "+     id: nil,"
         
     | 
| 
      
 269 
     | 
    
         
            +
                              actual_line "+     age: 31,"
         
     | 
| 
      
 270 
     | 
    
         
            +
                              actual_line %|+     name: "Elliot"|
         
     | 
| 
      
 271 
     | 
    
         
            +
                              actual_line "+   }>"
         
     | 
| 
      
 272 
     | 
    
         
            +
                              plain_line "  }"
         
     | 
| 
      
 273 
     | 
    
         
            +
                            end
         
     | 
| 
      
 274 
     | 
    
         
            +
                        )
         
     | 
| 
       262 
275 
     | 
    
         | 
| 
       263 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       264 
     | 
    
         
            -
                         
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
      
 276 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 277 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 278 
     | 
    
         
            +
                      )
         
     | 
| 
       266 
279 
     | 
    
         
             
                    end
         
     | 
| 
       267 
280 
     | 
    
         
             
                  end
         
     | 
| 
       268 
281 
     | 
    
         
             
                end
         
     | 
| 
         @@ -287,50 +300,53 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       287 
300 
     | 
    
         
             
                          )
         
     | 
| 
       288 
301 
     | 
    
         
             
                        ]
         
     | 
| 
       289 
302 
     | 
    
         
             
                        expected = [shipping_addresses.first]
         
     | 
| 
       290 
     | 
    
         
            -
                        actual 
     | 
| 
      
 303 
     | 
    
         
            +
                        actual = SuperDiff::Test::Models::ActiveRecord::ShippingAddress.all
         
     | 
| 
       291 
304 
     | 
    
         
             
                        expect(actual).to eq(expected)
         
     | 
| 
       292 
305 
     | 
    
         
             
                      TEST
         
     | 
| 
       293 
306 
     | 
    
         
             
                      program = make_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       294 
307 
     | 
    
         | 
| 
       295 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       296 
     | 
    
         
            -
                         
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
             
     | 
| 
       299 
     | 
    
         
            -
                           
     | 
| 
       300 
     | 
    
         
            -
                             
     | 
| 
       301 
     | 
    
         
            -
             
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
      
 308 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 309 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 310 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 311 
     | 
    
         
            +
                          snippet: "expect(actual).to eq(expected)",
         
     | 
| 
      
 312 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 313 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 314 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 315 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 316 
     | 
    
         
            +
                                actual %|#<ActiveRecord::Relation [#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: 1, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">, #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: 2, city: "Oakland", line_1: "456 Ponderosa Ct.", line_2: "", state: "CA", zip: "91234">]>|
         
     | 
| 
      
 317 
     | 
    
         
            +
                              end
         
     | 
| 
       303 
318 
     | 
    
         | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
     | 
    
         
            -
             
     | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
       312 
     | 
    
         
            -
             
     | 
| 
       313 
     | 
    
         
            -
             
     | 
| 
       314 
     | 
    
         
            -
             
     | 
| 
       315 
     | 
    
         
            -
             
     | 
| 
       316 
     | 
    
         
            -
             
     | 
| 
       317 
     | 
    
         
            -
             
     | 
| 
       318 
     | 
    
         
            -
             
     | 
| 
       319 
     | 
    
         
            -
             
     | 
| 
       320 
     | 
    
         
            -
             
     | 
| 
       321 
     | 
    
         
            -
             
     | 
| 
       322 
     | 
    
         
            -
             
     | 
| 
       323 
     | 
    
         
            -
             
     | 
| 
       324 
     | 
    
         
            -
             
     | 
| 
       325 
     | 
    
         
            -
             
     | 
| 
       326 
     | 
    
         
            -
             
     | 
| 
       327 
     | 
    
         
            -
             
     | 
| 
       328 
     | 
    
         
            -
             
     | 
| 
       329 
     | 
    
         
            -
             
     | 
| 
      
 319 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 320 
     | 
    
         
            +
                                plain "   to eq "
         
     | 
| 
      
 321 
     | 
    
         
            +
                                expected %|[#<SuperDiff::Test::Models::ActiveRecord::ShippingAddress id: 1, city: "Hill Valley", line_1: "123 Main St.", line_2: "", state: "CA", zip: "90382">]|
         
     | 
| 
      
 322 
     | 
    
         
            +
                              end
         
     | 
| 
      
 323 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 324 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 325 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 326 
     | 
    
         
            +
                              plain_line "  #<ActiveRecord::Relation ["
         
     | 
| 
      
 327 
     | 
    
         
            +
                              plain_line "    #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {"
         
     | 
| 
      
 328 
     | 
    
         
            +
                              plain_line "      id: 1,"
         
     | 
| 
      
 329 
     | 
    
         
            +
                              plain_line %|      city: "Hill Valley",|
         
     | 
| 
      
 330 
     | 
    
         
            +
                              plain_line %|      line_1: "123 Main St.",|
         
     | 
| 
      
 331 
     | 
    
         
            +
                              plain_line %|      line_2: "",|
         
     | 
| 
      
 332 
     | 
    
         
            +
                              plain_line %|      state: "CA",|
         
     | 
| 
      
 333 
     | 
    
         
            +
                              plain_line %|      zip: "90382"|
         
     | 
| 
      
 334 
     | 
    
         
            +
                              plain_line "    }>,"
         
     | 
| 
      
 335 
     | 
    
         
            +
                              actual_line "+   #<SuperDiff::Test::Models::ActiveRecord::ShippingAddress {"
         
     | 
| 
      
 336 
     | 
    
         
            +
                              actual_line "+     id: 2,"
         
     | 
| 
      
 337 
     | 
    
         
            +
                              actual_line %|+     city: "Oakland",|
         
     | 
| 
      
 338 
     | 
    
         
            +
                              actual_line %|+     line_1: "456 Ponderosa Ct.",|
         
     | 
| 
      
 339 
     | 
    
         
            +
                              actual_line %|+     line_2: "",|
         
     | 
| 
      
 340 
     | 
    
         
            +
                              actual_line %|+     state: "CA",|
         
     | 
| 
      
 341 
     | 
    
         
            +
                              actual_line %|+     zip: "91234"|
         
     | 
| 
      
 342 
     | 
    
         
            +
                              actual_line "+   }>"
         
     | 
| 
      
 343 
     | 
    
         
            +
                              plain_line "  ]>"
         
     | 
| 
      
 344 
     | 
    
         
            +
                            end
         
     | 
| 
      
 345 
     | 
    
         
            +
                        )
         
     | 
| 
       330 
346 
     | 
    
         | 
| 
       331 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       332 
     | 
    
         
            -
                         
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
      
 347 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 348 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 349 
     | 
    
         
            +
                      )
         
     | 
| 
       334 
350 
     | 
    
         
             
                    end
         
     | 
| 
       335 
351 
     | 
    
         
             
                  end
         
     | 
| 
       336 
352 
     | 
    
         
             
                end
         
     | 
| 
         @@ -354,7 +370,7 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       354 
370 
     | 
    
         
             
                          )
         
     | 
| 
       355 
371 
     | 
    
         
             
                        ]
         
     | 
| 
       356 
372 
     | 
    
         | 
| 
       357 
     | 
    
         
            -
                        actual 
     | 
| 
      
 373 
     | 
    
         
            +
                        actual = [
         
     | 
| 
       358 
374 
     | 
    
         
             
                          SuperDiff::Test::Models::ActiveRecord::Query.new(
         
     | 
| 
       359 
375 
     | 
    
         
             
                            results: SuperDiff::Test::Models::ActiveRecord::Person.all
         
     | 
| 
       360 
376 
     | 
    
         
             
                          )
         
     | 
| 
         @@ -365,44 +381,46 @@ shared_examples_for "integration with ActiveRecord" do 
     | 
|
| 
       365 
381 
     | 
    
         | 
| 
       366 
382 
     | 
    
         
             
                      program = make_program(snippet, color_enabled: color_enabled)
         
     | 
| 
       367 
383 
     | 
    
         | 
| 
       368 
     | 
    
         
            -
                      expected_output = 
     | 
| 
       369 
     | 
    
         
            -
                         
     | 
| 
       370 
     | 
    
         
            -
             
     | 
| 
       371 
     | 
    
         
            -
             
     | 
| 
       372 
     | 
    
         
            -
             
     | 
| 
       373 
     | 
    
         
            -
                           
     | 
| 
       374 
     | 
    
         
            -
                             
     | 
| 
       375 
     | 
    
         
            -
             
     | 
| 
       376 
     | 
    
         
            -
             
     | 
| 
      
 384 
     | 
    
         
            +
                      expected_output =
         
     | 
| 
      
 385 
     | 
    
         
            +
                        build_expected_output(
         
     | 
| 
      
 386 
     | 
    
         
            +
                          color_enabled: color_enabled,
         
     | 
| 
      
 387 
     | 
    
         
            +
                          snippet: "expect(actual).to match(expected)",
         
     | 
| 
      
 388 
     | 
    
         
            +
                          newline_before_expectation: true,
         
     | 
| 
      
 389 
     | 
    
         
            +
                          expectation:
         
     | 
| 
      
 390 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 391 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 392 
     | 
    
         
            +
                                plain "Expected "
         
     | 
| 
      
 393 
     | 
    
         
            +
                                actual %|[#<SuperDiff::Test::Models::ActiveRecord::Query @results=#<ActiveRecord::Relation [#<SuperDiff::Test::Models::ActiveRecord::Person id: 1, age: 20, name: "Murphy">]>>]|
         
     | 
| 
      
 394 
     | 
    
         
            +
                              end
         
     | 
| 
       377 
395 
     | 
    
         | 
| 
       378 
     | 
    
         
            -
             
     | 
| 
       379 
     | 
    
         
            -
             
     | 
| 
       380 
     | 
    
         
            -
             
     | 
| 
       381 
     | 
    
         
            -
             
     | 
| 
       382 
     | 
    
         
            -
             
     | 
| 
       383 
     | 
    
         
            -
             
     | 
| 
       384 
     | 
    
         
            -
             
     | 
| 
       385 
     | 
    
         
            -
             
     | 
| 
       386 
     | 
    
         
            -
             
     | 
| 
       387 
     | 
    
         
            -
             
     | 
| 
       388 
     | 
    
         
            -
             
     | 
| 
       389 
     | 
    
         
            -
             
     | 
| 
       390 
     | 
    
         
            -
             
     | 
| 
       391 
     | 
    
         
            -
             
     | 
| 
       392 
     | 
    
         
            -
             
     | 
| 
       393 
     | 
    
         
            -
             
     | 
| 
       394 
     | 
    
         
            -
             
     | 
| 
       395 
     | 
    
         
            -
             
     | 
| 
       396 
     | 
    
         
            -
             
     | 
| 
       397 
     | 
    
         
            -
             
     | 
| 
       398 
     | 
    
         
            -
             
     | 
| 
       399 
     | 
    
         
            -
             
     | 
| 
       400 
     | 
    
         
            -
             
     | 
| 
      
 396 
     | 
    
         
            +
                              line do
         
     | 
| 
      
 397 
     | 
    
         
            +
                                plain "to match "
         
     | 
| 
      
 398 
     | 
    
         
            +
                                expected %|[#<an object having attributes (results: [#<an object having attributes (name: "John", age: 19)>])>]|
         
     | 
| 
      
 399 
     | 
    
         
            +
                              end
         
     | 
| 
      
 400 
     | 
    
         
            +
                            end,
         
     | 
| 
      
 401 
     | 
    
         
            +
                          diff:
         
     | 
| 
      
 402 
     | 
    
         
            +
                            proc do
         
     | 
| 
      
 403 
     | 
    
         
            +
                              plain_line "  ["
         
     | 
| 
      
 404 
     | 
    
         
            +
                              plain_line "    #<SuperDiff::Test::Models::ActiveRecord::Query {"
         
     | 
| 
      
 405 
     | 
    
         
            +
                              plain_line "      @results=#<ActiveRecord::Relation ["
         
     | 
| 
      
 406 
     | 
    
         
            +
                              plain_line "        #<SuperDiff::Test::Models::ActiveRecord::Person {"
         
     | 
| 
      
 407 
     | 
    
         
            +
                              plain_line "          id: 1,"
         
     | 
| 
      
 408 
     | 
    
         
            +
                              # expected_line %|-         age: 19,|  # TODO
         
     | 
| 
      
 409 
     | 
    
         
            +
                              expected_line "-         age: 19"
         
     | 
| 
      
 410 
     | 
    
         
            +
                              actual_line "+         age: 20,"
         
     | 
| 
      
 411 
     | 
    
         
            +
                              # expected_line %|-         name: "John"|  # TODO
         
     | 
| 
      
 412 
     | 
    
         
            +
                              expected_line %|-         name: "John",|
         
     | 
| 
      
 413 
     | 
    
         
            +
                              actual_line %|+         name: "Murphy"|
         
     | 
| 
      
 414 
     | 
    
         
            +
                              plain_line "        }>"
         
     | 
| 
      
 415 
     | 
    
         
            +
                              plain_line "      ]>"
         
     | 
| 
      
 416 
     | 
    
         
            +
                              plain_line "    }>"
         
     | 
| 
      
 417 
     | 
    
         
            +
                              plain_line "  ]"
         
     | 
| 
      
 418 
     | 
    
         
            +
                            end
         
     | 
| 
      
 419 
     | 
    
         
            +
                        )
         
     | 
| 
       401 
420 
     | 
    
         | 
| 
       402 
     | 
    
         
            -
                      expect(program).
         
     | 
| 
       403 
     | 
    
         
            -
                         
     | 
| 
       404 
     | 
    
         
            -
             
     | 
| 
       405 
     | 
    
         
            -
                        removing_object_ids
         
     | 
| 
      
 421 
     | 
    
         
            +
                      expect(program).to produce_output_when_run(expected_output).in_color(
         
     | 
| 
      
 422 
     | 
    
         
            +
                        color_enabled
         
     | 
| 
      
 423 
     | 
    
         
            +
                      ).removing_object_ids
         
     | 
| 
       406 
424 
     | 
    
         
             
                    end
         
     | 
| 
       407 
425 
     | 
    
         
             
                  end
         
     | 
| 
       408 
426 
     | 
    
         
             
                end
         
     |