Hi,
I was wondering if somebody knows how I can make a transaction fail, so
I can test my rescue code. So a very basic transaction:
begin
Listing.transaction(@ad) do
if @ad.save
flash[:notice] = 'Ad was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
rescue => error
flash[:warning] = 'An error has occurred'
redirect_to :action => 'new'
end
But I want to test that I get redirected to ‘new’ and have a flash
message. All suggestions are welcome.
Kind regards,
Nick