Skip to content

Instantly share code, notes, and snippets.

@steveburkett
Created June 20, 2013 23:03
Show Gist options
  • Save steveburkett/5827551 to your computer and use it in GitHub Desktop.
Save steveburkett/5827551 to your computer and use it in GitHub Desktop.
<<<<<<< HEAD
it "should update location google+ listings" do
location = Location.new
biz_listing = BusinessListing.new
location.stub(:google_places_listing).and_return(biz_listing)
biz_listing.should_receive(:save)
place_details = stub(:result => stub({:rating => 3, :url => "foo.com"}))
Search::LocationFactory.update_location_google_places_listing(location, place_details)
biz_listing.url.should == "foo.com"
end
it "should update location details" do
place_details = stub
search_params = stub
Search::LocationFactory.should_receive(:perform_places_details_request).and_return(place_details)
Search::LocationFactory.should_receive(:update_location).with(location, place_details)
Search::LocationFactory.should_receive(:update_location_address).with(location, place_details, search_params )
Search::LocationFactory.should_receive(:update_location_google_places_listing).with(location, place_details)
Search::LocationFactory.update_location_details(location, {"reference" => stub}, search_params)
end
it "should perform places details request" do
reference = stub
search_result = { "reference" => reference}
client = double
response = { foo: "bar"}
Middleware::GooglePlaces::Api.should_receive(:new).and_return(client)
client.should_receive(:place_details).with(reference).and_return(response)
response = Search::LocationFactory.perform_places_details_request(search_result)
response.foo.should == "bar"
end
||||||| merged common ancestors
it "should update location google+ listings" do
location = Location.new
biz_listing = BusinessListing.new
location.business_listings.stub(:find_by_reputation_site_id).and_return(biz_listing)
biz_listing.should_receive(:save)
place_details = stub(:result => stub({:rating => 3, :url => "foo.com"}))
Search::LocationFactory.update_location_google_places_listing(location, place_details)
biz_listing.url.should == "foo.com"
end
it "should update location details" do
place_details = stub
search_params = stub
Search::LocationFactory.should_receive(:perform_places_details_request).and_return(place_details)
Search::LocationFactory.should_receive(:update_location).with(location, place_details)
Search::LocationFactory.should_receive(:update_location_address).with(location, place_details, search_params )
Search::LocationFactory.should_receive(:update_location_google_places_listing).with(location, place_details)
Search::LocationFactory.update_location_details(location, {"reference" => stub}, search_params)
end
it "should perform places details request" do
reference = stub
search_result = { "reference" => reference}
client = double
response = { foo: "bar"}
Middleware::GooglePlaces::Api.should_receive(:new).and_return(client)
client.should_receive(:place_details).with(reference).and_return(response)
response = Search::LocationFactory.perform_places_details_request(search_result)
response.foo.should == "bar"
end
=======
>>>>>>> master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment