zold 0.13.30 → 0.13.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee35d396502c3f5d87f9b65debca6c3e7bd498da
4
- data.tar.gz: 5958504831a46a0a40d3cae2af06b26cc78e4c85
3
+ metadata.gz: c98b1e9d02790f3993431a547adc638b53e7388e
4
+ data.tar.gz: fda7df22416b00eebc03f9bcefaed0aa847c8a7a
5
5
  SHA512:
6
- metadata.gz: 493b9c89a94e367e2b54fd441d3a7adb54e44db8b8110d7baee8f87cca5aa9027180c7140c331e7d78a195161f86db2ce6728a07a1f5af5dae86de7ada7be66b
7
- data.tar.gz: 3dc8aff3511edd018766cc15e936f4c8ba9c416db82c27a031d760411b52a17cdff8cf2549d744230dfb6ba9238f3dad603788a8ad5647141d381ee2a7970c90
6
+ metadata.gz: ff4a715122869803cef3bf0045badbf837d9e64a550dcd2b3f0690dad7ea30b31824f923cc53e2bd1c2ae3b38ece51b3a1e5a80ba8dae8bde7ade0c3af98a3b9
7
+ data.tar.gz: 88c77327f5eeaf7a909c69bb5c85b9d10571491bf5503b1bf6d931bd8eafd336f2518d3320be404c1d4835dac2d71ef6731f94547cd1f3ac99eaa04505209dc8
@@ -37,6 +37,15 @@ module Zold
37
37
  # The ID of the root wallet.
38
38
  ROOT = Id.new('0000000000000000')
39
39
 
40
+ def eql?(other)
41
+ raise 'Can only compare with Id' unless other.is_a?(Id)
42
+ to_s == other.to_s
43
+ end
44
+
45
+ def hash
46
+ to_s.hash
47
+ end
48
+
40
49
  def==(other)
41
50
  raise 'Can only compare with Id' unless other.is_a?(Id)
42
51
  to_s == other.to_s
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.13.30'.freeze
26
+ VERSION = '0.13.31'.freeze
27
27
  end
@@ -42,6 +42,16 @@ class TestEntrance < Minitest::Test
42
42
  end
43
43
  end
44
44
 
45
+ def test_ignores_duplicates
46
+ FakeHome.new.run do |home|
47
+ wallet = home.create_wallet(Zold::Id.new)
48
+ entrance = Zold::Entrance.new(home.wallets, home.remotes, home.copies(wallet).root, 'x', log: test_log)
49
+ id = Zold::Id.new.to_s
50
+ 8.times { entrance.spread([Zold::Id.new(id)]) }
51
+ assert_equal(1, entrance.to_json[:modified])
52
+ end
53
+ end
54
+
45
55
  def test_pushes_wallet
46
56
  sid = Zold::Id.new
47
57
  tid = Zold::Id.new
@@ -48,6 +48,11 @@ class TestId < Minitest::Test
48
48
  assert(id.to_s == hex, "#{id} is not equal to #{hex}")
49
49
  end
50
50
 
51
+ def test_compares_two_ids_by_text
52
+ id = Zold::Id.new.to_s
53
+ assert_equal(Zold::Id.new(id), Zold::Id.new(id))
54
+ end
55
+
51
56
  def test_compares_two_ids
52
57
  assert Zold::Id.new(Zold::Id::ROOT.to_s) == Zold::Id.new('0000000000000000')
53
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.30
4
+ version: 0.13.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko