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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6705ffd219a4069f1dd5bfcf53f79c919e682f351b1f2802acbe2dd33d4cb32b
4
- data.tar.gz: d4e077c6705ef8bedbff3b920f0547d5c535e49d03b4b06bea4026bf13bfff0c
3
+ metadata.gz: b95e6e5b07f648e57d06ddbcb8d93cf32fa4330f621fa67dee4fec4014b74979
4
+ data.tar.gz: eb9e2ba533897bbbde34dab6873b2c347f1e81cca15eb0380eb55120ee98afe5
5
5
  SHA512:
6
- metadata.gz: f338a0958b7be48d5ae3ef5ab1b433788fbcce2334773ec7deea50283bf595dbefbe2ab08b180192fb580a03dfada6d8018e06c183e7b1aa3ad0783a2278a454
7
- data.tar.gz: b703969c9f94f564c8da37910c7bdc7a7cd72db7e8eacff4025e465a52f43c016aea73d49516b1ed7f6f6132e9fa93f7f5b9c72a0e1ec69c1e002a5f284aaca3
6
+ metadata.gz: a16f800d385d5d9eb07061e7c0e8d1c2dbfa6e530f7329480fbf65a168f3607fda47bc86384e2f4bba290b258cb2b71c6017e1ebbbedfa253d126867007ca5c9
7
+ data.tar.gz: '079dae179cb868a1cd8c5a9d6fc4cbf33419371125e0dee215a9f1556bcdcba97efe6c8c585cb1e5de74bb8b399c9941b4a19f11f6fa966465cb0f3a893ba146'
@@ -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
@@ -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,
@@ -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.0'
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.0
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-08 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov