diff --git a/app/views/error_log/error_log.text.erb b/app/views/error_log_mailer/error_message.text.erb similarity index 100% rename from app/views/error_log/error_log.text.erb rename to app/views/error_log_mailer/error_message.text.erb diff --git a/test/mailers/error_log_mailer_test.rb b/test/mailers/error_log_mailer_test.rb new file mode 100644 index 000000000..4ee92cbdd --- /dev/null +++ b/test/mailers/error_log_mailer_test.rb @@ -0,0 +1,19 @@ +require 'test_helper' +require 'grade_helper' + +class ErrorLogMailerTest < ActionMailer::TestCase + + def test_can_send_error_log_mail + Doubtfire::Application.config.email_errors_to = 'test ' + begin + raise 'test' + rescue StandardError => e + mail = ErrorLogMailer.error_message('test', 'test message', e) + end + + assert mail.present? + assert mail.to.include? 'test@test.com' + assert mail.body.include? e.message + assert mail.body.include? e.backtrace.join("\n") + end +end