zold 0.14.19 → 0.14.20
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/lib/zold/tax.rb +1 -1
- data/lib/zold/version.rb +1 -1
- data/test/commands/test_remote.rb +2 -2
- data/test/node/fake_node.rb +3 -5
- data/test/test_tax.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cc5d6a70ba9da35b51e3c34a1493eb1e8f2c112
|
4
|
+
data.tar.gz: 468fc5a611aeaa7849256c814091d2a5e83b55ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b30088ce0a2f52dee378b440615af6c0748269c4528076dbd9085752c2afd957472b83e0a6316f2123a829e4aa40c23eeb06ce7e54419899e92c74bb1ea6e0e
|
7
|
+
data.tar.gz: '09b9ca12f2121bc6297f4f5bae6373e4a7fa741367b839ce04ce65dc54d24c8340196817940179d4b0daa1722726574a808e1b9a1fa51afcce30e2714290532c'
|
data/lib/zold/tax.rb
CHANGED
@@ -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
|
data/lib/zold/version.rb
CHANGED
@@ -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:
|
104
|
+
{ host: 'localhost', port: 8883 }
|
105
105
|
]
|
106
106
|
}.to_json
|
107
107
|
)
|
108
|
-
stub_request(:get, 'http://localhost:
|
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?)
|
data/test/node/fake_node.rb
CHANGED
@@ -46,9 +46,7 @@ class FakeNode
|
|
46
46
|
start = Dir.pwd
|
47
47
|
begin
|
48
48
|
FakeHome.new.run do |home|
|
49
|
-
|
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.
|
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
|
data/test/test_tax.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2018-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|