Sha256: a2a4374829d0db6d4a613ab0b7a56c09f13c9ee018da6086e3c3c6918572272a

Contents?: true

Size: 1.24 KB

Versions: 21

Compression:

Stored size: 1.24 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

## India
class INTest < Phonie::TestCase
  def test_local
    parse_test('+91.124.4529000', '91', '124', '4529000')
    parse_test('+91 124 4529000', '91', '124', '4529000')
    parse_test('+911244529000', '91', '124', '4529000')
    parse_test('911244529000', '91', '124', '4529000', "India", false)
  end

  def test_mobile
    parse_test('918124452900', '91', '8124', '452900', "India", true)
  end

  def test_long_with_default_country_code
    Phonie.configuration.default_country_code = '91'
    parse_test('9124459000', '91', '9124', '459000')
  end

  def test_short_with_default_country_code_and_area_code
    Phonie.configuration.default_country_code = '91'
    Phonie.configuration.default_area_code = '9124'
    parse_test('4529000', '91', '9124', '4529000')
  end

  def test_lengths
    Phonie.configuration.default_country_code = '91'

    phone = Phonie::Phone.parse("919812344")
    assert_nil phone

    phone = Phonie::Phone.parse("9818147874")
    assert phone

    phone = Phonie::Phone.parse("91111111111")
    assert_nil phone

    phone = Phonie::Phone.parse("98111111111")
    assert_nil phone

    phone = Phonie::Phone.parse("98111111119")
    assert_nil phone
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
phonie-3.3.1 test/countries/in_test.rb
phonie-3.2.2 test/countries/in_test.rb
phonie-3.2.1 test/countries/in_test.rb
phonie-3.2.0 test/countries/in_test.rb
phonie-3.1.15 test/countries/in_test.rb
phonie-3.1.14 test/countries/in_test.rb
phonie-3.1.13 test/countries/in_test.rb
phonie-3.1.12 test/countries/in_test.rb
phonie-3.1.11 test/countries/in_test.rb
phonie-3.1.10 test/countries/in_test.rb
phonie-3.1.9 test/countries/in_test.rb
phonie-3.1.8 test/countries/in_test.rb
phonie-3.1.7 test/countries/in_test.rb
phonie-3.1.6 test/countries/in_test.rb
phonie-3.1.5 test/countries/in_test.rb
phonie-3.1.4 test/countries/in_test.rb
phonie-3.1.3 test/countries/in_test.rb
phonie-3.1.2 test/countries/in_test.rb
phonie-3.1.1 test/countries/in_test.rb
phonie-3.1.0 test/countries/in_test.rb