-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally initalise Worker state
This commit updates the `Worker` `GenServer` so that the `handle_continue/2` callback is only invoked when the service is set to `DefaultService`. This module already knows about `DefaultService` so this seems slightly better than pattern matching on `MockService`, however if there are alternative "production" services, other than `DefaultService` the `Worker.init/1` would need to change. Because we are unable to call `handle_continue/2` directly from the `worker_test.ex` we need to add `initialise_foo/0` which finds the pid and sends the `:initialise_foo` message. This same message is also used in the `handle_continue/2` callback. The tests can be run using: ``` mix test --only mocked_service ```
- Loading branch information
Showing
2 changed files
with
31 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters