Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid initializing geocoder in test environments #10398

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Conversation

aduth
Copy link
Member

@aduth aduth commented Apr 10, 2024

馃洜 Summary of changes

Updates geocoder initializer to avoid loading the geocoder file in test environments.

This is a partial reversal of #10319, while still allowing the geocoder to be initialized for local development.

This resolves an issue where tests may fail when trying to geocode an IP address.

馃摐 Testing Plan

  1. Follow the instructions to set up geolocation
    1. Alternatively, download live database from S3
  2. Run: rspec spec/controllers/users/piv_cac_login_controller_spec.rb
  3. Observe all tests pass

Previous failure example:

      Failure/Error: @geocoded_location ||= Geocoder.search(ip).first
      
      ActionView::Template::Error:
        unknown stub request 0.0.0.0
      # ./app/services/ip_geocoder.rb:42:in `geocoded_location'

changelog: Internal, Geocoder, Avoid initializing geocoder in test environments
@aduth aduth merged commit 466517f into main Apr 10, 2024
2 checks passed
@aduth aduth deleted the aduth-geocoder-specs branch April 10, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants