I just had to write a simple mock of BackgrounDRb for a project I am working for and I thought it would be nice to share it with the community.
This mock does pretend to run tasks in the background but simply invokes the Worker's do_work method, mimicing the interface of the actual backgroundrb instance, and exposing the same access to the logger (piggied back to the Rails logger) and to results (as a Hash, so the to_hash method is still present). The point is to be able to run tests without having to explicitely configure and run a test instance.
To use, simply add the following line somewhere in your RAILS_ROOT/test_helper.rb:
# inject the mock backgroundrb to the test environment.
require File.dirname(FILE) + '/mocks/test/backgroundrb_mock.rb'
Feel free to improve on my contribution and eventually include it in a future release of BackgrounDRb
Sincerely,
Julien Pervillé