Hi,
I have installed an exception notifier plugin for Rails (http://
github.com/rails/exception_notification/tree/master) and I would like
to test it with cucumber.
So I made a feature file like this :
Background:
Given Emails aren't really sent for now
And I know the size of deliveries array
Scenario: Send an error
Given I go to the dummy_method_that_raises_exception
Then An e-mail should have been sent
And a step file :
Given /^Emails aren't really sent for now$/ do
ActionMailer::Base.delivery_method = :test
end
Given /^I know the size of deliveries array$/ do
@size_before = ActionMailer::Base.deliveries.count
end
Then /^An e\-mail should have been sent$/ do
ActionMailer::Base.deliveries.count.should eql( @size_before + 1 )
end
Also, in path.rb, I added these lines :
when /the dummy_method_that_raises_exception/
"/mycontroller/dummy_method_that_raises_exception"
Finally, in mycontroller I made the dummy_method_that_raises_exception
method like this:
def dummy_method_that_raises_exception
raise "Critical error"
end
My problem is that when I run the tests with cucumber, I obviously get
this error :
Given I go to the dummy_method_that_raises_exception # features/
step_definitions/webrat_steps.rb:10
Critical error (RuntimeError)
So I would like to raise this error in order to actually test my
notifier, but I would also like to say to cucumber that this error is
expected. I want to raise the error for the application, not for
cucumber.
Could you help me ?
Thank you
-Olivier