pony 1.12 → 1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +8 -3
- data/lib/pony.rb +6 -4
- data/pony.gemspec +1 -3
- data/spec/pony_spec.rb +30 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3abcec67b278593b90167a520183c1648c3bf01c86275cd3c3ac82bf192b7741
|
4
|
+
data.tar.gz: b7534155840b1bb03bb143222d4288df2acee8b52ecd2382bc61c9e1bae08789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 153288b21f87facc30475138c3cf184bb49b6984d7812a9e01c337908c7f9dfe8ab5b508a952eced3196ce2b022cba5a0876d0f8590f23f201b66dc276e1772d
|
7
|
+
data.tar.gz: 5de0842ef7999ccc5a30a53c1baca95a689c6bd6433370999e2368ea94be2e40cc31088d81b653f041f8e3366bd39539d5140cf9ec19a968ee94b3dbe065dbf4
|
data/README.md
CHANGED
@@ -169,7 +169,7 @@ As pony relies on mail to send the mails, you can also use its TestMailer in you
|
|
169
169
|
Pony.mail(:to => 'foo@bar')
|
170
170
|
Mail::TestMailer.deliveries.length
|
171
171
|
=> 1
|
172
|
-
|
172
|
+
|
173
173
|
For further examples see the [corresponding section of mail's readme](https://github.com/mikel/mail#using-mail-with-testing-or-specing-libraries)
|
174
174
|
|
175
175
|
## Help ##
|
@@ -186,19 +186,20 @@ https://groups.google.com/forum/#!forum/ponyrb
|
|
186
186
|
|
187
187
|
## Authors ##
|
188
188
|
* Adam Wiggins [@adamwiggins](https://github.com/adamwiggins)
|
189
|
-
* Andrea Talbot
|
189
|
+
* Andrea Talbot
|
190
190
|
* Ben Prew [@benprew](https://github.com/benprew)
|
191
191
|
* Cameron Matheson [@cmatheson](https://github.com/cmatheson)
|
192
192
|
* Carl Hörberg [@carlhoerberg](https://github.com/carlhoerberg)
|
193
193
|
* Christian Haase [@krissi](https://github.com/krissi)
|
194
194
|
* Daniel Lopes [@danielvlopes](https://github.com/danielvlopes)
|
195
195
|
* Doug Hammond [@dslh](https://github.com/dslh)
|
196
|
+
* Fabó Márton
|
196
197
|
* Hiroshi Saito [@hiroshi](https://github.com/hiroshi)
|
197
198
|
* Kalin Harvey
|
198
199
|
* MIKAMI Yoshiyuki [@yoshuki](https://github.com/yoshuki)
|
199
200
|
* Mathieu Martin [@webmat](https://github.com/webmat)
|
200
201
|
* Michael Durrant [@durrantm](https://github.com/durrantm)
|
201
|
-
*
|
202
|
+
* Michal Kwiatkowski [@mkwiatkowski](https://github.com/mkwiatkowski)
|
202
203
|
* Nami-Doc
|
203
204
|
* Neil Middleton [@neilmiddleton](https://github.com/neilmiddleton)
|
204
205
|
* Neil Mock [@neilmock](https://github.com/neilmock)
|
@@ -216,6 +217,10 @@ https://groups.google.com/forum/#!forum/ponyrb
|
|
216
217
|
|
217
218
|
## Changelog ##
|
218
219
|
|
220
|
+
#### 1.13 ####
|
221
|
+
* fix bug: suppress potential error message from "which"
|
222
|
+
* fix bug: Add support for passing empty hashes as attachment
|
223
|
+
|
219
224
|
#### 1.12 ####
|
220
225
|
* fix bug: NoMethodError when using mail 2.7.0
|
221
226
|
|
data/lib/pony.rb
CHANGED
@@ -233,7 +233,9 @@ module Pony
|
|
233
233
|
# we need to explicitly define a second multipart/alternative
|
234
234
|
# boundary to encapsulate the body-parts within the
|
235
235
|
# multipart/mixed boundary that will be created automatically.
|
236
|
-
|
236
|
+
options[:attachments] ||= {}
|
237
|
+
|
238
|
+
if options[:attachments].any? && options[:html_body] && options[:body]
|
237
239
|
mail.part(:content_type => 'multipart/alternative') do |p|
|
238
240
|
p.html_part = build_html_part(options)
|
239
241
|
p.text_part = build_text_part(options)
|
@@ -241,7 +243,7 @@ module Pony
|
|
241
243
|
|
242
244
|
# Otherwise if there is more than one part we still need to
|
243
245
|
# ensure that they are all declared to be separate.
|
244
|
-
elsif options[:html_body] || options[:attachments]
|
246
|
+
elsif options[:html_body] || options[:attachments].any?
|
245
247
|
mail.html_part = build_html_part(options) if options[:html_body]
|
246
248
|
mail.text_part = build_text_part(options) if options[:body]
|
247
249
|
|
@@ -254,7 +256,7 @@ module Pony
|
|
254
256
|
mail[key] = value
|
255
257
|
end
|
256
258
|
|
257
|
-
add_attachments(mail, options[:attachments]) if options[:attachments]
|
259
|
+
add_attachments(mail, options[:attachments]) if options[:attachments].any?
|
258
260
|
|
259
261
|
mail.charset = options[:charset] if options[:charset] # charset must be set after setting content_type
|
260
262
|
|
@@ -327,7 +329,7 @@ module Pony
|
|
327
329
|
end
|
328
330
|
|
329
331
|
def sendmail_binary
|
330
|
-
sendmail = `which sendmail`.chomp
|
332
|
+
sendmail = `which sendmail 2>#{Gem.win_platform? ? 'nul' : '/dev/null'}`.chomp
|
331
333
|
sendmail.empty? ? '/usr/sbin/sendmail' : sendmail
|
332
334
|
end
|
333
335
|
end
|
data/pony.gemspec
CHANGED
data/spec/pony_spec.rb
CHANGED
@@ -301,6 +301,24 @@ describe Pony do
|
|
301
301
|
end
|
302
302
|
|
303
303
|
describe "content type" do
|
304
|
+
shared_examples 'a mail with only html_body and body set' do
|
305
|
+
it { expect(mail.parts.length).to eq 2 }
|
306
|
+
it { expect(mail.content_type.to_s).to include( 'multipart/alternative' ) }
|
307
|
+
it { expect(mail.parts[0].to_s).to include( 'Content-Type: text/html' ) }
|
308
|
+
it { expect(mail.parts[1].to_s).to include( 'Content-Type: text/plain' ) }
|
309
|
+
end
|
310
|
+
|
311
|
+
context "mail html_body and body" do
|
312
|
+
subject(:mail) do
|
313
|
+
Pony.send(:build_mail,
|
314
|
+
:body => 'test',
|
315
|
+
:html_body => 'What do you know, Joe?',
|
316
|
+
)
|
317
|
+
end
|
318
|
+
|
319
|
+
it_behaves_like 'a mail with only html_body and body set'
|
320
|
+
end
|
321
|
+
|
304
322
|
context "mail with attachments, html_body and body " do
|
305
323
|
subject(:mail) do
|
306
324
|
Pony.send(:build_mail,
|
@@ -318,6 +336,18 @@ describe Pony do
|
|
318
336
|
it { expect(mail.parts[0].parts[1].to_s).to include( 'Content-Type: text/plain' ) }
|
319
337
|
it { expect(mail.parts[1].to_s).to include( 'Content-Type: text/plain' ) }
|
320
338
|
end
|
339
|
+
|
340
|
+
context "mail html_body and body and empty attachment list" do
|
341
|
+
subject(:mail) do
|
342
|
+
Pony.send(:build_mail,
|
343
|
+
:body => 'test',
|
344
|
+
:html_body => 'What do you know, Joe?',
|
345
|
+
:attachments => {},
|
346
|
+
)
|
347
|
+
end
|
348
|
+
|
349
|
+
it_behaves_like 'a mail with only html_body and body set'
|
350
|
+
end
|
321
351
|
end
|
322
352
|
|
323
353
|
describe "additional headers" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.13'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wiggins
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mail
|
@@ -87,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
|
91
|
-
rubygems_version: 2.6.14
|
90
|
+
rubygems_version: 3.0.2
|
92
91
|
signing_key:
|
93
92
|
specification_version: 4
|
94
93
|
summary: 'Send email in one command: Pony.mail(:to => ''someone@example.com'', :body
|