Please enable JavaScript to use RhodeCode Enterprise
##// END OF EJS Templates
Jean-Philippe Lang
- Mon, 08 Dec 2014 17:31:48
Show More
0
app/models/mail_handler.rb
app/models/mail_handler.rb
+1
-1
@@
-49,7
+49,7
class MailHandler < ActionMailer::Base
49
# Receives an email and rescues any exception
49
# Receives an email and rescues any exception
50
def self . safe_receive ( * args )
50
def self . safe_receive ( * args )
51
receive ( * args )
51
receive ( * args )
52
rescue => e
52
rescue Exception => e
53
logger . error "An unexpected error occurred when receiving email: #{ e . message } " if logger
53
logger . error "An unexpected error occurred when receiving email: #{ e . message } " if logger
54
return false
54
return false
55
end
55
end
0
test/unit/mail_handler_test.rb
test/unit/mail_handler_test.rb
+6
0
@@
-936,6
+936,12
class MailHandlerTest < ActiveSupport::TestCase
936
}, options )
936
}, options )
937
end
937
end
938
938
939
def test_safe_receive_should_rescue_exceptions_and_return_false
940
MailHandler . stubs ( :receive ) . raises ( Exception . new "Something went wrong" )
941
942
assert_equal false , MailHandler . safe_receive
943
end
944
939
private
945
private
940
946
941
def submit_email ( filename , options = {})
947
def submit_email ( filename , options = {})
0
test/unit/mailer_test.rb
test/unit/mailer_test.rb
+13
0
@@
-758,6
+758,19
class MailerTest < ActiveSupport::TestCase
758
assert_kind_of :: Mail :: Message , Mailer . test_email ( User . find ( 1 ))
758
assert_kind_of :: Mail :: Message , Mailer . test_email ( User . find ( 1 ))
759
end
759
end
760
760
761
def test_with_synched_deliveries_should_yield_with_synced_deliveries
762
ActionMailer :: Base . delivery_method = :async_smtp
763
ActionMailer :: Base . async_smtp_settings = { :foo => 'bar' }
764
765
Mailer . with_synched_deliveries do
766
assert_equal :smtp , ActionMailer :: Base . delivery_method
767
assert_equal ({ :foo => 'bar' }, ActionMailer :: Base . smtp_settings )
768
end
769
assert_equal :async_smtp , ActionMailer :: Base . delivery_method
770
ensure
771
ActionMailer :: Base . delivery_method = :test
772
end
773
761
private
774
private
762
775
763
def last_email
776
def last_email
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
g 0-9
Goto bookmarked items from 0-9
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository access permissions settings
t s
Toggle sidebar on some pages