Sha256: 530f16c3f656136dda1d0a0c960468034888a9ce3d9388bca63e4cd4cb365d52
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' require "#{Earth::FACTORY_DIR}/zip_code" describe ZipCode do # from geocoder describe '.near(point, radius)' do it 'returns all zips within radius of the point' do zip1 = FactoryGirl.create :zip_code, :zip1 zip2 = FactoryGirl.create :zip_code, :zip2 zip3 = FactoryGirl.create :zip_code, :zip3 ZipCode.near(zip1, 15).should == [zip1, zip2] end end describe '.known_subregion' do it 'returns all zips with an egrid subregion abbreviation' do zip1 = FactoryGirl.create :zip_code, :zip1 zip2 = FactoryGirl.create :zip_code, :zip2 ZipCode.known_subregion.count.should > 0 ZipCode.known_subregion.where(:egrid_subregion_abbreviation => nil).count.should == 0 end end describe '#country' do it 'returns the US' do us = Country.find_or_create_by_iso_3166_code 'US' ZipCode.new.country.should == us end end describe 'Sanity check', :sanity => true do it { ZipCode.count.should == 43770 } it { ZipCode.where(:state_postal_abbreviation => nil).count.should == 0 } it { ZipCode.where('latitude IS NOT NULL AND longitude IS NOT NULL').count.should == 43191 } it { ZipCode.where('egrid_subregion_abbreviation IS NOT NULL').count.should == 41333 } it { ZipCode.where('climate_division_name IS NOT NULL').count.should == 41358 } it { ZipCode.where('population IS NOT NULL').count.should == 33120 } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
earth-1.1.2 | spec/earth/locality/zip_code_spec.rb |
earth-1.1.1 | spec/earth/locality/zip_code_spec.rb |