File: test_address_in.rb

package info (click to toggle)
ruby-ffaker 2.23.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,776 kB
  • sloc: ruby: 12,788; makefile: 8; sh: 1
file content (58 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download | duplicates (2)
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
58
# frozen_string_literal: true

require_relative 'helper'

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

  assert_methods_are_deterministic(
    FFaker::AddressIN,
    :country_code, :country, :pincode, :state_abbr,
    :state_and_union_territory_abbr, :state_and_union_territory, :state,
    :time_zone, :union_territory_abbr, :union_territory
  )

  def test_in_state
    assert_match(/\A[A-Z][ A-Za-z]*\z/, FFaker::AddressIN.state)
  end

  def test_in_state_abbr
    assert_match(/\A[A-Z]{2}\z/, FFaker::AddressIN.state_abbr)
  end

  def test_in_union_territory
    assert_match(/\A[A-Z][ A-Za-z]*\z/, FFaker::AddressIN.union_territory)
  end

  def test_in_union_territory_abbr
    assert_match(/\A[A-Z]{2}\z/, FFaker::AddressIN.union_territory_abbr)
  end

  def test_in_state_and_union_territory
    assert_match(/\A[A-Z][ A-Za-z]*\z/, FFaker::AddressIN.state_and_union_territory)
  end

  def test_in_state_and_union_territory_abbr
    assert_match(/\A[A-Z]{2}\z/, FFaker::AddressIN.state_and_union_territory_abbr)
  end

  def test_pincode
    assert_match(/[0-9]{6}/, FFaker::AddressIN.pincode)
  end

  def test_zip_code
    assert_match(/[0-9]{6}/, FFaker::AddressIN.pincode)
  end

  def test_in_country
    assert_equal 'India', FFaker::AddressIN.country
  end

  def test_in_country_code
    assert_equal 'IN', FFaker::AddressIN.country_code
  end

  def test_in_time_zone
    assert_equal 'Asia/Kolkata', FFaker::AddressIN.time_zone
  end
end