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 Mingins ELC Technologies (TM) 1921 State Street Santa Barbara, CA 93101 Phone: +64 4 568 6684 Mobile: +64 21 435 586 Email: smingins at elctech.com 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 http://www.elctech.com -------------------------------------------------------------------- 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071025/1577009a/attachment-0001.html
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
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 >
On 30/10/2007, at 10:58 AM, Lance Carlson 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