cuculungwa 0.0.46 → 0.0.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cuculungwa.rb +12 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eab74c8b33adc6bed7c46adba0f9e4c6f1d3b8c
|
4
|
+
data.tar.gz: 4500077934b8854906454fa18c52d537e842193d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9edff6a51cdce2019b3a98222a3b3e80ad8fa3b3537f9d6b5b3be2dbae141e7ac2d66fdd629ab5c8a4f5e4ed658bb747ec5875c0bf06e4d97c61ff7be8a2a432
|
7
|
+
data.tar.gz: dd31a1e1c07a1cc1a0d712407e86412ed99539f401d06d5aed79427b724bd6c2f2530c437e41a4b01d32c1a923fb302ac807929fb6a47b1bb600637b2669e597
|
data/lib/cuculungwa.rb
CHANGED
@@ -113,17 +113,16 @@ module GenerateData
|
|
113
113
|
|
114
114
|
def nip_generator(data_type)
|
115
115
|
if (data_type.eql? 'positive_data_set')
|
116
|
-
weights =
|
117
|
-
code = rand()
|
118
|
-
number = rand()
|
119
|
-
nip =
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
return nip + control_sum.to_s
|
116
|
+
weights = [6, 5, 7, 2, 3, 4, 5, 6, 7]
|
117
|
+
code = rand(998-101) + 101
|
118
|
+
number = rand(1000000)
|
119
|
+
nip = code.to_s + number.to_s.rjust(6, '0')
|
120
|
+
|
121
|
+
c = nip.split(//).map! {|x| x.to_i}
|
122
|
+
sum = c.zip(weights).map! {|x| x[0]*x[1]}.reduce(:+) % 11
|
123
|
+
|
124
|
+
sum = sum == 10 ? 0 : sum
|
125
|
+
return nip + sum.to_s
|
127
126
|
elsif (data_type.eql? 'negative_data_set')
|
128
127
|
return "000"
|
129
128
|
else
|
@@ -162,15 +161,14 @@ module Utils
|
|
162
161
|
return iban_number
|
163
162
|
end
|
164
163
|
|
165
|
-
def wait_for_expected_result(timespan = @app.config['capybara']['default_wait_time'])
|
164
|
+
def wait_for_expected_result(timespan = @app.config['capybara']['default_wait_time'], exception_type = RSpec::Expectations::ExpectationNotMetError)
|
166
165
|
# Default setting: get default wait time from config.yml
|
167
|
-
|
168
166
|
_then = Time.now
|
169
167
|
while true
|
170
168
|
begin
|
171
169
|
yield
|
172
170
|
break
|
173
|
-
rescue
|
171
|
+
rescue exception_type => e
|
174
172
|
# Expectations were not met, check if we timed out, otherwise try one more time
|
175
173
|
if Time.now > _then + timespan then
|
176
174
|
puts "Timeout."
|