Created
May 17, 2014 16:43
-
-
Save thoraxe/f9745c43cf19d0978a8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "when searching in a specific state", :barn_instate => true do | |
def set_up_geocode(lat, lng) | |
fake_geocode = OpenStruct.new(:lat => lat, :lng => lng, | |
:success => true) | |
GeoKit::Geocoders::MultiGeocoder.stub(:geocode).and_return(fake_geocode) | |
end | |
before do | |
# we're going to mock/stub the geocoding here since we are only doing | |
# searching against the mysql db anyway. this way we'll only end up | |
# geocoding once for looking up the search address | |
set_up_geocode(30.8364, -83.2809) | |
@instate_1 = Barn.create!(name: "Instate 1", | |
addr1: "527 N Patterson St", | |
city: "Valdosta", | |
state: "GA", | |
zip: "31601", | |
premium: true) | |
set_up_geocode(30.8235, -83.3176) | |
@instate_2 = Barn.create!(name: "Instate 2", | |
addr1: "2 Meeting Pl", | |
city: "Valdosta", | |
state: "GA", | |
zip: "31601", | |
premium: false) | |
set_up_geocode(40.6339818, -111.8067673) | |
@outstate_3 = Barn.create!(name: "Outstate 3", | |
addr1: "6360 South 3000 East", | |
city: "Cottonwood Heights", | |
state: "UT", | |
zip: "84121", | |
premium: true) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment