factory-helper 1.7.5 → 1.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/factory-helper/version.rb +1 -1
- data/spec/config_spec.rb +18 -0
- data/spec/factory_helper/my_sql_spec.rb +123 -0
- data/spec/factory_helper/string_spec.rb +55 -0
- data/spec/rspec_locale_hooks_spec.rb +28 -0
- data/spec/spec_helper.rb +92 -0
- data/test/legacy/test_array_sample_method_compat.rb +56 -0
- data/test/legacy/test_avatar.rb +36 -0
- data/test/legacy/test_en_au_ocker_locale.rb +23 -0
- data/test/legacy/test_en_ca_locale.rb +18 -0
- data/test/legacy/test_en_locale.rb +25 -0
- data/test/legacy/test_en_us_locale.rb +79 -0
- data/test/legacy/test_es_locale.rb +34 -0
- data/test/legacy/test_faker.rb +29 -0
- data/test/legacy/test_faker_app.rb +12 -0
- data/test/legacy/test_faker_bitcoin.rb +14 -0
- data/test/legacy/test_faker_business.rb +33 -0
- data/test/legacy/test_faker_city.rb +46 -0
- data/test/legacy/test_faker_code.rb +27 -0
- data/test/legacy/test_faker_commerce.rb +74 -0
- data/test/legacy/test_faker_company.rb +19 -0
- data/test/legacy/test_faker_date.rb +77 -0
- data/test/legacy/test_faker_hacker_talk.rb +37 -0
- data/test/legacy/test_faker_internet.rb +146 -0
- data/test/legacy/test_faker_lorem.rb +87 -0
- data/test/legacy/test_faker_name.rb +20 -0
- data/test/legacy/test_faker_number.rb +77 -0
- data/test/legacy/test_faker_street.rb +53 -0
- data/test/legacy/test_faker_team.rb +13 -0
- data/test/legacy/test_faker_time.rb +74 -0
- data/test/legacy/test_flexible.rb +57 -0
- data/test/legacy/test_locale.rb +45 -0
- data/test/legacy/test_pl_locale.rb +27 -0
- data/test/test_avatar.rb +36 -0
- data/test/test_determinism.rb +57 -0
- data/test/test_en_au_ocker_locale.rb +23 -0
- data/test/test_en_ca_locale.rb +18 -0
- data/test/test_en_locale.rb +25 -0
- data/test/test_en_us_locale.rb +79 -0
- data/test/test_es_locale.rb +34 -0
- data/test/test_factory_helper.rb +28 -0
- data/test/test_factory_helper_app.rb +12 -0
- data/test/test_factory_helper_bitcoin.rb +14 -0
- data/test/test_factory_helper_business.rb +33 -0
- data/test/test_factory_helper_city.rb +46 -0
- data/test/test_factory_helper_code.rb +27 -0
- data/test/test_factory_helper_commerce.rb +70 -0
- data/test/test_factory_helper_company.rb +23 -0
- data/test/test_factory_helper_date.rb +78 -0
- data/test/test_factory_helper_hacker_talk.rb +37 -0
- data/test/test_factory_helper_internet.rb +155 -0
- data/test/test_factory_helper_lorem.rb +87 -0
- data/test/test_factory_helper_name.rb +54 -0
- data/test/test_factory_helper_number.rb +77 -0
- data/test/test_factory_helper_slack_emoji.rb +45 -0
- data/test/test_factory_helper_street.rb +53 -0
- data/test/test_factory_helper_team.rb +13 -0
- data/test/test_factory_helper_time.rb +74 -0
- data/test/test_flexible.rb +57 -0
- data/test/test_fr_locale.rb +34 -0
- data/test/test_helper.rb +15 -0
- data/test/test_locale.rb +45 -0
- data/test/test_pl_locale.rb +27 -0
- metadata +144 -20
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFactoryHelperBitcoin < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_address
|
6
|
+
assert FactoryHelper::Bitcoin.address.match(/^[13][1-9A-Za-z][^OIl]{20,40}/)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_testnet_address
|
10
|
+
assert_match(/\A[mn][1-9A-Za-z]{32,34}\Z/, FactoryHelper::Bitcoin.testnet_address)
|
11
|
+
assert_not_match(/[OIl]/, FactoryHelper::Bitcoin.testnet_address)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestFactoryHelperBusiness < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@tester = FactoryHelper::Business
|
7
|
+
@credit_card_number_list = I18n.translate('factory_helper.business.credit_card_numbers')
|
8
|
+
@credit_card_number_expiry_dates = I18n.translate('factory_helper.business.credit_card_expiry_dates')
|
9
|
+
@credit_card_types = I18n.translate('factory_helper.business.credit_card_types')
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_credit_card_number
|
13
|
+
number1 = @tester.credit_card_number
|
14
|
+
number2 = @tester.credit_card_number
|
15
|
+
assert @credit_card_number_list.include?(number1)
|
16
|
+
assert @credit_card_number_list.include?(number2)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_credit_card_expiry_date
|
20
|
+
date1 = @tester.credit_card_expiry_date
|
21
|
+
date2 = @tester.credit_card_expiry_date
|
22
|
+
assert @credit_card_number_expiry_dates.collect{|d| Date.parse(d)}.include?(date1)
|
23
|
+
assert @credit_card_number_expiry_dates.collect{|d| Date.parse(d)}.include?(date2)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_credit_card_type
|
27
|
+
type1 = @tester.credit_card_type
|
28
|
+
type2 = @tester.credit_card_type
|
29
|
+
assert @credit_card_types.include?(type1)
|
30
|
+
assert @credit_card_types.include?(type2)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestFactoryHelperCity < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
I18n.reload!
|
6
|
+
xx = {
|
7
|
+
:factory_helper => {
|
8
|
+
:name => {:female_first_name => ['alice'], :male_first_name => ['alice'], :last_name => ['smith']},
|
9
|
+
:address => {:city_prefix => ['west'], :city_suffix => ['burg']}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
I18n.backend.store_translations(:xx, xx)
|
13
|
+
|
14
|
+
xy = {
|
15
|
+
:factory_helper => {
|
16
|
+
:address => {
|
17
|
+
:city_prefix => ['big'],
|
18
|
+
:city_root => ['rock'],
|
19
|
+
:city_root_suffix => ['ing'],
|
20
|
+
:city_suffix => ['town'],
|
21
|
+
:city => ['#{city_prefix} #{city_root}#{city_root_suffix} #{city_suffix}']
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
I18n.backend.store_translations(:xy, xy)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_default_city_formats
|
29
|
+
I18n.with_locale(:xx) do
|
30
|
+
100.times do
|
31
|
+
cities = ["west alice", "west smith", "west aliceburg", "west smithburg", "aliceburg", "smithburg"]
|
32
|
+
city = FactoryHelper::Address.city
|
33
|
+
assert cities.include?(city), "Expected <#{cities.join(' / ')}>, but got #{city}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_city_formats_are_flexible
|
39
|
+
I18n.with_locale(:xy) do
|
40
|
+
cities = ['big rocking town']
|
41
|
+
city = FactoryHelper::Address.city
|
42
|
+
assert cities.include?(city), "Expected <#{cities.join(' / ')}>, but got #{city}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestFactoryHelperCode < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@tester = FactoryHelper::Code
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_default_isbn_regexp
|
9
|
+
assert @tester.isbn.match(/^\d{9}-[\d|X]$/)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_default_isbn13_regexp
|
13
|
+
assert @tester.isbn(13).match(/^\d{12}-\d$/)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_default_ean_regexp
|
17
|
+
assert @tester.ean.match(/^\d{13}$/)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_default_ean8_regexp
|
21
|
+
assert @tester.ean(8).match(/^\d{8}$/)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_rut
|
25
|
+
assert @tester.rut.match(/^\d{1,8}-(\d|k)$/)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFactoryHelperCommerce < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@tester = FactoryHelper::Commerce
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_color
|
10
|
+
assert @tester.color.match(/[a-z]+\.?/)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_department
|
14
|
+
assert @tester.department.match(/[A-Z][a-z]+\.?/)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_single_department_should_not_contain_separators
|
18
|
+
assert_match(/\A[A-Za-z]+\z/, @tester.department(1))
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_department_should_have_ampersand_as_default_separator
|
22
|
+
assert_match ' & ', @tester.department(2, true)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_department_should_accept_localized_separator
|
26
|
+
data = {
|
27
|
+
:factory_helper => {
|
28
|
+
:separator => ' + ',
|
29
|
+
:commerce => {
|
30
|
+
:department => ['Books', 'Movies']
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
I18n.reload!
|
36
|
+
I18n.backend.store_translations(:xy, data)
|
37
|
+
I18n.with_locale(:xy) do
|
38
|
+
assert_match ' + ', @tester.department(2, true)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_department_should_have_exact_number_of_categories_when_fixed_amount
|
43
|
+
assert_match(/\A([A-Za-z]+, ){8}[A-Za-z]+ & [A-Za-z]+\z/, @tester.department(10, true))
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_department_should_never_exceed_the_max_number_of_categories_when_random_amount
|
47
|
+
100.times do
|
48
|
+
assert_match(/\A([A-Za-z]+(, | & )){0,5}[A-Za-z]+\z/, @tester.department(6))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_department_should_have_no_duplicate_categories
|
53
|
+
department = @tester.department(10, true)
|
54
|
+
|
55
|
+
departments = department.split(/[,& ]+/)
|
56
|
+
assert_equal departments, departments.uniq
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_product_name
|
60
|
+
assert @tester.product_name.match(/[A-Z][a-z]+\.?/)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_price
|
64
|
+
assert_includes 0..100, @tester.price
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_price_is_float
|
68
|
+
assert @tester.price.is_a? Float
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFactoryHelperCompany < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@tester = FactoryHelper::Company
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_ein
|
9
|
+
assert @tester.ein.match(/\d\d-\d\d\d\d\d\d\d/)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_duns_number
|
13
|
+
assert @tester.duns_number.match(/\d\d-\d\d\d-\d\d\d\d/)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_logo
|
17
|
+
assert @tester.logo.match(%r{http://pigment.github.io/fake-logos/logos/medium/color/\d+\.png})
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_buzzword
|
21
|
+
assert @tester.buzzword.match(/\w+\.?/)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFactoryHelperDate < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@tester = FactoryHelper::Date
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_between
|
9
|
+
from = Date.parse("2012-01-01")
|
10
|
+
to = Date.parse("2013-01-01")
|
11
|
+
|
12
|
+
100.times do
|
13
|
+
random_date = @tester.between(from, to)
|
14
|
+
assert random_date >= from, "Expected >= \"#{from}\", but got #{random_date}"
|
15
|
+
assert random_date <= to , "Expected <= \"#{to}\", but got #{random_date}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_forward
|
20
|
+
today = Date.today
|
21
|
+
|
22
|
+
100.times do
|
23
|
+
random_date = @tester.forward(5)
|
24
|
+
assert random_date > today, "Expected > \"#{today}\", but got #{random_date}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_backward
|
29
|
+
today = Date.today
|
30
|
+
|
31
|
+
100.times do
|
32
|
+
random_date = @tester.backward(5)
|
33
|
+
assert random_date < today, "Expected < \"#{today}\", but got #{random_date}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_return_type
|
38
|
+
random_forward = @tester.forward(5)
|
39
|
+
random_backward = @tester.backward(5)
|
40
|
+
random_between = @tester.between(Date.today, Date.today + 5)
|
41
|
+
|
42
|
+
[random_forward, random_backward, random_between].each do |result|
|
43
|
+
assert result.is_a?(Date), "Expected a Date object, but got #{result.class}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_invalid_date
|
48
|
+
assert_raise ArgumentError do
|
49
|
+
@tester.between("9999-99-99", "9999-99-99")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_birthday
|
54
|
+
min = 40
|
55
|
+
max = 90
|
56
|
+
100.times do
|
57
|
+
t = Date.today
|
58
|
+
date_min = Date.new(t.year - min, t.month, t.day)
|
59
|
+
date_max = Date.new(t.year - max, t.month, t.day)
|
60
|
+
birthday = @tester.birthday(min, max)
|
61
|
+
assert birthday > date_max, "Expect > \"#{date_max}\", but got #{birthday}"
|
62
|
+
assert birthday < date_min, "Expect > \"#{date_max}\", but got #{birthday}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_default_birthday
|
67
|
+
min = 10
|
68
|
+
max = 65
|
69
|
+
100.times do
|
70
|
+
t = Date.today
|
71
|
+
date_min = Date.new(t.year - min, t.month, t.day)
|
72
|
+
date_max = Date.new(t.year - max, t.month, t.day)
|
73
|
+
birthday = @tester.birthday
|
74
|
+
assert birthday > date_max, "Expect > \"#{date_max}\", but got #{birthday}"
|
75
|
+
assert birthday < date_min, "Expect > \"#{date_max}\", but got #{birthday}"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class TestFactoryHelperHacker < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@hacker = FactoryHelper::Hacker
|
6
|
+
@phrases = @hacker.phrases
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_phrases
|
10
|
+
assert @phrases.size == 8
|
11
|
+
@phrases.each do |phrase|
|
12
|
+
assert !phrase.nil?
|
13
|
+
assert phrase != ""
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_noun
|
18
|
+
assert @hacker.noun.match(/\w+/)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_abbreviation
|
22
|
+
assert @hacker.abbreviation.match(/\w+/)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_adjective
|
26
|
+
assert @hacker.adjective.match(/\w+/)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_verb
|
30
|
+
assert @hacker.verb.match(/\w+/)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_ingverb
|
34
|
+
assert @hacker.ingverb.match(/\w+/)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
3
|
+
|
4
|
+
class TestFactoryHelperInternet < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@tester = FactoryHelper::Internet
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_email
|
11
|
+
assert @tester.email.match(/.+@.+\.\w+/)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_localized_email
|
15
|
+
I18n.available_locales.each do |locale|
|
16
|
+
I18n.with_locale(locale) do
|
17
|
+
email= @tester.email
|
18
|
+
raise "#{locale} localized email: #{email}" unless email.match(/.+@.+\..+/)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_free_email
|
24
|
+
assert @tester.free_email.match(/.+@(gmail|hotmail|yahoo)\.com/)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_safe_email
|
28
|
+
assert @tester.safe_email.match(/.+@example.(com|net|org)/)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_user_name
|
32
|
+
assert @tester.user_name.match(/[a-z]+((_|\.)[a-z]+)?/)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_user_name_with_string_arg
|
36
|
+
assert @tester.user_name('bo peep').match(/(bo(_|\.)peep|peep(_|\.)bo)/)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_user_name_with_integer_arg
|
40
|
+
(1..32).each do |min_length|
|
41
|
+
assert @tester.user_name(min_length).length >= min_length
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_user_name_with_closed_range_arg
|
46
|
+
(1..32).each do |min_length|
|
47
|
+
(min_length..32).each do |max_length|
|
48
|
+
l = @tester.user_name((min_length..max_length)).length
|
49
|
+
assert l >= min_length
|
50
|
+
assert l <= max_length
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_user_name_with_open_range_arg
|
56
|
+
(1..32).each do |min_length|
|
57
|
+
(min_length+1..33).each do |max_length|
|
58
|
+
l = @tester.user_name((min_length...max_length)).length
|
59
|
+
assert l >= min_length
|
60
|
+
assert l <= max_length-1
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_user_name_with_range_and_separators
|
66
|
+
(1..32).each do |min_length|
|
67
|
+
(min_length+1..33).each do |max_length|
|
68
|
+
u = @tester.user_name((min_length...max_length), %w(=))
|
69
|
+
assert u.length.between? min_length, max_length-1
|
70
|
+
assert u.match(/\A[a-z]+((=)?[a-z]*)*\z/)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_password
|
76
|
+
assert @tester.password.match(/\w{3}/)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_password_with_integer_arg
|
80
|
+
(1..32).each do |min_length|
|
81
|
+
assert @tester.password(min_length).length >= min_length
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_password_max_with_integer_arg
|
86
|
+
(1..32).each do |min_length|
|
87
|
+
max_length = min_length + 4
|
88
|
+
assert @tester.password(min_length, max_length).length <= max_length
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_domain_name
|
93
|
+
assert @tester.domain_name.match(/\w+\.\w+/)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_domain_word
|
97
|
+
assert @tester.domain_word.match(/^\w+$/)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_domain_suffix
|
101
|
+
assert @tester.domain_suffix.match(/^\w+(\.\w+)?/)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_ip_v4_address
|
105
|
+
assert_equal 3, @tester.ip_v4_address.count('.')
|
106
|
+
|
107
|
+
1000.times do
|
108
|
+
assert @tester.ip_v4_address.split('.').map{|octet| octet.to_i}.max <= 255
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_mac_address
|
113
|
+
assert_equal 5, @tester.mac_address.count(':')
|
114
|
+
assert_equal 5, @tester.mac_address("").count(':')
|
115
|
+
|
116
|
+
1000.times do
|
117
|
+
assert @tester.mac_address.split(':').map{|d| d.to_i(16)}.max <= 255
|
118
|
+
end
|
119
|
+
|
120
|
+
assert @tester.mac_address("fa:fa:fa").start_with?("fa:fa:fa")
|
121
|
+
assert @tester.mac_address("01:02").start_with?("01:02")
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_ip_v6_address
|
125
|
+
assert_equal 7, @tester.ip_v6_address.count(':')
|
126
|
+
|
127
|
+
1000.times do
|
128
|
+
assert @tester.ip_v6_address.split('.').map{|h| "0x#{h}".hex}.max <= 65535
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_slug
|
133
|
+
assert @tester.slug.match(/^[a-z]+(_|\.|\-)[a-z]+$/)
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_slug_with_content_arg
|
137
|
+
assert @tester.slug('Foo bAr baZ').match(/^foo(_|\.|\-)bar(_|\.|\-)baz$/)
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_slug_with_glue_arg
|
141
|
+
assert @tester.slug(nil, '+').match(/^[a-z]+\+[a-z]+$/)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_url
|
145
|
+
assert @tester.url('domain.com', '/username').match(/^http:\/\/domain\.com\/username$/)
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_device_token
|
149
|
+
assert_equal 64, @tester.device_token.size
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_fix_umlauts
|
153
|
+
assert_equal "aeoeuess", FactoryHelper::Internet.fix_umlauts('äöüß')
|
154
|
+
end
|
155
|
+
end
|