1
0
mirror of https://github.com/askn/faker.git synced 2023-08-10 21:13:01 +03:00
faker/spec/faker_spec.cr

25 lines
593 B
Crystal
Raw Permalink Normal View History

2016-01-05 17:49:33 +03:00
require "./spec_helper"
describe Faker do
2016-01-15 11:36:23 +03:00
it "numerify" do
100.times do
2016-01-17 23:31:08 +03:00
Faker.numerify("###").match(/[1-9]\d{2}/).should_not eq nil
2016-01-15 11:36:23 +03:00
end
end
it "letterify" do
2016-01-17 23:31:08 +03:00
Faker.letterify("???").match(/[A-Z]{3}/).should_not eq nil
2016-01-15 11:36:23 +03:00
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
2016-01-17 23:31:08 +03:00
Faker.regexify(re).match(re).should_not eq nil
2016-01-15 11:36:23 +03:00
end
end
2016-01-05 17:49:33 +03:00
end
end