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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override Rails.configuration.x.ror.active During RSpec Tests #3415

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

aaronskiba
Copy link
Contributor

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

In order to be executed successfully, the RSpec tests within spec/services/external_apis/ror_service_spec.rb require that Rails.configuration.x.ror.active = true. Regardless of the value of this variable within config/initializers/external_apis/ror.rb, this commit overrides the value to true for the duration of the spec/services/external_apis/ror_service_spec.rb tests.
@aaronskiba
Copy link
Contributor Author

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.

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

1 participant