Sha256: cdffdfb34fdac13f13b124777e869e1da0654292e9cc5773882596e54b32bd3b

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require_relative 'helper'

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

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

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

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

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffaker-2.23.0 test/test_address_id.rb
ffaker-2.22.0 test/test_address_id.rb
ffaker-2.21.0 test/test_address_id.rb
ffaker-2.20.0 test/test_address_id.rb
ffaker-2.19.0 test/test_address_id.rb