Sha256: 69e442d2acccab9b6c0d0e807c41780f93897f215d21fa9c8aeee1202a7d94fc

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

require '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

9 entries across 9 versions & 1 rubygems

Version Path
ffaker-2.11.0 test/test_address_id.rb
ffaker-2.10.0 test/test_address_id.rb
ffaker-2.9.0 test/test_address_id.rb
ffaker-2.8.1 test/test_address_id.rb
ffaker-2.8.0 test/test_address_id.rb
ffaker-2.7.0 test/test_address_id.rb
ffaker-2.6.0 test/test_address_id.rb
ffaker-2.5.0 test/test_address_id.rb
ffaker-2.4.0 test/test_address_id.rb