Created
January 11, 2016 23:13
-
-
Save bronson/7cab10381759b1dbbb74 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
it "it redirects to default search and geocodes if user isn't in us" do | |
# make it look like request is coming from europe (don't bother overriding the default lat/lon, which is in the us) | |
property = create :property, continent: 'Europe', country: 'GF', country_name: 'Grand Fenwick', marketing_latitude: 40, marketing_longitude: -120 | |
property = create :property, continent: 'Europe', country: 'LF', country_name: 'Little Fenwick', marketing_latitude: 60, marketing_longitude: -40 | |
# this IP is in Brazil. TODO: add in_americas? to static geocoding!! | |
expect(request).to receive(:remote_ip).and_return("189.81.139.183") | |
get :index | |
# we call the geocoding service and look up the country from the nearest property | |
expect(response).to redirect_to search_url(tid: 'Americas', st: 'm') | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment