jam-cloud/ruby/spec/jam_ruby/models/geo_ip_locations_spec.rb

39 lines
1.4 KiB
Ruby

require 'spec_helper'
describe GeoIpLocations do
before do
#GeoIpLocations.delete_all
#GeoIpLocations.createx(17192, 'US', 'TX', 'Austin', '78749', 30.2076, -97.8587, 635, '512')
#GeoIpLocations.createx(48086, 'MX', '28', 'Matamoros', '', 25.8833, -97.5000, nil, '')
end
it "count" do GeoIpLocations.count.should == 16 end
let(:first) { GeoIpLocations.lookup(17192) }
let(:second) { GeoIpLocations.lookup(1539) }
let(:third) { GeoIpLocations.lookup(999999) } # bogus
describe "first" do
it "first" do first.should_not be_nil end
it "first.locid" do first.locid.should == 17192 end
it "first.countrycode" do first.countrycode.should eql('US') end
it "first.region" do first.region.should eql('TX') end
it "first.city" do first.city.should eql('Austin') end
it "first.latitude" do first.latitude.should == 30.2076 end
it "first.longitude" do first.longitude.should == -97.8587 end
end
describe "second" do
it "second" do first.should_not be_nil end
it "second.locid" do second.locid.should == 1539 end
it "second.countrycode" do second.countrycode.should eql('US') end
it "second.region" do second.region.should eql('WA') end
it "second.city" do second.city.should eql('Seattle') end
it "second.latitude" do second.latitude.should == 47.6103 end
it "second.longitude" do second.longitude.should == -122.3341 end
end
it "third" do third.should be_nil end
end