Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 45 lines (33 sloc) 0.97 kB
8d74cdb @stympy Added a few tests
stympy authored
1 require File.dirname(__FILE__) + '/test_helper.rb'
2
3 class TestFakerInternet < Test::Unit::TestCase
4
5 def setup
6 @tester = Faker::Internet
7 end
8
9 def test_email
10 assert @tester.email.match(/.+@.+\.\w+/)
11 end
12
13 def test_free_email
14 assert @tester.free_email.match(/.+@(gmail|hotmail|yahoo)\.com/)
15 end
16
17 def test_user_name
18 assert @tester.user_name.match(/[a-z]+((_|\.)[a-z]+)?/)
19 end
20
21 def test_user_name_with_arg
22 assert @tester.user_name('bo peep').match(/(bo(_|\.)peep|peep(_|\.)bo)/)
23 end
24
25 def test_domain_name
26 assert @tester.domain_name.match(/\w+\.\w+/)
27 end
28
29 def test_domain_word
30 assert @tester.domain_word.match(/^\w+$/)
31 end
32
33 def test_domain_suffix
34 assert @tester.domain_suffix.match(/^\w+(\.\w+)?/)
35 end
fb8a7c6 @jasonrudolph Add support for generating IPv4 addresses
jasonrudolph authored
36
37 def test_ip_v4_address
38 assert_equal 3, @tester.ip_v4_address.count('.')
39
40 1000.times do
41 assert @tester.ip_v4_address.split('.').map{|octet| octet.to_i}.max <= 255
42 end
43 end
8d74cdb @stympy Added a few tests
stympy authored
44 end
Something went wrong with that request. Please try again.