[Backgroundrb-devel] getting started

hemant kumar gethemant at gmail.com
Wed Jan 16 21:34:55 EST 2008

Hi Tim,

On Wed, 2008-01-16 at 16:33 -0500, Tim Glen wrote:

> yes, I'm saying that having RAILS_ENV = 'test' at the top of my test  
> helper file seems to make no difference to the environment. Let me  
> clarify what I'm doing (and my assumptions) a little further. First,  
> my assumption is that I need to have the master_worker running  
> (through `script/backgroundrb start`) in order to run my tests. When  
> it's not, I get a backgroundrb connection error so that seems valid.  
> Also, I am testing using the MiddleMan object like so:
> MiddleMan.new_worker(:worker => :sales_processor_worker, :job_key => "sales_processor_#{@upload.id 
> }", :data => @upload.id)
>   MiddleMan.ask_status(:worker => :sales_processor_worker, :job_key =>  
> "sales_processor_#{@upload.id}").should_not be_nil
> there are slightly more complex things that I'm doing in the testing,  
> but that's the gist of it. Is there a better way? I can't run the  
> Worker directly from within the test since the Worker contains an  
> `exit` call. If you want to see actual spec, code, I can send it. I  
> _could_ stub out the MiddleMan functionality but wanted to see actual  
> functionality in my specs since it was also part of the discovery  
> process for me.

You don't need to have the master process running, when you are doing
testing. The idea is that helper should abstract away all the network IO
stuff. Can I see your spec helper code?

More information about the Backgroundrb-devel mailing list