Created
October 30, 2015 13:19
-
-
Save scherztc/3618d45859e9b6fc1da7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
def render_error | |
@email_notifier = ExceptionNotifier.registered_exception_notifier(:email) | |
begin | |
raise ActiveRecord::RecordNotFound | |
rescue => e | |
@exception = e | |
end | |
end | |
describe ExceptionNotifier do | |
it "should send notification if an exception is raised" do | |
render_error | |
ExceptionNotifier.should receive(:notify).with(["scholar_error@uc.edu"],["ERROR"],30) | |
end | |
it "should Activate Action Mailer if an exception is raised" do | |
ActionMailer::Base.delivery_method = 'test' | |
ActionMailer::Base.perform_deliveries = true | |
ActionMailer::Base.deliveries = [] | |
@size_before = ActionMailer::Base.deliveries.count | |
lambda { render_error }.should raise_error(ActiveRecord::RecordNotFound) | |
ActionMailer::Base.deliveries.count.should eql(@size_before + 1) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment