hashes_equal 0.1.1 → 0.1.3
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/.travis.yml +1 -1
 - data/Makefile +3 -0
 - data/README.md +74 -0
 - data/hashes_equal.gemspec +2 -1
 - data/lib/hashes_equal/generic_diff_displayer.rb +1 -0
 - data/lib/hashes_equal/version.rb +1 -1
 - metadata +6 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 25706f6a131ad3135e14aae02f1c5d5afc3a60a2ed6286246ec0393f3e5aae13
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dbf294af717937e6168a52c074e604afbd47d5e372285b9795e5ed3edceba73a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2bd45079a7d9a351f005fe39cee4ed1af442a28bab7e4375089cdd5db6d90e831a183a6c8b2e0721069f46683ea14c7ffc282ed78721ee50a14c067d581bc601
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4a7bcc44a3dd668bde4140428d8cfa9bee262137d6b5fad48afb7e5d11499f2900e6ca5ae50120b168e39146675d2e1be4fd4cf24af7db0af3bafcf1c0f13e21
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Makefile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -41,6 +41,43 @@ end 
     | 
|
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
            Underneath, [Hashdiff](https://github.com/liufengyun/hashdiff) is used to perform the comparison.
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
      
 44 
     | 
    
         
            +
            You may also use `assert_enumerable_equal` from `EnumerableCompareHelper`:
         
     | 
| 
      
 45 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 46 
     | 
    
         
            +
              def test_disagreement_in_arrays
         
     | 
| 
      
 47 
     | 
    
         
            +
                expected_beatles = [
         
     | 
| 
      
 48 
     | 
    
         
            +
                  { firstname: 'John', lastname: 'Lennon' },
         
     | 
| 
      
 49 
     | 
    
         
            +
                  { firstname: 'Paul', lastname: 'McCartney' },
         
     | 
| 
      
 50 
     | 
    
         
            +
                  { firstname: 'Ringo', lastname: 'Starr' },
         
     | 
| 
      
 51 
     | 
    
         
            +
                  { firstname: 'George', lastname: 'Harrison' }
         
     | 
| 
      
 52 
     | 
    
         
            +
                ]
         
     | 
| 
      
 53 
     | 
    
         
            +
                actual_beatles = [
         
     | 
| 
      
 54 
     | 
    
         
            +
                  { firstname: 'John', lastname: 'Lennon' },
         
     | 
| 
      
 55 
     | 
    
         
            +
                  { firstname: 'Paul', lastname: 'McCartney' },
         
     | 
| 
      
 56 
     | 
    
         
            +
                  { firstname: 'Ringo', lastname: nil },
         
     | 
| 
      
 57 
     | 
    
         
            +
                  { firstname: 'George', lastname: 'Harrison' }
         
     | 
| 
      
 58 
     | 
    
         
            +
                ]
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                assert_enumerable_equal(
         
     | 
| 
      
 61 
     | 
    
         
            +
                  expected_beatles,
         
     | 
| 
      
 62 
     | 
    
         
            +
                  actual_beatles
         
     | 
| 
      
 63 
     | 
    
         
            +
                )
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
            ```
         
     | 
| 
      
 66 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 67 
     | 
    
         
            +
              test_disagreement_in_arrays                                     FAIL (0.00s)
         
     | 
| 
      
 68 
     | 
    
         
            +
                    
         
     | 
| 
      
 69 
     | 
    
         
            +
                    actual value for [2] is missing, expected was
         
     | 
| 
      
 70 
     | 
    
         
            +
                    	{:firstname=>"Ringo", :lastname=>"Starr"}
         
     | 
| 
      
 71 
     | 
    
         
            +
                    spurious value {:firstname=>"Ringo", :lastname=>nil} for [2] was not expected.
         
     | 
| 
      
 72 
     | 
    
         
            +
                    --- expected
         
     | 
| 
      
 73 
     | 
    
         
            +
                    +++ actual
         
     | 
| 
      
 74 
     | 
    
         
            +
                    @@ -1 +1 @@
         
     | 
| 
      
 75 
     | 
    
         
            +
                    -[{:firstname=>"John", :lastname=>"Lennon"}, {:firstname=>"Paul", :lastname=>"McCartney"}, {:firstname=>"Ringo", :lastname=>"Starr"}, {:firstname=>"George", :lastname=>"Harrison"}]
         
     | 
| 
      
 76 
     | 
    
         
            +
                    +[{:firstname=>"John", :lastname=>"Lennon"}, {:firstname=>"Paul", :lastname=>"McCartney"}, {:firstname=>"Ringo", :lastname=>nil}, {:firstname=>"George", :lastname=>"Harrison"}]
         
     | 
| 
      
 77 
     | 
    
         
            +
                    hashes_equal/lib/hashes_equal/enumerable_compare_helper.rb:13:in `assert_enumerable_equal'
         
     | 
| 
      
 78 
     | 
    
         
            +
            ```
         
     | 
| 
      
 79 
     | 
    
         
            +
            The quality of the results you will get, will depend on Hashdiff ability to process the Enumerable you are comparing.
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
       44 
81 
     | 
    
         
             
            ## Installation
         
     | 
| 
       45 
82 
     | 
    
         | 
| 
       46 
83 
     | 
    
         
             
            Add this line to your application's Gemfile:
         
     | 
| 
         @@ -96,6 +133,43 @@ end 
     | 
|
| 
       96 
133 
     | 
    
         
             
                    hashes_equal/lib/hashes_equal/hash_compare_helper.rb:13:in `assert_hashes_equal'
         
     | 
| 
       97 
134 
     | 
    
         
             
            ```
         
     | 
| 
       98 
135 
     | 
    
         | 
| 
      
 136 
     | 
    
         
            +
            You may also use `assert_enumerable_equal` from `EnumerableCompareHelper`:
         
     | 
| 
      
 137 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 138 
     | 
    
         
            +
              def test_disagreement_in_arrays
         
     | 
| 
      
 139 
     | 
    
         
            +
                expected_beatles = [
         
     | 
| 
      
 140 
     | 
    
         
            +
                  { firstname: 'John', lastname: 'Lennon' },
         
     | 
| 
      
 141 
     | 
    
         
            +
                  { firstname: 'Paul', lastname: 'McCartney' },
         
     | 
| 
      
 142 
     | 
    
         
            +
                  { firstname: 'Ringo', lastname: 'Starr' },
         
     | 
| 
      
 143 
     | 
    
         
            +
                  { firstname: 'George', lastname: 'Harrison' }
         
     | 
| 
      
 144 
     | 
    
         
            +
                ]
         
     | 
| 
      
 145 
     | 
    
         
            +
                actual_beatles = [
         
     | 
| 
      
 146 
     | 
    
         
            +
                  { firstname: 'John', lastname: 'Lennon' },
         
     | 
| 
      
 147 
     | 
    
         
            +
                  { firstname: 'Paul', lastname: 'McCartney' },
         
     | 
| 
      
 148 
     | 
    
         
            +
                  { firstname: 'Ringo', lastname: nil },
         
     | 
| 
      
 149 
     | 
    
         
            +
                  { firstname: 'George', lastname: 'Harrison' }
         
     | 
| 
      
 150 
     | 
    
         
            +
                ]
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
                assert_enumerable_equal(
         
     | 
| 
      
 153 
     | 
    
         
            +
                  expected_beatles,
         
     | 
| 
      
 154 
     | 
    
         
            +
                  actual_beatles
         
     | 
| 
      
 155 
     | 
    
         
            +
                )
         
     | 
| 
      
 156 
     | 
    
         
            +
              end
         
     | 
| 
      
 157 
     | 
    
         
            +
            ```
         
     | 
| 
      
 158 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 159 
     | 
    
         
            +
              test_disagreement_in_arrays                                     FAIL (0.00s)
         
     | 
| 
      
 160 
     | 
    
         
            +
                    
         
     | 
| 
      
 161 
     | 
    
         
            +
                    actual value for [2] is missing, expected was
         
     | 
| 
      
 162 
     | 
    
         
            +
                    	{:firstname=>"Ringo", :lastname=>"Starr"}
         
     | 
| 
      
 163 
     | 
    
         
            +
                    spurious value {:firstname=>"Ringo", :lastname=>nil} for [2] was not expected.
         
     | 
| 
      
 164 
     | 
    
         
            +
                    --- expected
         
     | 
| 
      
 165 
     | 
    
         
            +
                    +++ actual
         
     | 
| 
      
 166 
     | 
    
         
            +
                    @@ -1 +1 @@
         
     | 
| 
      
 167 
     | 
    
         
            +
                    -[{:firstname=>"John", :lastname=>"Lennon"}, {:firstname=>"Paul", :lastname=>"McCartney"}, {:firstname=>"Ringo", :lastname=>"Starr"}, {:firstname=>"George", :lastname=>"Harrison"}]
         
     | 
| 
      
 168 
     | 
    
         
            +
                    +[{:firstname=>"John", :lastname=>"Lennon"}, {:firstname=>"Paul", :lastname=>"McCartney"}, {:firstname=>"Ringo", :lastname=>nil}, {:firstname=>"George", :lastname=>"Harrison"}]
         
     | 
| 
      
 169 
     | 
    
         
            +
            ```
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
            Note that `assert_hashes_equal` will only work with Hashes while `assert_enumerable_equal` will accept any two Enumerable (but might or might not be able to compare them depending on their actual interface).
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
       99 
173 
     | 
    
         
             
            ## Development
         
     | 
| 
       100 
174 
     | 
    
         | 
| 
       101 
175 
     | 
    
         
             
            Run `bundle exec rake test` to run the tests.
         
     | 
    
        data/hashes_equal.gemspec
    CHANGED
    
    | 
         @@ -33,7 +33,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       33 
33 
     | 
    
         
             
              spec.require_paths = ['lib']
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
              spec.add_dependency 'ansi', '~> 1.5'
         
     | 
| 
       36 
     | 
    
         
            -
              spec.add_dependency 'assertable'
         
     | 
| 
      
 36 
     | 
    
         
            +
              spec.add_dependency 'assertable', '~> 0.1'
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
       37 
38 
     | 
    
         
             
              spec.add_dependency 'hashdiff', '~> 1.0', '>= 1.0.1'
         
     | 
| 
       38 
39 
     | 
    
         | 
| 
       39 
40 
     | 
    
         
             
              spec.add_development_dependency 'bundler', '~> 2.1', '>= 2.1.4'
         
     | 
    
        data/lib/hashes_equal/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hashes_equal
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Shippingbo
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-09-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: ansi
         
     | 
| 
         @@ -28,16 +28,16 @@ dependencies: 
     | 
|
| 
       28 
28 
     | 
    
         
             
              name: assertable
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
     | 
    
         
            -
                - - " 
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
     | 
    
         
            -
                - - " 
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0.1'
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: hashdiff
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |