2012-12-15 20:17:41 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
describe MaxMindManager do
|
|
|
|
|
|
|
|
|
|
before(:each) do
|
|
|
|
|
@maxmind_manager = MaxMindManager.new(:conn => @conn)
|
2014-07-20 02:11:16 +00:00
|
|
|
MaxMindManager.create_phony_database
|
2013-05-16 17:45:10 +00:00
|
|
|
end
|
|
|
|
|
|
2013-07-09 03:05:05 +00:00
|
|
|
it "looks up countries successfully" do
|
2014-07-20 02:11:16 +00:00
|
|
|
countries = MaxMindManager.countries
|
2013-07-09 03:05:05 +00:00
|
|
|
countries.length.should == 1
|
2014-03-18 03:39:31 +00:00
|
|
|
countries[0] == {countrycode: "US", countryname: "United States"}
|
2013-07-09 03:05:05 +00:00
|
|
|
end
|
|
|
|
|
|
2013-05-16 17:45:10 +00:00
|
|
|
it "looks up regions successfully" do
|
2013-05-17 03:54:33 +00:00
|
|
|
regions = MaxMindManager.regions("US")
|
2014-07-20 02:11:16 +00:00
|
|
|
regions.length.should == 11
|
2012-12-15 20:17:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "looks up cities successfully" do
|
2014-07-20 02:11:16 +00:00
|
|
|
cities = MaxMindManager.cities("US", "TX")
|
|
|
|
|
cities.length.should == 4
|
|
|
|
|
cities.first.should == "Austin"
|
|
|
|
|
cities.last.should == "San Antonio"
|
2012-12-15 20:17:41 +00:00
|
|
|
end
|
2013-05-16 17:45:10 +00:00
|
|
|
|
|
|
|
|
|
2012-12-15 20:17:41 +00:00
|
|
|
end
|