roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Override `Rails.configuration.x.ror.active` During RSpec Tests

Open aaronskiba opened this issue 1 year ago • 1 comments

Changes proposed in this PR:

  • This PR overrides the value of Rails.configuration.x.ror.active to true for the duration of the spec/services/external_apis/ror_service_spec.rb tests.

  • Prior to this commit, when setting Rails.configuration.x.ror.active = false in config/initializers/external_apis/ror.rb, the following errors were encountered after executing bundle exec rspec spec/services/external_apis/ror_service_spec.rb:

Finished in 1.03 seconds (files took 1.2 seconds to load)
37 examples, 5 failures

Failed examples:

rspec ./spec/services/external_apis/ror_service_spec.rb:45 # ExternalApis::RorService#search ROR did not return a 200 status logs the response as an error
rspec ./spec/services/external_apis/ror_service_spec.rb:117 # ExternalApis::RorService#search Successful response from API includes the country in the name (if no website is available)
rspec ./spec/services/external_apis/ror_service_spec.rb:105 # ExternalApis::RorService#search Successful response from API returns both results
rspec ./spec/services/external_apis/ror_service_spec.rb:109 # ExternalApis::RorService#search Successful response from API includes the website in the name (if available)
rspec ./spec/services/external_apis/ror_service_spec.rb:16 # ExternalApis::RorService#ping returns false if an HTTP 200 is NOT returned

aaronskiba avatar May 09 '24 21:05 aaronskiba

The fork of this repo at portagenetwork/roadmap recently deactivated the ROR external API. They implemented the same fix after encountering the same aforementioned failing tests as a result of the config change.

aaronskiba avatar May 09 '24 21:05 aaronskiba