require 'spec_helper'

describe MaxMindManager do

  before(:each) do
    @maxmind_manager = MaxMindManager.new(:conn => @conn)
    MaxMindManager.create_phony_database
  end

  it "looks up countries successfully" do
    countries = MaxMindManager.countries
    countries.length.should == 1
    countries[0] == {countrycode: "US", countryname: "United States"}
  end

  it "looks up regions successfully" do
    regions = MaxMindManager.regions("US")
    regions.length.should == 11
  end

  it "looks up cities successfully" do
    cities = MaxMindManager.cities("US", "TX")
    cities.length.should == 4
    cities.first.should == "Austin"
    cities.last.should == "San Antonio"
  end


end
