Sha256: 50e9fde5049c4b8704e050dca5f1808c317100204d3d3c2a578635336faf3d1b

Contents?: true

Size: 510 Bytes

Versions: 5

Compression:

Stored size: 510 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'test_helper'

class GeoipTest < ActionController::TestCase
  
  test "ip_to_integer" do
    assert_equal(3232235778, IpToCountry::Geoip.ip_to_integer("192.168.1.2"))
    assert_equal(0, IpToCountry::Geoip.ip_to_integer(""))
    assert_equal(0, IpToCountry::Geoip.ip_to_integer("wrong.address"))
    assert_equal(0, IpToCountry::Geoip.ip_to_integer(nil))
  end

  test "by_ip" do
    assert_equal 'wonderland', IpToCountry::Geoip.by_ip("192.168.1.2").country_name
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ip_to_country-0.2.0 test/geoip_test.rb
ip_to_country-0.1.0 test/geoip_test.rb
ip_to_country-0.0.3 test/geoip_test.rb
ip_to_country-0.0.2 test/geoip_test.rb
ip_to_country-0.0.1 test/geoip_test.rb