Displaying 2 results from an estimated 2 matches for "expectedamount".
Did you mean:
expected_count
2008 Jan 15
4
Okay, I''m finally asking for help
...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...
2008 Jan 23
18
Not seeing the failure
...writing a spec to say that my
CouponController should create a new coupon from the form parameters, then
set the current user. Here''s the spec:
describe CouponController, "When posting to save_coupon" do
before(:each) do
@expectedName = "pepper''s"
@expectedAmount = 5
coupon = mock_model Coupon
current_user = mock_model User
controller.stub!(:current_user).and_return(current_user)
Coupon.should_receive
(:new).with({"name"=>@expectedName,"amount"=>@expectedAmount}).and_return(coupon)
coupon.should_receive(:user)....