[rspec-users] Okay, I'm finally asking for help

Corey Haines coreyhaines at gmail.com
Mon Jan 14 21:31:41 EST 2008


Hi, all!

I would love if someone could help me figure this out. I can't seem to see
why the following fails:

Here's the spec:
  it "should redirect back to the index page" do
    Coupon.should_receive
(:new).with({"name"=>@expectedName,"amount"=>@expectedAmount}).and_return(@coupon)
    @coupon.should_receive(:save)
    response.should redirect_to(:action => 'index')
    post
'save_coupon',{:coupon=>{:name=>@expectedName,:amount=>@expectedAmount}}
  end

(the @vars are all set up)

Here's the method:
  def save_coupon
    @coupon = Coupon.new(params[:coupon])
    @coupon.save
    redirect_to :action => :index
  end

Now, I've tried it through the browser, and it works. Any thoughts?

I appreciate it.
-Corey

-- 
http://www.coreyhaines.com
The Internet's Premiere source of information about Corey Haines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080114/853a4691/attachment-0001.html 


More information about the rspec-users mailing list