I'm writing an app that responds to a webhook event that then kicks off a few background jobs using Sidekiq. I'm using Minitest for my testing library.
Right now I have one large integration test (/test/integration/test-name.rb
). I know integration tests are typically reserved for testing end-to-end functionality of controllers. But the way my app works is: I have a create
method inside of my controller which is the entrypoint for incoming webhook events. These webhook events are then handled by a Sidekiq job, and the Sidekiq job determines whether the event should be saved to the database.
As a result it feels like an integration test is the right place for testing this end-to-end flow: a third-party services kicks-off a webhook event, user visits application, Sidekiq handles webhook event, and the user sees the job data render in HTML.
But my question is: is this the right place for testing key application functionality, i.e. my Sidekiq worker classes? Should I be writing their tests elsewhere?
Within my integration test I'm also calling to external HTTPS service, for which I'm encapsulating with the VCR gem.