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

Test. Override email rake #9005

Closed
wants to merge 3 commits into from
Closed

Test. Override email rake #9005

wants to merge 3 commits into from

Conversation

beccapearce
Copy link
Contributor

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

using service for rake task
You were stubbing the the taxon content item on line 10 with
stub_publishing_api_has_item(content_id: work_taxon_content_id, title: work_taxon_parent["title"])

But then on line 22, you were passinging in the root_taxon_content_id. So when the task fetched
the taxon with the root taxon content id, it wasn't stubbed, so there would have been that webmock error.
The cryptic JSON::ParserError: unexpected token at '' error is raised by the to_h method, when it tries to parse
a JSON response from publishing API.

Fix 2

The document_collection is cached. So if you've updated it during the test (which you have) you need to
fetch it again.
you didn't need all these stubs, the only time the task is fetching anything from publishing api
is @taxon_content_item = Services.publishing_api.get_content(@taxon_content_id).to_h so that's
all you need to stub.
@beccapearce beccapearce deleted the why-are-my-tests-failing branch May 14, 2024 09:24
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