[rspec-users] Mocking Workers in Backgroundrb

Lance Carlson lancecarlson at gmail.com
Mon Oct 29 17:58:44 EDT 2007


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 10/24/07, Pat Maddox <pergesu at gmail.com> wrote:
> 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.
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list