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

Added Faker::Code.isbn

This commit is contained in:
Egor Romanov
2022-02-16 22:31:59 +03:00
parent 9f8608f7cd
commit e2c95c114d
3 changed files with 55 additions and 0 deletions

17
spec/code_spec.cr Normal file
View File

@@ -0,0 +1,17 @@
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
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"
end
end