Can I unit test backgroundrb workers?


#1

Can I unit test a background worker model, and if so … how?

For now I can only test the worker if I go through the MiddleMan - but
is it possible to not use the MiddleMan to test my workers?

Thanks
Joerg


#2

On Apr 10, 2:19 pm, Joerg D. removed_email_address@domain.invalid
wrote:

Can I unit test a background worker model, and if so … how?

For now I can only test the worker if I go through the MiddleMan - but
is it possible to not use the MiddleMan to test my workers?

I typically move all my interesting worker code to a separate helper
class, leaving the worker as a simple stub that calls that helper.
You can then unit test the helper, without having any dependencies on
BDRb


#3

I’m currently doing exactly that … but I’d feel more comfortable if
the code in the stub gets tested/run as well.

On the same note … how do I functional test this (with a polling
action to see whether the task has completed?)

Thanks so far!

Joerg

I typically move all my interesting worker code to a separate helper
class, leaving the worker as a simple stub that calls that helper.
You can then unit test the helper, without having any dependencies on
BDRb