cuculungwa 0.0.81 → 0.0.83

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cuculungwa/generators.rb +14 -10
  3. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9af1211250fcb6ccf0fd584fac836172686aa8b3
4
- data.tar.gz: 6a3f7a97ef7c05ca80a0f63e772d10c46eeb21cd
3
+ metadata.gz: 50562c7e720b0791fd72e81e3c6fc75c30124e75
4
+ data.tar.gz: a30ea8aade913a0c1bc46537b89649545289266c
5
5
  SHA512:
6
- metadata.gz: c729682e25de1e3ea494fc5e6c66925fc7fe9d7a7c9ea95f0bac19838d824e593311792fd3ce2d122ef2dd97a4f8646471c6c174f3130d571cfb29fe8935063d
7
- data.tar.gz: 65543956d1d2a18b3dadacc6b6e7b0c87b1c75afcbf72fe05383d840f582dffa75df010c03a1ed093d4581321eefaf0d8e20fc0986ed7a36948c938a9eb5d225
6
+ metadata.gz: eb3428e675052f79af27acc3baa4b00bd55f39df3e72a69b332c2cad84b464cd75579d7d88703af1e25b938bf816d5aa566b2e3f31ce02292988f452f377af7e
7
+ data.tar.gz: a2ed85df2b2470c32790fe16c3ef44f7cf8aaef35695e37ed208addb528846780c0bcbb14f6cd18713a86004590381c8a12bce61855e6f6867556910fc84b978
@@ -1,14 +1,9 @@
1
- module GenerateData
1
+ module Generators
2
2
  def get_unique_email(prefix = 'email', domain = 'test.com')
3
3
  # returns unique test email
4
4
  "#{prefix}-#{(Time.now.to_f * 1_000_000).to_i}@#{domain}"
5
5
  end
6
6
 
7
- def get_test_password
8
- # returns standard test password
9
- 'q1w2e3r4'
10
- end
11
-
12
7
  def get_random_currency_symbol
13
8
  currencies = %w(
14
9
  PLN EUR USD GBP CZK)
@@ -17,11 +12,20 @@ module GenerateData
17
12
 
18
13
  # generators below perform typical polish data
19
14
 
20
- def pesel_generator(data_type)
15
+ def pesel_generator(data_type, adult = true)
21
16
  # returns polish registration number of the population
22
17
  if data_type.eql? 'positive_data_set'
23
18
  weights = Array[1, 3, 7, 9, 1, 3, 7, 9, 1, 3]
24
- year = rand * 100
19
+ current_year = Time.new.year
20
+ temp_up = (current_year - 18).to_s[-2..-1].to_i
21
+ temp_down = (current_year - 99).to_s[-2..-1].to_i
22
+ if adult == true
23
+ year = (rand * 100).to_i
24
+ year = (rand * 100).to_i until (temp_down < year) && (year < temp_up)
25
+ else
26
+ year = (rand * 100).to_i
27
+ year = (rand * 100).to_i until (temp_down > year) || (year > temp_up)
28
+ end
25
29
  month = rand * 12 + 1
26
30
  day = rand * 28 + 1
27
31
  evidence_number = rand * 999
@@ -69,7 +73,7 @@ module GenerateData
69
73
  bank_prefix ||= sprintf('%08d', rand(10**8))
70
74
  bank_prefix = bank_prefix.to_s.gsub(/\s+/, '')
71
75
 
72
- fail 'Bank prefix error!' if bank_prefix.length < 4
76
+ raise 'Bank prefix error!' if bank_prefix.length < 4
73
77
 
74
78
  bank_prefix << '0001' if bank_prefix.length == 4
75
79
 
@@ -89,4 +93,4 @@ module GenerateData
89
93
  end
90
94
  end
91
95
  end
92
- World(GenerateData)
96
+ World(Generators)
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuculungwa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.81
4
+ version: 0.0.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Kaftanski
8
8
  - Jakub Kubiak
9
9
  - Tomasz Tokarski
10
10
  - Jaroslaw Biniek
11
+ - Maciej Krol
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []