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

23 lines
559 B
Crystal
Raw Normal View History

2022-02-16 22:31:59 +03:00
require "./spec_helper"
describe Faker::Code do
it "base 10 isbn" do
Faker::Code.isbn.match(/^\d{9}-[\d|X]$/).should_not eq nil
end
it "base 13 isbn" do
Faker::Code.isbn(13).match(/^\d{12}-\d$/).should_not eq nil
end
2022-02-16 22:46:05 +03:00
it "imei" do
Faker::Code.imei.match(/\A[\d.:\-\s]+\z/i).should_not eq nil
end
2022-02-16 22:31:59 +03:00
it "should return deterministic results when seeded" do
Faker.seed 123456
Faker::Code.isbn.should eq "394314441-0"
Faker::Code.isbn(13).should eq "205982563728-9"
2022-02-16 22:46:05 +03:00
Faker::Code.imei.should eq "860839366575918"
2022-02-16 22:31:59 +03:00
end
end