From b8bc30d4ab9f04af0cde4681770814746e5bcfe1 Mon Sep 17 00:00:00 2001 From: alexs Date: Thu, 15 Aug 2013 17:34:51 +1000 Subject: [PATCH] Fixed the test setup and added the text for the bug found in 'Enterprise.find_near'. --- spec/models/enterprises_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/models/enterprises_spec.rb b/spec/models/enterprises_spec.rb index dc25639a19..35aa2db0df 100644 --- a/spec/models/enterprises_spec.rb +++ b/spec/models/enterprises_spec.rb @@ -241,12 +241,19 @@ describe Enterprise do address_vic2 = FactoryGirl.create(:address, state_id: state_id_vic, city: "Richmond", zipcode: "3121") address_vic2.update_column(:latitude, -37.826869) address_vic2.update_column(:longitude, 145.007098) + + FactoryGirl.create(:distributor_enterprise, address: address_vic1) + FactoryGirl.create(:distributor_enterprise, address: address_vic2) end it "should find nearby hubs if there are any" do Enterprise.find_near(@suburb_in_vic).count.should eql(2) end + it "should not have nils in the result" do + Enterprise.find_near(@suburb_in_vic).should_not include(nil) + end + it "should not find hubs if not nearby " do Enterprise.find_near(@suburb_in_nsw).count.should eql(0) end