Sha256: 525248fe594d67d3d309a4d67d52121af6747a59e36b131c7ef1eea6cc4a35e6

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative 'helper'

class TestAddressID < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFakerTW::AddressID,
    :zip_code, :state, :state_abbr, :city, :street_prefix, :street
  )

  def test_zip_code
    assert_match(/\A\d{5}\z/, FFakerTW::AddressID.zip_code)
  end

  def test_state
    assert FFakerTW::AddressID::STATE.include?(FFakerTW::AddressID.state)
  end

  def test_state_abbr
    assert FFakerTW::AddressID::STATE_ABBR.include?(FFakerTW::AddressID.state_abbr)
  end

  def test_city
    assert_include FFakerTW::AddressID::CITY, FFakerTW::AddressID.city
  end

  def test_street_prefix
    assert FFakerTW::AddressID::STREET_PREFIX.include?(FFakerTW::AddressID.street_prefix)
  end

  def test_street
    prefixes = FFakerTW::AddressID::STREET_PREFIX
    common_street_names = FFakerTW::AddressID::COMMON_STREET_NAMES
    regex = /\A(#{prefixes.join('|')})\.(\s(#{common_street_names.join('|')})),\sNo\.\s\d+\z/
    assert_match(regex, FFakerTW::AddressID.street)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffakerTW-0.1.0 test/test_address_id.rb