Sha256: 349991b8ba674a0a6b574512e69589cd09e1924a2735c312824dc6fc0ad1fa50

Contents?: true

Size: 832 Bytes

Versions: 4

Compression:

Stored size: 832 Bytes

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 country.name, "Canada"

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

    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 country.name, "Norway"
  end

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phonie-1.0.4 test/country_test.rb
phonie-1.0.3 test/country_test.rb
phonie-1.0.2 test/country_test.rb
phonie-1.0.1 test/country_test.rb