Mocking Workers in Backgroundrb

Hi

Has anyone mocked a call like the following for backgroundrb?

MiddleMan.new_worker(:class => :admin_email_worker, :args => params
[:email])

I cannot seem to find the correct manner to do it.

Would have liked to be able to do MiddleMan.should_receive
(:new_worker).with(:class => :admin_email_worker, :args => {“body” =>
“my message”})

Cheers
Shane

Shane M.
ELC Technologies ™
1921 State Street
Santa Barbara, CA 93101

Phone: +64 4 568 6684
Mobile: +64 21 435 586
Email: [email protected]
AIM: ShaneMingins
Skype: shane.mingins

(866) 863-7365 Tel - Santa Barbara Office
(866) 893-1902 Fax - Santa Barbara Office

+44 020 7504 1346 Tel - London Office
+44 020 7504 1347 Fax - London Office


Privacy and Confidentiality Notice:
The information contained in this electronic mail message is intended
for the named recipient(s) only. It may contain privileged and
confidential information. If you are not an intended recipient, you
must not copy, forward, distribute or take any action in reliance on
it. If you have received this electronic mail message in error,
please notify the sender immediately.

On 10/24/07, Shane M. [email protected] wrote:

MiddleMan.should_receive(:new_worker).with(:class => :admin_email_worker,
:args => {“body” => “my message”})

I conditionally load the backgroundrb plugin.
require ‘middleman_rails_init’ if ENV[“use_backgroundrb”]

in vendor/plugins/backgroundrb/init.rb

Then I stick a
class MiddleMan; end

in spec_helper.rb so the constant is defined.

Pat

MiddleMan = Object.new

at the top of my spec file worked better for me. I didn’t want to have
to mess with ENV variables.

On 30/10/2007, at 10:58 AM, Lance C. wrote:

MiddleMan = Object.new

at the top of my spec file worked better for me. I didn’t want to have
to mess with ENV variables.

Hi Guys

This solution seemed to work nicely … I was getting warnings about
redefining the constant and so added:

class Object; remove_const :MiddleMan; end

Cheers
Shane