factory_bro 0.0.6 → 0.0.7

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/factory_bro.rb +9 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1afbb0f6e03ea7f0298e5a5f2c3c872b12da82fa
4
- data.tar.gz: f480b8106407249e60cacfbdb3c66de979d2c90a
3
+ metadata.gz: ccbf3ce420985e7313564c11ccdb881e3ea61b15
4
+ data.tar.gz: 28a93e78439b63eb2ae45d9f9ed1fe40efb0b9af
5
5
  SHA512:
6
- metadata.gz: 27c1f080c07cdbcc1e3957f447bcf2c66eab74a15d7b8e4687ec2a974e721a7cf404c0b89753b657af861eb09a644f303e81e11079485999a743e4ba102652f0
7
- data.tar.gz: 5aca85f75b6a0be315abcc4912d7c407dd546ce6c45eff05eba14cd7ebb6c00b07de2f1226a76447e078f3ec8362762d786d4ba39a8da004816e973919d1c6a7
6
+ metadata.gz: 38c062e31591600f2a268fccc36044a115d6f92aeb059df150e63874f1c7692d5dc18481d1e7bc38d1b9b79de97c3d475524f7b96d255543223fb9407c118c3a
7
+ data.tar.gz: a433fda6ed7118c61de1bd7ff3d0d71da2948300f5892544548e302da31b43960c1e9ed5e5118e5b0683155b31bcefb7c0aacb25b46ed2cf48b5011faaa24b64
@@ -69,11 +69,15 @@ class FactoryBro
69
69
  private
70
70
 
71
71
  def self.parse_url(url)
72
- { :user => url.scan(/postgres:..[A-Za-z0-9]+/).first.split('//')[-1],
73
- :pw => url.scan(/:[A-Za-z0-9]+@/).first.gsub(/[^a-zA-Z0-9\-]/,""),
74
- :host => url.scan(/(?<=@)(.*)(?=:)/).first.first,
72
+ pwData = url.scan(/:[A-Za-z0-9]+@/).first
73
+ hostData = url.scan(/(?<=@)(.*)(?=:)/).first
74
+ user = (url.scan(/postgres:..[A-Za-z0-9]+/).first.split('//') - ['localhost', 'postgres:']).first
75
+
76
+ { :user => user,
75
77
  :port => url.scan(/:[0-9]+./).first.split('/').first.gsub(/[^a-zA-Z0-9\-]/,""),
76
- :dbname => url.scan(/.[A-Za-z0-9]+$/).first.gsub(/[^a-zA-Z0-9\-]/,"")
78
+ :dbname => url.scan(/.[A-Za-z0-9]+$/).first.gsub(/[^a-zA-Z0-9\-]/,""),
79
+ :host => hostData ? hostData.first : 'localhost',
80
+ :pw => pwData ? pwData.gsub(/[^a-zA-Z0-9\-]/,"") : nil
77
81
  }
78
82
  end
79
83
 
@@ -122,7 +126,7 @@ end
122
126
  if name.include? 'sign_in_ip'
123
127
  return "Faker::Internet.ip_v4_address"
124
128
  elsif name == 'email'
125
- return "Faker::Internet.safe_email"
129
+ return "test#{rand(99999)}@example.com"
126
130
  else
127
131
  return "Faker::Lorem.characters(32)"
128
132
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Reynolds
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-27 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg