zold 0.14.19 → 0.14.20

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: c3cb68abdacd80f8b216e8d10a1294daf4fab097
4
- data.tar.gz: 6aa61f6f6a664b45b423880116ca5c6a462bfe26
3
+ metadata.gz: 5cc5d6a70ba9da35b51e3c34a1493eb1e8f2c112
4
+ data.tar.gz: 468fc5a611aeaa7849256c814091d2a5e83b55ec
5
5
  SHA512:
6
- metadata.gz: ca68efb7ea0bd921feace2646bd5e032f785565b120eac070a7aa35af700fcabaf21a5af7dfd3607a6edd2d6e26e118397823b0ef198eb2a4efb90d203c99543
7
- data.tar.gz: 94773aa9d97a09ac728f3d893c8009deafccdc3bfcc8d2bf349574b2a1d841b916f8a576e5e542b0fc2a92b574d3ba4bed4d1d1052056ca83029d46e71fa1ce9
6
+ metadata.gz: 6b30088ce0a2f52dee378b440615af6c0748269c4528076dbd9085752c2afd957472b83e0a6316f2123a829e4aa40c23eeb06ce7e54419899e92c74bb1ea6e0e
7
+ data.tar.gz: '09b9ca12f2121bc6297f4f5bae6373e4a7fa741367b839ce04ce65dc54d24c8340196817940179d4b0daa1722726574a808e1b9a1fa51afcce30e2714290532c'
@@ -78,7 +78,7 @@ module Zold
78
78
  def debt
79
79
  txns = @wallet.txns
80
80
  scores = txns.map do |t|
81
- pfx, body = t.details.split(' ')
81
+ pfx, body = t.details.split(' ', 2)
82
82
  next if pfx != Tax::PREFIX || body.nil?
83
83
  score = Score.parse_text(body)
84
84
  next if !score.valid? || score.value != Tax::EXACT_SCORE
@@ -25,6 +25,6 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.14.19'
28
+ VERSION = '0.14.20'
29
29
  PROTOCOL = 2
30
30
  end
@@ -101,11 +101,11 @@ class TestRemote < Minitest::Test
101
101
  version: Zold::VERSION,
102
102
  score: zero.to_h,
103
103
  all: [
104
- { host: 'localhost', port: 888 }
104
+ { host: 'localhost', port: 8883 }
105
105
  ]
106
106
  }.to_json
107
107
  )
108
- stub_request(:get, 'http://localhost:888/remotes').to_return(status: 404)
108
+ stub_request(:get, 'http://localhost:8883/remotes').to_return(status: 404)
109
109
  cmd = Zold::Remote.new(remotes: remotes, log: test_log)
110
110
  cmd.run(%w[remote clean])
111
111
  assert(remotes.all.empty?)
@@ -46,9 +46,7 @@ class FakeNode
46
46
  start = Dir.pwd
47
47
  begin
48
48
  FakeHome.new.run do |home|
49
- server = TCPServer.new('127.0.0.1', 0)
50
- port = server.addr[1]
51
- server.close
49
+ port = FakeNode.random_port
52
50
  node = Thread.new do
53
51
  Zold::VerboseThread.new(@log).run do
54
52
  Thread.current.abort_on_exception = true
@@ -87,14 +85,14 @@ class FakeNode
87
85
  end
88
86
  end
89
87
 
90
- def self.port
88
+ def self.random_port
91
89
  loop do
92
90
  server = TCPServer.new('127.0.0.1', 0)
93
91
  port = server.addr[1]
94
92
  server.close
95
93
  next if @@ports.include?(port)
96
94
  @@ports << port
97
- port
95
+ return port
98
96
  end
99
97
  end
100
98
  end
@@ -59,6 +59,27 @@ class TestTax < Minitest::Test
59
59
  end
60
60
  end
61
61
 
62
+ def test_calculates_debt
63
+ FakeHome.new.run do |home|
64
+ wallet = home.create_wallet
65
+ wallet.add(
66
+ Zold::Txn.new(
67
+ 1,
68
+ Time.now - 24 * 60 * 60 * 365,
69
+ Zold::Amount.new(zld: 19.99),
70
+ 'NOPREFIX', Zold::Id.new, '-'
71
+ )
72
+ )
73
+ score = Zold::Score.new(
74
+ time: Time.now, host: 'localhost', port: 80, invoice: 'NOPREFIX@cccccccccccccccc',
75
+ suffixes: %w[A B C D E F G H I J K L M N O P Q R S T U V]
76
+ )
77
+ tax = Zold::Tax.new(wallet)
78
+ tax.pay(Zold::Key.new(file: 'fixtures/id_rsa'), score)
79
+ assert(tax.debt > Zold::Amount::ZERO)
80
+ end
81
+ end
82
+
62
83
  def test_checks_existence_of_duplicates
63
84
  FakeHome.new.run do |home|
64
85
  wallet = home.create_wallet
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.19
4
+ version: 0.14.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-26 00:00:00.000000000 Z
11
+ date: 2018-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby