Sha256: 8a6cd24be976d9e2842b2362649d1dbd2cfde6ca315cfaea48520c00c610be66

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require_relative 'helper'

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

  assert_methods_are_deterministic(
    FFaker::AddressUA,
    :city, :country, :province, :zip_code, :street_name, :street_address,
    :building_number, :appartment_number
  )

  def setup
    @tester = FFaker::AddressUA
    @multiple_words_name_regexp = /\A[а-яА-ЯіїєґІЇЄҐ’\-\s]+\z/
  end

  def test_city
    assert_match(@multiple_words_name_regexp, @tester.city)
  end

  def test_country
    assert_match(@multiple_words_name_regexp, @tester.country)
  end

  def test_province
    assert_match(@multiple_words_name_regexp, @tester.province)
  end

  def test_zip_code
    assert_match(/\A\d{5}\z/, @tester.zip_code)
  end

  def test_street_name
    assert_match(/\Aвул\.\s[а-яА-ЯіїєґІЇЄҐ’\-\s]+\z/, @tester.street_name)
  end

  def test_street_address
    assert_match(/\Aвул\.\s[а-яА-ЯіїєґІЇЄҐ’\-\s]+,\s\d{1,3}\z/, @tester.street_address)
  end

  def test_street_address_with_secondary
    assert_match( \
      /\Aвул\.\s[а-яА-ЯіїєґІЇЄҐ’\-\s]+,\s\d{1,3},\sкв\.\s\d{1,3}\z/,
      @tester.street_address(true)
    )
  end

  def test_building_number
    assert_match(/\A\d{1,3}\z/, @tester.building_number)
  end

  def test_appartment_number
    assert_match(/\A\d{1,3}\z/, @tester.appartment_number)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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