Sha256: e5532618784cb63da37e72742eb83a203490ff089fbdacb3c0cf3e97207c9f07

Contents?: true

Size: 1.06 KB

Versions: 24

Compression:

Stored size: 1.06 KB

Contents

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

class CountryTest < Phonie::TestCase
  def test_find_by_country_name
    country = Phonie::Country.find_by_name('canada')
    assert_equal "Canada", country.name

    country = Phonie::Country.find_by_name('Canada')
    assert_equal "Canada", country.name

    assert_nil  Phonie::Country.find_by_name(nil)
    assert_nil  Phonie::Country.find_by_country_code(nil)
    assert_equal [],  Phonie::Country.find_all_by_phone_code(nil)
  end

  def test_find_by_country_code
    country = Phonie::Country.find_by_country_code('NO')
    assert_equal "Norway", country.name
  end

  def test_find_all_by_phone_code
    countries = Phonie::Country.find_all_by_phone_code('47')
    assert_equal 1, countries.length
    assert_equal "Norway", countries.first.name
  end

  def test_national_dialing_prefix
    tonga = Phonie::Country.find_by_country_code('TO')
    assert_nil tonga.national_dialing_prefix

    us_and_a = Phonie::Country.find_by_country_code('US')
    assert_equal '1', us_and_a.national_dialing_prefix
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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