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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 10, 2:19 pm, Joerg Diekmann <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---