Mocha stub and assert_raises

Hello all,

Im trying to test that my controller can handle a RuntimeError exception
which may be thrown by one of my model methods. Ive stubbed, with mocha,
the model method to raise such an error but my assert_raise keeps
complaining that nothing gets raised.

Ive checked my test.log and I know that the assert is being raised (the
one defined in my stub) and its being rescued because i added a message
to the exception being raised by my stub in the test, and its visible in
the log. I also know that its being rescued because i placed a logger
call inside the resuce block and its also showing in the test.log So why
is the test failing??

my code is here

test “destroy should catch exception raised by spreedly during
cancellation” do
login_larry_active
Subscription.any_instance.stubs(:stop_auto_renew).raises(RuntimeError,
“if this isnt being thrown then this shouldnt show up in my test log”)
assert_raises do
delete :destroy, {:user_id => @logged_in_user.id}
end
assert flash[:notice]
assert_redirected_to :controller => :dashboard, :action => :welcome
end

Controller

#note that ldb() is just a method which writes to test.log
def destroy
user = User.find(params[:user_id])
if user
begin
user.subscription.stop_auto_renew
rescue RuntimeError => e
ldb(“cant process stop_auto_renew for user id: #{user.id}”)
ldb(“exception : #{e}”)
end
flash[:notice] = “You have successfully cancelled your
subscription and will take effect at the end of your current billing
month”
end
redirect_to :controller => :dashboard, :action => :welcome
end

Test.log

Starting
test_destroy_should_catch_exception_raised_by_spreedly_during_cancellation

e[4;35;1mUser Load (0.1ms)e[0m e[0mSELECT * FROM users WHERE
(users.id = 2) e[0m
e[4;36;1mSubscription Load (0.0ms)e[0m e[0;1mSELECT * FROM
subscriptions WHERE (subscriptions.user_id = 2) LIMIT 1e[0m

Processing SubscriptionsController#destroy (for 0.0.0.0 at 2009-12-10
20:18:46) [DELETE]
Parameters: {“user_id”=>“2”}
e[4;35;1mUser Load (0.1ms)e[0m e[0mSELECT * FROM users WHERE
(users.id = 2) e[0m
e[4;36;1mSubscription Load (0.0ms)e[0m e[0;1mSELECT * FROM
subscriptions WHERE (subscriptions.user_id = 2) LIMIT 1e[0m

/home/adam/railsprojects/spreedly/app/controllers/subscriptions_controller.rb:26:in
`destroy’: Spreedly cant process stop_auto_renew for user id: 2

/home/adam/railsprojects/spreedly/app/controllers/subscriptions_controller.rb:27:in
`destroy’: exception : if this isnt being thrown then this shouldnt show
up in my test log
Redirected to http://test.host/dashboard/welcome
Completed in 2ms (DB: 0) | 302 Found
[http://test.host/users/2/subscription]
e[4;35;1mSQL (0.1ms)e[0m e[0mROLLBACKe[0m
e[4;36;1mSQL (0.0ms)e[0m e[0;1mBEGINe[0m