Sha256: d29295305d6c667b02f9130a595ab8f72045c07a8262e7218d0cb4295a0ec578
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
Contents
require "spec_helper" describe Mongoid::Criterion::NearSpatial do let(:within) do { :flat => Mongoid::Criterion::WithinSpatial.new(:key => :field, :operator => "near"), :sphere => Mongoid::Criterion::WithinSpatial.new(:key => :field, :operator => "nearSphere"), } end NEAR = { :flat => { 'Point' => [[1,2],5], 'Hash Point' => {:point => [-73.98, 40.77], :max => 5}, 'Hash Point Unit' => {:point => [-73.98, 40.77], :max => 5, :unit => :km} }, :sphere => { 'Point' => [[1,2],5], 'Hash Point' => {:point => [-73.98, 40.77], :max => 5}, 'Hash Point Unit' => {:point => [-73.98, 40.77], :max => 5, :unit => :km} } } context "#to_mongo_query" do NEAR.each do |shape, points| points.each do |input_name,input| it "#{shape} should generate a query with #{input_name}" do within[shape].to_mongo_query(input).should be_a_kind_of(Hash) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems