views:

71

answers:

1

We use DelayedJob to run some of our long running processes and would like to test with Cucumber/Webrat.

Currently, we are calling Delayed::Job.work_off in a Ruby thread to get work done in the background, but are looking for a more robust solution

What is the best approach for this?

Thanks.

A: 

The main problem I see with the Delayed:Job.work_off approach is that you are making explicit in your Cucumber scenarios something that belongs to the internals of your system. Mixing both concerns is against the spirit of functional testing:

When I click some link # Some operation is launched in the background
And Jobs are dispatched # Delayed:Job.work_off invoked here
Then I should see the results...

Another problem is that you populate your Cucumber scenarios with repetitive steps for dispatching jobs when needed.

The approach I am currently using is launching delayed_job in the background while cucumber scenarios are being executed. You can check the Cucumber hooks I am using in that link.

jmanrubia