Testing exception notification plugin with rspec

Hi,

I’m trying to install exception notification plugin and test it with
rspec.
The problem that I have is that when running the server in production
mode : at the end of the log i get this when I have a critical error

rendering section “request”
rendering section “session”
rendering section “environment”
rendering section “backtrace”
Sent mail to [email protected]

but the spec fails :

ActionMailer::Base.delivery_method = ‘test’
ActionMailer::Base.perform_deliveries = false
ActionMailer::Base.deliveries = []
@size_before = ActionMailer::Base.deliveries.count
lambda { get ‘dummy_method_raises_exception’ }.should raise_error
(RuntimeError)
ActionMailer::Base.deliveries.count.should eql(@size_before + 1) <====
here I got 0 and not 1

Does someone have an idea about this problem?

Thank you by advance
-Yoann

On Aug 10, 2009, at 11:05 AM, Yoann-Z wrote:

rendering section “environment”
(RuntimeError)
ActionMailer::Base.deliveries.count.should eql(@size_before + 1) <====
here I got 0 and not 1

Does someone have an idea about this problem?

Thank you by advance
-Yoann

A very similar topic came up recently on the cukes group
(http://groups.google.com/group/cukes/browse_thread/thread/79d45e6e8a4b5ce0
). Maybe the thread will be of some use to you in puzzling this out.

On Aug 11, 3:05 am, Yoann-Z [email protected] wrote:

rendering section “backtrace”
ActionMailer::Base.deliveries.count.should eql(@size_before + 1) <====
here I got 0 and not 1

Does someone have an idea about this problem?

Thank you by advance
-Yoann

Setting ‘ActionMailer::Base.perform_deliveries = false’ means that
nothing makes it to the ActionMailer::Base.deliveries, so you will get
0.

deliver calls deliver! which calls perform_delivery_#{delivery_method}
iff perform_deliveries is true.
as you can see here

thats the thing that polulates the ActionMailer::Base.deliveries.

Hope i’m on the right track and this helps.
Niko.