Sha256: 2e37e1b7937a0454e9fa78728dbf13e5b4cfec9bf797703ff7850f7c192e83ba

Contents?: true

Size: 694 Bytes

Versions: 4

Compression:

Stored size: 694 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper.rb'

class TestFakerCode < Test::Unit::TestCase
  def setup
    @tester = Faker::Code
  end

  def test_npi_regexp
    assert @tester.npi.match(/[0-9]{10}/)
  end

  def test_default_isbn_regexp
    assert @tester.isbn.match(/^\d{9}-[\d|X]$/)
  end

  def test_default_isbn13_regexp
    assert @tester.isbn(13).match(/^\d{12}-\d$/)
  end

  def test_default_ean_regexp
    assert @tester.ean.match(/^\d{13}$/)
  end

  def test_default_ean8_regexp
    assert @tester.ean(8).match(/^\d{8}$/)
  end

  def test_rut
    assert @tester.rut.match(/^\d{1,8}-(\d|k)$/)
  end

  def test_nric
    assert @tester.nric.match(/^(S|T)\d{7}[A-JZ]$/)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
faker-1.6.3 test/test_faker_code.rb
faker-1.6.2 test/test_faker_code.rb
faker-1.6.1 test/test_faker_code.rb
faker-1.6.0 test/test_faker_code.rb