iron_mailer 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@ class IronMailer::SendEmail
|
|
44
44
|
duplicate.bcc = nil
|
45
45
|
duplicate.cc = nil
|
46
46
|
end
|
47
|
-
duplicate.header['X-SMTPAPI']={cache_key: UUIDTools::UUID.random_create.to_s}.to_json
|
47
|
+
duplicate.header['X-SMTPAPI']={unique_args: {cache_key: UUIDTools::UUID.random_create.to_s}}.to_json
|
48
48
|
duplicate
|
49
49
|
}
|
50
50
|
end
|
@@ -60,7 +60,7 @@ class IronMailer::SendEmail
|
|
60
60
|
|
61
61
|
def cache_email(mail)
|
62
62
|
field = mail.header['X-SMTPAPI'].is_a?(Array) ? mail.header['X-SMTPAPI'].first : mail.header['X-SMTPAPI']
|
63
|
-
cache_key = JSON.parse(field.value)['cache_key']
|
63
|
+
cache_key = JSON.parse(field.value)['unique_args']['cache_key']
|
64
64
|
self.cache.put(cache_key, self.extract_cache_info(mail).to_json)
|
65
65
|
end
|
66
66
|
|
data/lib/iron_mailer/version.rb
CHANGED
@@ -183,13 +183,13 @@ describe IronMailer::SendEmail do
|
|
183
183
|
|
184
184
|
it "should use the cache key from the header" do
|
185
185
|
@cache.call
|
186
|
-
cache_key=JSON.parse(@test_email.header['X-SMTPAPI'].value)['cache_key']
|
186
|
+
cache_key=JSON.parse(@test_email.header['X-SMTPAPI'].value)['unique_args']['cache_key']
|
187
187
|
@send_email.cache.get(cache_key).should_not be_nil
|
188
188
|
end
|
189
189
|
|
190
190
|
it "should blow up if the cache key is blank" do
|
191
191
|
@test_email.header['X-SMTPAPI'] = nil
|
192
|
-
@test_email.header['X-SMTPAPI'] = {cache_key: nil}.to_json
|
192
|
+
@test_email.header['X-SMTPAPI'] = {unique_args: {cache_key: nil}}.to_json
|
193
193
|
@cache.should raise_error
|
194
194
|
end
|
195
195
|
|
@@ -283,7 +283,7 @@ describe IronMailer::SendEmail do
|
|
283
283
|
|
284
284
|
it "should include a cache_id in the smtp headers" do
|
285
285
|
@email = @send_email.split_email(@test_email).first
|
286
|
-
JSON.parse(@email.header['X-SMTPAPI'].first.value)['cache_key'].should_not be_blank
|
286
|
+
JSON.parse(@email.header['X-SMTPAPI'].first.value)['unique_args']['cache_key'].should_not be_blank
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|