-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stubbed results do not maintain consistency between coordinates and lat, long #1258
Comments
Looks like this is related to #1197 |
Thanks @derekprior and @jheiss. The intention of the Test lookup/result is to be very generic, and to do very little (since all APIs return different data, it's meant to be very flexible). That being said, ALL results return lat/lon based on the I'm marking this as a bug, because it conflicts with what the README says. However, it potentially breaks tests, so it warrants a minor release. |
Another temporary workaround 👍 Geocoder::Lookup::Test.add_stub(
"New York, NY", [
{
'coordinates' => [40.7143528, -74.0059731],
'address' => 'New York, NY, USA',
'state' => 'New York',
'state_code' => 'NY',
'country' => 'United States',
'country_code' => 'US',
'latitude' => 40.7143528,
'longitude' => -74.0059731
}
]
) |
Having the same issue here. Coordinates remain |
Fixed in |
viz: add `coordinates` attribute and remove `latitude` and `longitude`. Fixes alexreisner#1258 and alexreisner#1302.
GHSA-864j-6qpp-cmrr Also, version 1.5.0 broke some of our tests, so I updated those as well: > Test lookup fixtures should now return coordinates > and NOT latitude/longitude attributes (see > #1258). This may break some people's tests. https://github.com/alexreisner/geocoder/blob/master/CHANGELOG.md#150-201 alexreisner/geocoder#1258 Refs: #2834
GHSA-864j-6qpp-cmrr Also, version 1.5.0 broke some of our tests, so I updated those as well: > Test lookup fixtures should now return coordinates > and NOT latitude/longitude attributes (see > #1258). This may break some people's tests. https://github.com/alexreisner/geocoder/blob/master/CHANGELOG.md#150-201 alexreisner/geocoder#1258 Refs: #2834
GHSA-864j-6qpp-cmrr Also, version 1.5.0 broke some of our tests, so I updated those as well: > Test lookup fixtures should now return coordinates > and NOT latitude/longitude attributes (see > #1258). This may break some people's tests. https://github.com/alexreisner/geocoder/blob/master/CHANGELOG.md#150-201 alexreisner/geocoder#1258 Refs: #2834
These test stubs need to return `coordinates` and not `latitude` and `longitude`. alexreisner/geocoder#1197 (comment) alexreisner/geocoder#1258 Refs: #3571
These test stubs need to return `coordinates` and not `latitude` and `longitude`. alexreisner/geocoder#1197 (comment) alexreisner/geocoder#1258 Refs: #3571
These test stubs need to return `coordinates` and not `latitude` and `longitude`. alexreisner/geocoder#1197 (comment) alexreisner/geocoder#1258 Refs: #3571
The README contains the following code for stubbing Geocoder results:
Expected behavior
When using the stub above for a test that attempts to Geocode an ActiveRecord model via the
geocode
method should succeed and setlatitude
andlongitude
on the record appropriately.Actual behavior
Latitude and longitude remain
nil
despite coordinates being defined in the stub.The
geocode
method relies on callinglatitude
andlongitude
on the result.Geocorder::Result::Base
defineslatitude
andlongitude
in terms ofcoordinates
, but the test result is essentially a hash with no logic to synchronize lat and long with coordinates.It seems I have to set
coordinates
,latitude
andlongitude
in stubs to cover all bases. In my own test helpers for stubbing geocoder responses, I've added the following to compensate for this.Environment info
The text was updated successfully, but these errors were encountered: