zold-score 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zold/score.rb +1 -1
- data/test/zold/test_score.rb +8 -0
- data/zold-score.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b95e6e5b07f648e57d06ddbcb8d93cf32fa4330f621fa67dee4fec4014b74979
|
4
|
+
data.tar.gz: eb9e2ba533897bbbde34dab6873b2c347f1e81cca15eb0380eb55120ee98afe5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a16f800d385d5d9eb07061e7c0e8d1c2dbfa6e530f7329480fbf65a168f3607fda47bc86384e2f4bba290b258cb2b71c6017e1ebbbedfa253d126867007ca5c9
|
7
|
+
data.tar.gz: '079dae179cb868a1cd8c5a9d6fc4cbf33419371125e0dee215a9f1556bcdcba97efe6c8c585cb1e5de74bb8b399c9941b4a19f11f6fa966465cb0f3a893ba146'
|
data/lib/zold/score.rb
CHANGED
@@ -197,7 +197,7 @@ module Zold
|
|
197
197
|
# Returns TRUE if the score is valid: all its suffixes correctly consistute
|
198
198
|
# the hash, according to the algorithm explained in the White Paper.
|
199
199
|
def valid?
|
200
|
-
@suffixes.empty? || hash.end_with?('0' * @strength)
|
200
|
+
(@suffixes.empty? || hash.end_with?('0' * @strength)) && @time < Time.now
|
201
201
|
end
|
202
202
|
|
203
203
|
# Returns the value of the score, from zero and up. The value is basically
|
data/test/zold/test_score.rb
CHANGED
@@ -133,6 +133,14 @@ class TestScore < Minitest::Test
|
|
133
133
|
assert(!score.expired?)
|
134
134
|
end
|
135
135
|
|
136
|
+
def test_is_not_valid_if_time_is_in_future
|
137
|
+
score = Zold::Score.new(
|
138
|
+
time: Time.now + 60 * 60, host: 'localhost', port: 443,
|
139
|
+
invoice: 'NOPREFIX@ffffffffffffffff', strength: 2
|
140
|
+
)
|
141
|
+
assert(!score.valid?)
|
142
|
+
end
|
143
|
+
|
136
144
|
def test_correct_number_of_zeroes
|
137
145
|
score = Zold::Score.new(
|
138
146
|
time: Time.now, host: 'localhost', port: 443,
|
data/zold-score.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.rubygems_version = '2.2'
|
28
28
|
s.required_ruby_version = '>=2.3'
|
29
29
|
s.name = 'zold-score'
|
30
|
-
s.version = '0.4.
|
30
|
+
s.version = '0.4.1'
|
31
31
|
s.license = 'MIT'
|
32
32
|
s.summary = 'Zold score'
|
33
33
|
s.description = 'Score calculating Ruby Gem for Zold'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zold-score
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
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-12-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|