multi_smtp_plus 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/multi_smtp/version.rb +1 -1
- data/lib/multi_smtp_plus.rb +1 -0
- data/multi_smtp.gemspec +6 -1
- metadata +3 -11
- data/.gitignore +0 -15
- data/Gemfile +0 -4
- data/Rakefile +0 -2
- data/spec/lib/multi_smtp/mail_spec.rb +0 -82
- data/spec/lib/multi_smtp_spec.rb +0 -17
- data/spec/spec_helper.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e575a196baf3606392ebb60a7d5b599108bc76c8dcad3dfbb19dbaf5fb3c578c
|
|
4
|
+
data.tar.gz: 47642513c84393e8fc6b572e3f6cd308ead93f9caee6dd01dd0b1877f99b4aac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb0a6326e5de7c2531819a698d3d373a04cd628da69ff9bcf596a64e2e9f316651287f02fc9a04a17672be64eb1449383f35a1384a296b44f6f59ae7601cd0d3
|
|
7
|
+
data.tar.gz: cb23b75829538a8b5a92dccac6a2f10e636a301e2cfb2cf99bc8405f8747e4648273b6649cff173fb8168d1b552722782e6633f91dda894950c02c1cb0810dec
|
data/README.md
CHANGED
data/lib/multi_smtp/version.rb
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "multi_smtp"
|
data/multi_smtp.gemspec
CHANGED
|
@@ -19,7 +19,12 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
"changelog_uri" => File.join(spec.homepage, "releases")
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
spec.files =
|
|
22
|
+
spec.files = Dir[
|
|
23
|
+
"lib/**/*",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE.txt",
|
|
26
|
+
"multi_smtp.gemspec"
|
|
27
|
+
]
|
|
23
28
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
24
29
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
25
30
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: multi_smtp_plus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Harlow Ward
|
|
@@ -98,19 +98,14 @@ executables: []
|
|
|
98
98
|
extensions: []
|
|
99
99
|
extra_rdoc_files: []
|
|
100
100
|
files:
|
|
101
|
-
- ".gitignore"
|
|
102
|
-
- Gemfile
|
|
103
101
|
- LICENSE.txt
|
|
104
102
|
- README.md
|
|
105
|
-
- Rakefile
|
|
106
103
|
- lib/multi_smtp.rb
|
|
107
104
|
- lib/multi_smtp/mail.rb
|
|
108
105
|
- lib/multi_smtp/notifiers/airbrake.rb
|
|
109
106
|
- lib/multi_smtp/version.rb
|
|
107
|
+
- lib/multi_smtp_plus.rb
|
|
110
108
|
- multi_smtp.gemspec
|
|
111
|
-
- spec/lib/multi_smtp/mail_spec.rb
|
|
112
|
-
- spec/lib/multi_smtp_spec.rb
|
|
113
|
-
- spec/spec_helper.rb
|
|
114
109
|
homepage: https://github.com/woosunwoo/multi_smtp
|
|
115
110
|
licenses:
|
|
116
111
|
- MIT
|
|
@@ -137,7 +132,4 @@ rubygems_version: 3.4.10
|
|
|
137
132
|
signing_key:
|
|
138
133
|
specification_version: 4
|
|
139
134
|
summary: Automatic SMTP email failover in Rails with MultiSMTP
|
|
140
|
-
test_files:
|
|
141
|
-
- spec/lib/multi_smtp/mail_spec.rb
|
|
142
|
-
- spec/lib/multi_smtp_spec.rb
|
|
143
|
-
- spec/spec_helper.rb
|
|
135
|
+
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe MultiSMTP::Mail, "#deliver!" do
|
|
4
|
-
let(:error_notifier) { double(:notifier) }
|
|
5
|
-
|
|
6
|
-
before do
|
|
7
|
-
allow(error_notifier).to receive(:notify)
|
|
8
|
-
MultiSMTP.error_notifier = error_notifier
|
|
9
|
-
MultiSMTP.smtp_providers = [
|
|
10
|
-
provider("smtp.sendgrid.net", "sendgrid"),
|
|
11
|
-
provider("smtp.amazaon_ses.com", "amazon_ses")
|
|
12
|
-
]
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
context "primary email provider succeeds" do
|
|
16
|
-
it "sends an email" do
|
|
17
|
-
allow_any_instance_of(Net::SMTP).to receive(:start).and_return(true)
|
|
18
|
-
|
|
19
|
-
MultiSMTP::Mail.new({}).deliver!(mail)
|
|
20
|
-
|
|
21
|
-
expect(error_notifier).not_to have_received(:notify)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
context "primary email provider fails" do
|
|
26
|
-
it "sends an email with secondary provider" do
|
|
27
|
-
allow_any_instance_of(Net::SMTP).to receive(:start).
|
|
28
|
-
with("test.com", "sendgrid", "password", :login).
|
|
29
|
-
and_raise(Net::SMTPFatalError)
|
|
30
|
-
|
|
31
|
-
allow_any_instance_of(Net::SMTP).to receive(:start).
|
|
32
|
-
with("test.com", "amazon_ses", "password", :login).
|
|
33
|
-
and_return(true)
|
|
34
|
-
|
|
35
|
-
MultiSMTP::Mail.new({}).deliver!(mail)
|
|
36
|
-
|
|
37
|
-
expect(error_notifier).to_not have_received(:notify)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
context "all smtp providers fail" do
|
|
42
|
-
context "notifier is set" do
|
|
43
|
-
it "notifies airbrake" do
|
|
44
|
-
allow_any_instance_of(Net::SMTP).to receive(:start).
|
|
45
|
-
and_raise(Net::SMTPFatalError)
|
|
46
|
-
|
|
47
|
-
MultiSMTP::Mail.new({}).deliver!(mail)
|
|
48
|
-
|
|
49
|
-
expect(error_notifier).to have_received(:notify).once
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
context "notifier is not set" do
|
|
54
|
-
it "re-raises the original exception" do
|
|
55
|
-
MultiSMTP.error_notifier = nil
|
|
56
|
-
allow_any_instance_of(Net::SMTP).to receive(:start).
|
|
57
|
-
and_raise(Net::SMTPFatalError)
|
|
58
|
-
|
|
59
|
-
expect { MultiSMTP::Mail.new({}).deliver!(mail) }.to raise_exception
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def mail
|
|
65
|
-
Mail.new(
|
|
66
|
-
delivery_handler: "test",
|
|
67
|
-
from: "from@test.com",
|
|
68
|
-
subject: "test",
|
|
69
|
-
to: "to@test.com"
|
|
70
|
-
)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def provider(address, user_name)
|
|
74
|
-
{
|
|
75
|
-
address: address,
|
|
76
|
-
authentication: :login,
|
|
77
|
-
domain: "test.com",
|
|
78
|
-
password: "password",
|
|
79
|
-
user_name: user_name
|
|
80
|
-
}
|
|
81
|
-
end
|
|
82
|
-
end
|
data/spec/lib/multi_smtp_spec.rb
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe MultiSMTP, ".smtp_providers" do
|
|
4
|
-
it "returns an array of providers" do
|
|
5
|
-
MultiSMTP.smtp_providers = [:provider1, :provider2]
|
|
6
|
-
|
|
7
|
-
result = MultiSMTP.smtp_providers
|
|
8
|
-
|
|
9
|
-
expect(result).to eq [:provider1, :provider2]
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
context "no providers set" do
|
|
13
|
-
it "raises and exception" do
|
|
14
|
-
expect { MultiSMTP.smtp_providers }.to raise_exception
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
|
|
2
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__))
|
|
3
|
-
|
|
4
|
-
require "rubygems"
|
|
5
|
-
require "rspec"
|
|
6
|
-
require "pry"
|
|
7
|
-
require "multi_smtp"
|
|
8
|
-
|
|
9
|
-
RSpec.configure do |config|
|
|
10
|
-
config.after :each do
|
|
11
|
-
MultiSMTP.smtp_providers = nil
|
|
12
|
-
end
|
|
13
|
-
end
|