ruby on rails - Best approach in testing geocoder gem with RSpec -


i know has been asked before since newer version came out , since last relevant post dated 2 years ago, wondering use , follow tdd t, what's approach in testing of it's functionality (geocode, near, within_bounding_box, distance, etc).

currently, there a method doing that.

my question is, how stub multiple results? because you'd need multiple data testing near, within_bounding_box, distance or other calculated functionality.

thanks time reading , feedback may come!

you pass more 1 address stub , call before tests:

# create list of addresses addresses = [   ["new york, ny", [{     'latitude'     => 40.7143528,     'longitude'    => -74.0059731,     'address'      => 'new york, ny, usa',     'state'        => 'new york',     'state_code'   => 'ny',     'country'      => 'united states',     'country_code' => 'us'   }]],   ["clarksville, tn", [{     'latitude' => 36.4722803,     'longitude' => -87.3612205,     'address' => 'clarksville, tn 37040, usa',     'state' => 'tennessee',     'state_code' => 'tn',     'country' => 'united states',     'country_code' => 'us'   }]], ]  # include in before(:all) method before tests geocoder.configure( :lookup => :test ) addresses.each { |address| geocoder::lookup::test.add_stub(address[0], address[1])} 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -