Created
June 3, 2015 01:53
-
-
Save hackling/ab75162913ced90e12e4 to your computer and use it in GitHub Desktop.
Alternate Hash Differ - Larger Hashes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run options: exclude {:skip=>true} | |
Progress: | | |
1) diff output for tags outputs using the standard differ | |
Failure/Error: expect(hash_1).to eq hash_2 | |
expected: {1=>2, 53=>60, 87=>88, 71=>72, 39=>40, 37=>38, 33=>60, 99=>100, 21=>22, 93=>94, 15=>16, 29=>30, 83=>84, 55=>56, 41=>42, 79=>80, 49=>50, 47=>48, 89=>90, 63=>60, 91=>92, 67=>68, 11=>12, 17=>18, 5=>6, 69=>70, 59=>60, 35=>36, 3=>4, 81=>82, 97=>98, 43=>44, 75=>76, 9=>10, 13=>14, 23=>60, 77=>78, 7=>8, 27=>28, 73=>60, 25=>26, 95=>96, 51=>52, 31=>32, 61=>62, 65=>66, 57=>58, 85=>86, 19=>20, 45=>46} | |
got: {1=>2, 3=>4, 5=>6, 7=>8, 9=>10, 11=>12, 13=>14, 15=>16, 17=>18, 19=>20, 21=>22, 23=>24, 25=>26, 27=>28, 29=>30, 31=>32, 33=>34, 35=>36, 37=>38, 39=>40, 41=>42, 43=>44, 45=>46, 47=>48, 49=>50, 51=>52, 53=>54, 55=>56, 57=>58, 59=>60, 61=>62, 63=>64, 65=>66, 67=>68, 69=>70, 71=>72, 73=>74, 75=>76, 77=>78, 79=>80, 81=>82, 83=>84, 85=>86, 87=>88, 89=>90, 91=>92, 93=>94, 95=>96, 97=>98, 99=>100} | |
(compared using ==) | |
Diff: | |
@@ -5,13 +5,13 @@ | |
17 => 18, | |
19 => 20, | |
21 => 22, | |
-23 => 60, | |
+23 => 24, | |
25 => 26, | |
27 => 28, | |
29 => 30, | |
3 => 4, | |
31 => 32, | |
-33 => 60, | |
+33 => 34, | |
35 => 36, | |
37 => 38, | |
39 => 40, | |
@@ -22,18 +22,18 @@ | |
49 => 50, | |
5 => 6, | |
51 => 52, | |
-53 => 60, | |
+53 => 54, | |
55 => 56, | |
57 => 58, | |
59 => 60, | |
61 => 62, | |
-63 => 60, | |
+63 => 64, | |
65 => 66, | |
67 => 68, | |
69 => 70, | |
7 => 8, | |
71 => 72, | |
-73 => 60, | |
+73 => 74, | |
75 => 76, | |
77 => 78, | |
79 => 80, | |
# ./spec/example_spec.rb:16:in `block (2 levels) in <top (required)>' | |
Progress: |================================== | |
2) diff output for tags outputs using the new differ | |
Failure/Error: expect(hash_1).to match_hash hash_2 | |
key: 33 expected: 60 got: 34 | |
key: 73 expected: 60 got: 74 | |
key: 53 expected: 60 got: 54 | |
key: 63 expected: 60 got: 64 | |
key: 23 expected: 60 got: 24 | |
# ./spec/example_spec.rb:20:in `block (2 levels) in <top (required)>' | |
Progress: |====================================================================| | |
Finished in 1.45 seconds (files took 0.01574 seconds to load) | |
2 examples, 2 failures | |
Failed examples: | |
rspec ./spec/example_spec.rb:15 # diff output for tags outputs using the standard differ | |
rspec ./spec/example_spec.rb:19 # diff output for tags outputs using the new differ | |
Rerun all failed examples: | |
rspec ./spec/example_spec.rb:{15,19} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'diff output for tags' do | |
let(:hash_1) { (1..100).to_a.each_slice(2).map { |x| x }.to_h } | |
let(:hash_2) do | |
tmp = (1..100).to_a.each_slice(2).map { |x| x }.shuffle.to_h | |
tmp[23] = 60 | |
tmp[33] = 60 | |
tmp[53] = 60 | |
tmp[63] = 60 | |
tmp[73] = 60 | |
tmp | |
end | |
it 'outputs using the standard differ' do | |
expect(hash_1).to eq hash_2 | |
end | |
it 'outputs using the new differ' do | |
expect(hash_1).to match_hash hash_2 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment