action_mailer-logged_smtp_delivery 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,18 +11,6 @@ require 'net/smtp'
|
|
11
11
|
# Can optionally log the raw email
|
12
12
|
# TLS support
|
13
13
|
module ActionMailer::LoggedSMTPDelivery
|
14
|
-
class DeliveryFailure < StandardError
|
15
|
-
|
16
|
-
delegate :message, :backtrace, :to_s, :to => :original_exception
|
17
|
-
|
18
|
-
attr_reader :original_exception, :destinations
|
19
|
-
|
20
|
-
def initialize(original_exception, destinations)
|
21
|
-
@original_exception = original_exception
|
22
|
-
@destinations = destinations
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
14
|
|
27
15
|
def self.included(base)
|
28
16
|
base.class_attribute :mail_file_logger
|
@@ -59,9 +47,6 @@ module ActionMailer::LoggedSMTPDelivery
|
|
59
47
|
response = session.send_message(message, sender, destinations)
|
60
48
|
log "done #{response.inspect}"
|
61
49
|
end
|
62
|
-
rescue Exception => e
|
63
|
-
log "failed #{e.message}"
|
64
|
-
raise DeliveryFailure.new(e, destinations)
|
65
50
|
end
|
66
51
|
|
67
52
|
def destinations
|
@@ -127,45 +127,6 @@ class LoggedSMTPDeliveryTest < MiniTest::Unit::TestCase
|
|
127
127
|
assert_equal false, @delivery.message.include?('bcc@example.com')
|
128
128
|
end
|
129
129
|
|
130
|
-
describe "failure" do
|
131
|
-
before do
|
132
|
-
@delivery.settings[:adaptor] = Class.new do
|
133
|
-
def initialize(*args)
|
134
|
-
raise StandardError.new("Invalid address")
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
begin
|
139
|
-
@mail.from = 'me@example.com'
|
140
|
-
@mail.to = 'to@example.com'
|
141
|
-
@mail.cc = 'cc@example.com'
|
142
|
-
@delivery.perform
|
143
|
-
assert false, "Delivery didn't raise an exception"
|
144
|
-
rescue StandardError => e
|
145
|
-
@failure = e
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
it "provides the original exception" do
|
150
|
-
original_exception = @failure.original_exception
|
151
|
-
assert_equal StandardError, original_exception.class
|
152
|
-
assert_equal "Invalid address", original_exception.message
|
153
|
-
end
|
154
|
-
|
155
|
-
it "provides the destinations that it failed delivery to" do
|
156
|
-
assert_equal [ 'to@example.com', 'cc@example.com' ], @failure.destinations
|
157
|
-
end
|
158
|
-
|
159
|
-
it "acts displays the original exception" do
|
160
|
-
original_exception = @failure.original_exception
|
161
|
-
|
162
|
-
assert_equal original_exception.backtrace, @failure.backtrace
|
163
|
-
assert_equal original_exception.message, @failure.message
|
164
|
-
assert_equal original_exception.to_s, @failure.to_s
|
165
|
-
end
|
166
|
-
|
167
|
-
end
|
168
|
-
|
169
130
|
end
|
170
131
|
|
171
132
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_mailer-logged_smtp_delivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionmailer
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.8.
|
76
|
+
rubygems_version: 1.8.25
|
77
77
|
signing_key:
|
78
78
|
specification_version: 3
|
79
79
|
summary: An ActionMailer delivery strategy
|