[rspec-users] Mocking Workers in Backgroundrb

Pat Maddox pergesu at gmail.com
Wed Oct 24 21:11:47 EDT 2007

On 10/24/07, Shane Mingins <smingins at elctech.com> wrote:
> 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"})

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.


More information about the rspec-users mailing list