Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add only japanese word spec #1750

Merged
merged 2 commits into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ja:
- "#{city_prefix}#{Name.last_name}#{city_suffix}"
- "#{Name.last_name}#{city_suffix}"
street_name:
- "#{Name.first_name}#{street_suffix}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jpananese address not have street_suffix in first_name and street_suffix.

- "#{Name.last_name}#{street_suffix}"
- "#{Name.first_name}"
- "#{Name.last_name}"
default_country: [日本]

ancient:
Expand Down
5 changes: 5 additions & 0 deletions test/support/assert_not_english.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

def assert_not_english(word)
assert_not_match(/[a-zA-Z]/, word)
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
add_filter ['.bundle', 'lib/extensions', 'test']
end

require 'test/support/assert_not_english'
require 'minitest/autorun'
require 'test/unit'
require 'rubygems'
Expand Down
34 changes: 30 additions & 4 deletions test/test_ja_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,24 @@ def teardown

def test_ja_address_methods
assert Faker::Address.postcode.is_a? String
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
Expand All @@ -35,12 +43,16 @@ def test_ja_color_methods

def test_ja_coffee_methods
assert Faker::Coffee.country.is_a? String
assert_not_english(Faker::Coffee.country)
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
Expand All @@ -49,10 +61,12 @@ def test_ja_dog_methods

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
Expand All @@ -63,43 +77,55 @@ def test_ja_lorem_methods

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 Faker::Name.female_first_name.is_a? String
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is not written original Japanese I18n.

assert Faker::Name.male_first_name.is_a? String
assert Faker::Name.suffix.is_a? String
assert Faker::Name.prefix.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_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_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_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