forked from faker-ruby/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Faker::PhoneNumber.country_code (faker-ruby#1426)
* adds country code for phone numbers and cel phones * use interpolation for string, move country codes to phone_number file, Add and update country codes data * update documentation with new methods * add + sign in front of country code * update data of country codes, replace spaces with dashes, sort strings of country codes, add new line for text * add test cases for new country code related functions * update test cases, refactor code * Update CHANGELOG.md * Update CHANGELOG.md
- Loading branch information
1 parent
cb80661
commit 7c92fc4
Showing
5 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
require_relative 'test_helper' | ||
|
||
class TestFakerPhone < Test::Unit::TestCase | ||
def setup | ||
@tester = Faker::PhoneNumber | ||
@phone_with_country_code_regex = /\A\+[\s|\d|\-|\(|\)|x|\.]*\z/ | ||
end | ||
|
||
def test_country_code | ||
assert @tester.country_code.match(/\A\+[\d|-]+\z/) | ||
end | ||
|
||
def test_phone_number_with_country_code | ||
assert @tester.phone_number_with_country_code.match(@phone_with_country_code_regex) | ||
end | ||
|
||
def test_cell_phone_with_country_code | ||
assert @tester.cell_phone_with_country_code.match(@phone_with_country_code_regex) | ||
end | ||
end |