-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
require "./spec_helper" | ||
|
||
describe Faker do | ||
it "works" do | ||
# Faker.numerify("###").match(/\d{3}/) { |md| md.size }.should eq 3 | ||
it "numerify" do | ||
100.times do | ||
assert { Faker.numerify("###").match(/[1-9]\d{2}/).should_not eq nil } | ||
end | ||
end | ||
|
||
it "letterify" do | ||
assert { Faker.letterify("???").match(/[A-Z]{3}/).should_not eq nil } | ||
end | ||
|
||
it "regexify" do | ||
{ | ||
"uk post code" => /^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/, | ||
"us phone" => /^(1-?)[2-8][0-1][0-9]-\d{3}-\d{4}$/, | ||
}.each do |label, re| | ||
10.times do | ||
assert { Faker.regexify(re).match(re).should_not eq nil } | ||
end | ||
end | ||
end | ||
end |
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