Sha256: bdb2ad954c77f677a042e840f76c7e573b643f206f4fd15b8ae5eb6ca33b2dae
Contents?: true
Size: 1.15 KB
Versions: 7
Compression:
Stored size: 1.15 KB
Contents
require File.join(File.dirname(__FILE__), 'spec_helper') shared_examples_for "spatial query" do it 'sends lat and lng, and distance when geo search is performed' do search do near [40.7, -73.5], :distance => 5 end connection.should have_last_search_with(:spatial => "{!radius=5}40.7,-73.5") end it 'sets lat, lng, and sort flag when sorted geo search is performed' do search do near [40.7, -73.5], :sort => true end connection.should have_last_search_with(:spatial => "{!sort=true}40.7,-73.5") end it 'sets radius and sort when both are specified' do search do near [40.7, -73.5], :distance => 5, :sort => true end connection.should have_last_search_with(:spatial => "{!radius=5 sort=true}40.7,-73.5") end [ [:lat, :lng], [:lat, :lon], [:lat, :long], [:latitude, :longitude] ].each do |lat_attr, lng_attr| it "sets coordinates using #{lat_attr.inspect}, #{lng_attr.inspect}" do search do near OpenStruct.new(lat_attr => 40.7, lng_attr => -73.5), :distance => 5 end connection.should have_last_search_with(:spatial => "{!radius=5}40.7,-73.5") end end end
Version data entries
7 entries across 7 versions & 3 rubygems