1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
# 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
|