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

51 lines
1.3 KiB
Ruby

require 'spec_helper'
describe Band do
before(:all) do
MaxMindIsp.delete_all
MaxMindGeo.delete_all
end
before do
@geocode1 = FactoryGirl.create(:geocoder)
@geocode2 = FactoryGirl.create(:geocoder)
@band = FactoryGirl.create(:band)
end
describe "with profile location data" do
it "should have lat/lng values" do
pending 'distance search changes'
geo = MaxMindGeo.find_by_city(@band.city)
@band.lat.should == geo.lat
@band.lng.should == geo.lng
end
it "should have updated lat/lng values" do
pending 'distance search changes'
@band.update_attributes({ :city => @geocode2.city,
:state => @geocode2.region,
:country => @geocode2.country,
})
geo = MaxMindGeo.find_by_city(@band.city)
@band.lat.should == geo.lat
@band.lng.should == geo.lng
end
end
describe "without location data" do
pending 'distance search changes'
it "should have nil lat/lng values without address" do
@band.skip_location_validation = true
@band.update_attributes({ :city => nil,
:state => nil,
:country => nil,
})
@band.lat.should == nil
@band.lng.should == nil
end
end
end