mandrill_mailer 1.4.0 → 1.5.0
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/CHANGELOG.md +3 -0
- data/README.md +8 -8
- data/lib/mandrill_mailer/offline.rb +0 -29
- data/lib/mandrill_mailer/version.rb +1 -1
- data/spec/core_mailer_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db83dd2cbc825c2c3f08e744629adafa42883d00
|
4
|
+
data.tar.gz: 7f829bc19555e3f6988b0bdf897f5d3dddcd83d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4507163ed0e75d8b2c2bec260bc3d0481f1ff83efd3d3f0f019bc2ce1b796ef9d31189004bf2d905cb1ef7ea63aae79c88f6a5fda84234139192d367297562f2
|
7
|
+
data.tar.gz: eb526bb48f908ee0f30311613232451364f5797a698d6de944aff97ab00d7a083475077d79855992070b552539a4cc5f60aa30745201fb23c025a7875fa780fb
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## 1.5.0 - 2017-03-20
|
6
|
+
- Update offline adapter for testing to be more compatible with Rails 5 via @eric1234
|
7
|
+
|
5
8
|
## 1.4.0 - 2016-04-28
|
6
9
|
### Changed
|
7
10
|
- Update deprecated RSpec failure methods in RSpec helpers.
|
data/README.md
CHANGED
@@ -220,7 +220,7 @@ You can send the email by using the familiar syntax:
|
|
220
220
|
|
221
221
|
`InvitationMailer.invite(invitation).deliver_now`
|
222
222
|
`InvitationMailer.invite(invitation).deliver_later(wait: 1.hour)`
|
223
|
-
For deliver_later, Active Job will need to be configured
|
223
|
+
For deliver_later, Active Job will need to be configured
|
224
224
|
|
225
225
|
## Creating a test method
|
226
226
|
When switching over to Mandrill for transactional emails we found that it was hard to setup a mailer in the console to send test emails easily (those darn designers), but really, you don't want to have to setup test objects everytime you want to send a test email. You can set up a testing 'mock' once and then call the `.test` method to send the test email.
|
@@ -270,7 +270,7 @@ require 'mandrill_mailer/offline'
|
|
270
270
|
And then if you wish you can look at the contents of `MandrillMailer.deliveries` to see whether an email was queued up by your test:
|
271
271
|
|
272
272
|
```ruby
|
273
|
-
email = MandrillMailer
|
273
|
+
email = MandrillMailer.deliveries.detect { |mail|
|
274
274
|
mail.template_name == 'my-template' &&
|
275
275
|
mail.message['to'].any? { |to| to[:email] == 'my@email.com' }
|
276
276
|
}
|
@@ -284,7 +284,7 @@ before :each { MandrillMailer.deliveries.clear }
|
|
284
284
|
```
|
285
285
|
|
286
286
|
## Using Delayed Job
|
287
|
-
The typical Delayed Job mailer syntax won't work with this as of now. Either create a custom job or
|
287
|
+
The typical Delayed Job mailer syntax won't work with this as of now. Either create a custom job or queue the mailer as you would queue a method. Take a look at the following examples:
|
288
288
|
|
289
289
|
```ruby
|
290
290
|
def send_hallpass_expired_mailer
|
@@ -369,11 +369,11 @@ Example that adds multiple bcc recipients:
|
|
369
369
|
MandrillMailer.configure do |config|
|
370
370
|
config.interceptor = Proc.new {|params|
|
371
371
|
|
372
|
-
params[
|
373
|
-
params[
|
374
|
-
{ email
|
375
|
-
{ email
|
376
|
-
{ email
|
372
|
+
params["to"] = [
|
373
|
+
params["to"],
|
374
|
+
{ "email" => "bccEmailThatWillBeUsedInAll@emailsSent1.com", "name" => "name", "type" => "bcc" },
|
375
|
+
{ "email" => "bccEmailThatWillBeUsedInAll@emailsSent2.com", "name" => "name", "type" => "bcc" },
|
376
|
+
{ "email" => "bccEmailThatWillBeUsedInAll@emailsSent3.com", "name" => "name", "type" => "bcc" }
|
377
377
|
].flatten
|
378
378
|
}
|
379
379
|
end
|
@@ -26,10 +26,6 @@ module MandrillMailer
|
|
26
26
|
end
|
27
27
|
|
28
28
|
class TemplateMailer
|
29
|
-
def deliver
|
30
|
-
deliver_now
|
31
|
-
end
|
32
|
-
|
33
29
|
def deliver_now
|
34
30
|
MandrillMailer::Mock.new({
|
35
31
|
:template_name => template_name,
|
@@ -42,24 +38,9 @@ module MandrillMailer
|
|
42
38
|
MandrillMailer.deliveries << mock
|
43
39
|
end
|
44
40
|
end
|
45
|
-
def deliver_later
|
46
|
-
MandrillMailer::Mock.new({
|
47
|
-
:template_name => template_name,
|
48
|
-
:template_content => template_content,
|
49
|
-
:message => message,
|
50
|
-
:async => async,
|
51
|
-
:ip_pool => ip_pool,
|
52
|
-
:send_at => send_at
|
53
|
-
}).tap do |mock|
|
54
|
-
MandrillMailer.deliveries << mock
|
55
|
-
end
|
56
|
-
end
|
57
41
|
end
|
58
42
|
|
59
43
|
class MessageMailer
|
60
|
-
def deliver
|
61
|
-
deliver_now
|
62
|
-
end
|
63
44
|
def deliver_now
|
64
45
|
MandrillMailer::Mock.new({
|
65
46
|
:message => message,
|
@@ -70,15 +51,5 @@ module MandrillMailer
|
|
70
51
|
MandrillMailer.deliveries << mock
|
71
52
|
end
|
72
53
|
end
|
73
|
-
def deliver_later
|
74
|
-
MandrillMailer::Mock.new({
|
75
|
-
:message => message,
|
76
|
-
:async => async,
|
77
|
-
:ip_pool => ip_pool,
|
78
|
-
:send_at => send_at
|
79
|
-
}).tap do |mock|
|
80
|
-
MandrillMailer.deliveries << mock
|
81
|
-
end
|
82
|
-
end
|
83
54
|
end
|
84
55
|
end
|
data/spec/core_mailer_spec.rb
CHANGED
@@ -179,7 +179,7 @@ describe MandrillMailer::CoreMailer do
|
|
179
179
|
|
180
180
|
context 'Rails is not defined' do
|
181
181
|
it 'should raise an exception' do
|
182
|
-
expect{subject}.to raise_error
|
182
|
+
expect{subject}.to raise_error NoMethodError
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
@@ -212,7 +212,7 @@ describe MandrillMailer::CoreMailer do
|
|
212
212
|
|
213
213
|
context 'Rails does not exist' do
|
214
214
|
it 'should raise exception' do
|
215
|
-
expect{ subject }.to raise_error
|
215
|
+
expect{ subject }.to raise_error NoMethodError
|
216
216
|
end
|
217
217
|
end
|
218
218
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,9 @@ require 'pry'
|
|
8
8
|
# in ./support/ and its subdirectories.
|
9
9
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
10
10
|
|
11
|
+
ActiveJob::Base.queue_adapter = :inline
|
12
|
+
ActiveJob::Base.logger.level = Logger::WARN
|
13
|
+
|
11
14
|
RSpec.configure do |config|
|
12
15
|
config.mock_with :rspec
|
13
|
-
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Rensel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.6.10
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Transactional Mailer for Mandrill
|