Change the alert specs to use webmock #494
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When implementing the unpublishing alert feature, we merged code with
a bug which was passing all the tests. The bug was that we were
calling a method in gds-api-adapters with incorrect arguments.
This bug passed the tests because the tests do not actually use
gds-api-adapters, they mock those methods and check that the mocked
methods are called appropriately.
This is a problem for two reasons:
It let us write code which looked correct and even passed tests,
but which could only have been verified as correct by consulting a
different repository.
An update to gds-api-adapters could change the method signature and
our tests would continue to pass on the dependabot branch, even though
merging it would break the service.
The point of testing is to catch bugs. If a test actively obscures
bugs, it should be fixed. This commit fixes the issue by using
webmock to check the actual calls we make to email-alert-api, rather
than stubbing the methods in gds-api-adapters.
Trello card