Sha256: 29531504f47d601918a348ac8c4972af5dc373112a46bc5ac90915635b6c825a

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

# encoding: UTF-8

require 'test_helper'

class MetadataTest < Test::Unit::TestCase

  should "load US metadata" do
    metadata = AsDialedFrom::Metadata.for_region "US"
    assert_equal "1",   metadata[:country_code]
    assert_equal "011", metadata[:international_prefix]
    assert_equal "1",   metadata[:national_prefix]
  end

  should "load MX metadata" do
    metadata = AsDialedFrom::Metadata.for_region "MX"
    assert_equal "52",    metadata[:country_code]
    assert_equal "0[09]", metadata[:international_prefix]
    assert_equal "01",    metadata[:national_prefix]
  end

  should "under_score camelCased words" do
    assert_equal "one_two_three", AsDialedFrom::Metadata.underscore("oneTwoThree")
    assert_equal "one_two_three", AsDialedFrom::Metadata.underscore("OneTwoThree")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
as_dialed_from-0.2.4 test/as_dialed_from/metadata_test.rb
as_dialed_from-0.2.3 test/as_dialed_from/metadata_test.rb