Testing Class

This class is used to automatically create the fixtures required to test LocationState states.

add_location(opts)

Adds location data to the fixtures

Arguments:
  • opts.request_url (string) – URL for the HTTP request. Defaults to "http://maps.googleapis.com/maps/api/geocode/json"
  • opts.request (string) – The address that is to be queried. Defaults to "Friend Street, South Africa".
  • opts.address_list (array_of_strings) – An array of the list of formatted_address‘s that should be sent in the response. If response_data is included, this will be ignored. Defaults to ["Friend Street, Cape Town 7925, South Africa"]
  • opts.response_data (array_of_objects) – An array of objects that represents the response from the gmaps API

Usage: Create an instance of

locations = LocationState.testing()

and then add the fixtures in

locations.fixtures

to the fixtures list beforeEach test. Then add locations during testing:

locations.add_location({
    request:"New Street",
    address_list:["New Street 1", "New Street 2"]
});
add_locations(opts)

Adds an array location data to the fixtures.

Arguments:
  • opts_array (array_of_objects) – An array of opts

Related: add_location()