ffaker 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -76,6 +76,14 @@ Try it in your own machine, your mileage may vary!
76
76
 
77
77
  == Changelog
78
78
 
79
+ * 0.4.x
80
+
81
+ Api (with contributions by Robert Berry)
82
+
83
+ Faker::Internet.uri(protocol)
84
+ Faker::Internet.http_url
85
+ Faker::Internet.ip_v4_address
86
+
79
87
  * 0.4.0
80
88
 
81
89
  Api additions by Rafael Souza
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.rubygems_version = '1.3.5'
6
6
 
7
7
  s.name = 'ffaker'
8
- s.version = '1.0.0'
9
- s.date = '2010-11-04'
8
+ s.version = '1.1.0'
9
+ s.date = '2011-01-15'
10
10
  s.rubyforge_project = 'ffaker'
11
11
 
12
12
  s.summary = "Faster Faker, generates dummy data."
@@ -1,5 +1,5 @@
1
1
  module Faker
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
 
4
4
  require 'ffaker/utils/module_utils'
5
5
 
@@ -44,6 +44,19 @@ module Faker
44
44
  DOMAIN_SUFFIXES.rand
45
45
  end
46
46
 
47
+ def uri(protocol)
48
+ "#{protocol}://#{domain_name}"
49
+ end
50
+
51
+ def http_url
52
+ uri("http")
53
+ end
54
+
55
+ def ip_v4_address
56
+ (1..4).map { BYTE.random_pick(1) }.join(".")
57
+ end
58
+
59
+ BYTE = k((0..255).to_a.map { |n| n.to_s })
47
60
  HOSTS = k %w(gmail.com yahoo.com hotmail.com)
48
61
  DOMAIN_SUFFIXES = k %w(co.uk com us uk ca biz info name)
49
62
  end
@@ -36,4 +36,19 @@ class TestFakerInternet < Test::Unit::TestCase
36
36
  def test_domain_suffix
37
37
  assert @tester.domain_suffix.match(/^\w+(\.\w+)?/)
38
38
  end
39
+
40
+ def test_uri
41
+ assert @tester.uri("ftp").match(/^ftp:\/\/.+/)
42
+ assert @tester.uri("http").match(/^http:\/\/.+/)
43
+ assert @tester.uri("https").match(/^https:\/\/.+/)
44
+ end
45
+
46
+ def test_http_url
47
+ assert @tester.http_url.match(/^http:\/\/.+/)
48
+ end
49
+
50
+ def test_ip_v4_address
51
+ assert @tester.ip_v4_address.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)
52
+ end
53
+
39
54
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffaker
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Emmanuel Oga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-04 00:00:00 -03:00
18
+ date: 2011-01-15 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies: []
21
21