dmail bulk update request errors to admin

This commit is contained in:
r888888888
2015-04-21 18:39:42 -07:00
parent 2016feeb28
commit 6ff02c653d
4 changed files with 40 additions and 6 deletions

View File

@@ -23,6 +23,17 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
@req = FactoryGirl.create(:bulk_update_request, :script => "create alias AAA -> BBB", :forum_topic => @topic)
end
should "handle errors gracefully" do
@req.stubs(:update_forum_topic_for_approve).raises(RuntimeError.new("blah"))
assert_difference("Dmail.count", 1) do
CurrentUser.scoped(@admin, "127.0.0.1") do
@req.approve!
end
end
assert_match(/Exception: RuntimeError/, Dmail.last.body)
assert_match(/Message: blah/, Dmail.last.body)
end
should "downcase the text" do
assert_equal("create alias aaa -> bbb", @req.script)
end