malone 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/malone.rb +4 -3
- data/lib/malone/test.rb +4 -0
- data/malone.gemspec +1 -1
- data/test/malone.rb +24 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b1ca8f31cc283952e8c8695856e8d23b786989f
|
4
|
+
data.tar.gz: 590735c66084e4ac868cc84134bf8ada90e1658e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e970f1a1cc960d86a770eefa0ebecaee36acff06b0bf84e1d58829fbf79b4db501e777016f8b78f68be5550626e4f611dee887183a3680042c2aa2c075f600b
|
7
|
+
data.tar.gz: 88545a350e515bca0f72043aaa918ea09d77384e7b50f84ab375121373ff8877982c52e3f484cfd19820035526912b467d15016c8ec88a2be8ef2d9ced31f503
|
data/lib/malone.rb
CHANGED
@@ -30,6 +30,7 @@ class Malone
|
|
30
30
|
|
31
31
|
def deliver(dict)
|
32
32
|
mail = envelope(dict)
|
33
|
+
yield mail if block_given?
|
33
34
|
|
34
35
|
smtp = Net::SMTP.new(config.host, config.port)
|
35
36
|
smtp.enable_starttls_auto if config.tls
|
@@ -65,8 +66,9 @@ class Malone
|
|
65
66
|
attr_accessor :user
|
66
67
|
attr_accessor :password
|
67
68
|
attr_accessor :domain
|
68
|
-
attr_accessor :auth
|
69
69
|
attr_accessor :tls
|
70
|
+
|
71
|
+
attr :auth
|
70
72
|
|
71
73
|
def initialize(options)
|
72
74
|
opts = options.dup
|
@@ -90,8 +92,7 @@ class Malone
|
|
90
92
|
end
|
91
93
|
|
92
94
|
def auth=(val)
|
93
|
-
@auth = val
|
94
|
-
@auth = @auth.to_sym if @auth
|
95
|
+
@auth = val && val.to_sym
|
95
96
|
end
|
96
97
|
|
97
98
|
private
|
data/lib/malone/test.rb
CHANGED
data/malone.gemspec
CHANGED
data/test/malone.rb
CHANGED
@@ -186,6 +186,15 @@ scope do
|
|
186
186
|
assert $smtp[:finish]
|
187
187
|
end
|
188
188
|
|
189
|
+
test "adding custom headers" do |m|
|
190
|
+
m.deliver(to: "recipient@me.com", from: "no-reply@mydomain.com",
|
191
|
+
subject: "Happy new year!", text: "TEXT") do |mail|
|
192
|
+
mail.add_header("X-MC-SendAt", "2016-01-01 00:00:00")
|
193
|
+
end
|
194
|
+
|
195
|
+
assert $smtp[:blob].include?("X-MC-SendAt: 2016-01-01 00:00:00")
|
196
|
+
end
|
197
|
+
|
189
198
|
test "calls #finish even when it fails during send_message" do |m|
|
190
199
|
class FakeSMTP
|
191
200
|
def send_message(*args)
|
@@ -221,3 +230,18 @@ test "sandbox" do
|
|
221
230
|
assert_equal "TEXT", mail.text
|
222
231
|
assert_equal "<h1>TEXT</h1>", mail.html
|
223
232
|
end
|
233
|
+
|
234
|
+
test "resetting the test sandbox" do
|
235
|
+
require "malone/test"
|
236
|
+
|
237
|
+
m = Malone.connect
|
238
|
+
|
239
|
+
2.times do
|
240
|
+
m.deliver(to: "recipient@me.com", from: "no-reply@mydomain.com",
|
241
|
+
subject: "SUB", text: "test")
|
242
|
+
end
|
243
|
+
|
244
|
+
assert 1 < Malone.deliveries.size
|
245
|
+
Malone.reset_deliveries
|
246
|
+
assert_equal 0, Malone.deliveries.size
|
247
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: malone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril David
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.4.5
|
78
|
+
rubygems_version: 2.4.5.1
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: The Mailman
|