/
test_ja_locale.rb
184 lines (159 loc) · 6.15 KB
/
test_ja_locale.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# frozen_string_literal: true
require_relative 'test_helper'
class TestJaLocale < Test::Unit::TestCase
def setup
Faker::Config.locale = 'ja'
end
def teardown
Faker::Config.locale = nil
end
def test_ja_address_methods
assert Faker::Address.postcode.is_a? String
# Added Actual Japanese Zipcodes in lib/locals/ja.yml
assert_equal Faker::Address.postcode.size, 7
assert_not_english(Faker::Address.postcode)
assert Faker::Address.state.is_a? String
assert_not_english(Faker::Address.state)
assert Faker::Address.state_abbr.is_a? String
assert_not_english(Faker::Address.state_abbr)
assert Faker::Address.city_prefix.is_a? String
assert_not_english(Faker::Address.city_prefix)
assert Faker::Address.city_suffix.is_a? String
assert_not_english(Faker::Address.city_suffix)
assert Faker::Address.city.is_a? String
assert_not_english(Faker::Address.city)
assert Faker::Address.street_name.is_a? String
assert_not_english(Faker::Address.street_name)
end
def test_ja_ancient_methods
assert Faker::Ancient.god.is_a? String
assert_not_english(Faker::Ancient.god)
end
def test_ja_cat_methods
assert Faker::Creature::Cat.breed.is_a? String
assert_not_match(/[a-zA-Z]/, Faker::Creature::Cat.breed)
end
def test_ja_color_methods
assert Faker::Color.color_name.is_a? String
assert_not_english(Faker::Color.color_name)
end
def test_ja_book_methods
assert Faker::Book.title.is_a? String
assert_not_english(Faker::Book.title)
assert Faker::Book.author.is_a? String
assert_not_english(Faker::Book.author)
assert Faker::Book.publisher.is_a? String
assert_not_english(Faker::Book.publisher)
assert Faker::Book.genre.is_a? String
assert_not_english(Faker::Book.genre)
end
def test_ja_coffee_methods
assert Faker::Coffee.country.is_a? String
assert_not_english(Faker::Coffee.country)
end
def test_ja_commerce_methods
assert Faker::Commerce.department.is_a? String
assert_not_english(Faker::Commerce.department)
assert Faker::Commerce.product_name.is_a? String
assert_not_english(Faker::Commerce.product_name)
assert Faker::Commerce.promotion_code.is_a? String
assert_not_english(Faker::Commerce.promotion_code)
end
def test_ja_company_methods
assert Faker::Company.suffix.is_a? String
assert_not_english(Faker::Company.suffix)
assert Faker::Company.category.is_a? String
assert_not_english(Faker::Company.category)
assert Faker::Company.name.is_a? String
assert_not_english(Faker::Company.name)
end
def test_ja_dog_methods
assert Faker::Creature::Dog.breed.is_a? String
assert_not_match(/[a-zA-Z]/, Faker::Creature::Dog.breed)
end
def test_ja_food_methods
assert Faker::Food.sushi.is_a? String
assert_not_english(Faker::Food.sushi)
end
def test_ja_gender_methods
assert Faker::Gender.binary_type.is_a? String
assert_not_english(Faker::Gender.binary_type)
end
def test_ja_lorem_methods
assert Faker::Lorem.words.is_a? Array
assert Faker::Lorem.words(number: 1000)
assert Faker::Lorem.words(number: 10_000, supplemental: true)
assert_not_match(/ /, Faker::Lorem.paragraph)
end
def test_ja_name_methods
assert Faker::Name.last_name.is_a? String
assert_not_english(Faker::Name.last_name)
assert Faker::Name.first_name.is_a? String
assert_not_english(Faker::Name.first_name)
assert Faker::Name.name.is_a? String
assert_not_english(Faker::Name.name)
assert Faker::Name.name_with_middle.is_a? String
assert_not_english(Faker::Name.name_with_middle)
end
def test_ja_phone_number_methods
assert Faker::PhoneNumber.cell_phone.is_a? String
assert_not_english(Faker::PhoneNumber.cell_phone)
assert Faker::PhoneNumber.phone_number.is_a? String
assert_not_english(Faker::PhoneNumber.phone_number)
end
def test_ja_overwatch_methods
assert Faker::Games::Overwatch.hero.is_a? String
assert_not_english(Faker::Games::Overwatch.hero)
end
def test_ja_pokemon_methods
assert Faker::Games::Pokemon.name.is_a? String
assert_not_english(Faker::Games::Pokemon.name)
assert Faker::Games::Pokemon.location.is_a? String
assert_not_english(Faker::Games::Pokemon.location)
assert Faker::Games::Pokemon.move.is_a? String
assert_not_english(Faker::Games::Pokemon.move)
end
def test_ja_supermario_methods
assert Faker::Games::SuperMario.character.is_a? String
assert_not_english(Faker::Games::SuperMario.character)
assert Faker::Games::SuperMario.game.is_a? String
assert_not_english(Faker::Games::SuperMario.game)
assert Faker::Games::SuperMario.location.is_a? String
assert_not_english(Faker::Games::SuperMario.location)
end
def test_ja_zelda_methods
assert Faker::Games::Zelda.game.is_a? String
assert_not_english(Faker::Games::Zelda.game)
end
def test_ja_restaurant_methods
assert Faker::Restaurant.name.is_a? String
assert_not_english(Faker::Restaurant.name)
assert Faker::Restaurant.type.is_a? String
assert_not_english(Faker::Restaurant.type)
end
def test_ja_space_methods
assert Faker::Space.planet.is_a? String
assert_not_english(Faker::Space.planet)
assert Faker::Space.galaxy.is_a? String
end
def test_ja_subscription_methods
assert Faker::Subscription.plan.is_a? String
assert_not_english(Faker::Subscription.plan)
assert Faker::Subscription.status.is_a? String
assert_not_english(Faker::Subscription.status)
assert Faker::Subscription.payment_method.is_a? String
assert Array.new(10) { Faker::Subscription.payment_method }.any? { |word| !word.match?(/[a-zA-Z]/) }
assert Faker::Subscription.subscription_term.is_a? String
assert_not_english(Faker::Subscription.subscription_term)
assert Faker::Subscription.payment_term.is_a? String
assert_not_english(Faker::Subscription.payment_term)
end
def test_ja_university_methods
assert Faker::University.prefix.is_a? String
assert_not_english(Faker::University.prefix)
assert Faker::University.suffix.is_a? String
assert_not_english(Faker::University.suffix)
assert Faker::University.name.is_a? String
assert_not_english(Faker::University.name)
end
end