mandrill_mailer 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/README.md +3 -2
- data/lib/mandrill_mailer/template_mailer.rb +1 -1
- data/lib/mandrill_mailer/version.rb +1 -1
- data/spec/template_mailer_spec.rb +6 -5
- metadata +2 -4
- data/Gemfile.lock +0 -72
- data/mandrill_mailer-0.0.2.gem +0 -0
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
*.gem
|
1
|
+
*.gem
|
2
|
+
Gemfile.lock
|
data/README.md
CHANGED
@@ -53,6 +53,7 @@ Creating a new Mandrill Mailer is similar to a normal Rails mailer:
|
|
53
53
|
|
54
54
|
* `#default:`
|
55
55
|
* `:from` - set the default from email address for the mailer
|
56
|
+
* `:from_name` - set the default from name for the mailer. If not set, defaults to from email address. Setting :from_name in the .mandrill_mail overrides the default.
|
56
57
|
|
57
58
|
* `.mandrill_mail`
|
58
59
|
* `:template`(required) - Template name from within Mandrill
|
@@ -88,13 +89,13 @@ Creating a new Mandrill Mailer is similar to a normal Rails mailer:
|
|
88
89
|
* `:google_analytics_campaign` - String indicating the value to set for
|
89
90
|
the utm_campaign tracking parameter. If this isn't provided the email's
|
90
91
|
from address will be used instead.
|
91
|
-
|
92
|
+
|
92
93
|
## Sending an email
|
93
94
|
|
94
95
|
You can send the email by using the familiar syntax:
|
95
96
|
|
96
97
|
`InvitationMailer.invite(invitation).deliver`
|
97
|
-
|
98
|
+
|
98
99
|
## Creating a test method
|
99
100
|
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.
|
100
101
|
|
@@ -195,7 +195,7 @@ module MandrillMailer
|
|
195
195
|
self.message = {
|
196
196
|
"subject" => args[:subject],
|
197
197
|
"from_email" => args[:from] || @@defaults[:from],
|
198
|
-
"from_name" => args[:from_name] || @@defaults[:from],
|
198
|
+
"from_name" => args[:from_name] || @@defaults[:from_name] || @@defaults[:from],
|
199
199
|
"to" => args[:to],
|
200
200
|
"headers" => args[:headers],
|
201
201
|
"track_opens" => true,
|
@@ -63,7 +63,7 @@ describe MandrillMailer::TemplateMailer do
|
|
63
63
|
subject { mailer.send(:format_to_params, email) }
|
64
64
|
|
65
65
|
it 'should format args to a format mandrill likes' do
|
66
|
-
should eq [{"email" => email, "name" => email}]
|
66
|
+
should eq [{"email" => email, "name" => email}]
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -71,7 +71,7 @@ describe MandrillMailer::TemplateMailer do
|
|
71
71
|
subject { mailer.send(:format_to_params, [email]) }
|
72
72
|
|
73
73
|
it 'should format args to a format mandrill likes' do
|
74
|
-
should eq [{"email" => email, "name" => email}]
|
74
|
+
should eq [{"email" => email, "name" => email}]
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -87,7 +87,7 @@ describe MandrillMailer::TemplateMailer do
|
|
87
87
|
subject { mailer.send(:format_to_params, [{"email" => email, "name" => name}]) }
|
88
88
|
|
89
89
|
it 'should format args to a format mandrill likes' do
|
90
|
-
should eq [{"email" => email, "name" => name}]
|
90
|
+
should eq [{"email" => email, "name" => name}]
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -96,6 +96,7 @@ describe MandrillMailer::TemplateMailer do
|
|
96
96
|
let(:template_content_name) { 'edit' }
|
97
97
|
let(:template_content_content) { 'edit_content' }
|
98
98
|
let(:from_email) { 'from@email.com' }
|
99
|
+
let(:from_name) { 'Example Name' }
|
99
100
|
let(:var_name) { 'USER_NAME' }
|
100
101
|
let(:var_content) { 'bobert' }
|
101
102
|
let(:to_email) { 'bob@email.com' }
|
@@ -121,7 +122,7 @@ describe MandrillMailer::TemplateMailer do
|
|
121
122
|
subject { mailer.mandrill_mail(args) }
|
122
123
|
|
123
124
|
before do
|
124
|
-
MandrillMailer::TemplateMailer.default from: from_email
|
125
|
+
MandrillMailer::TemplateMailer.default from: from_email, from_name: from_name
|
125
126
|
end
|
126
127
|
|
127
128
|
it 'should return the current class instance' do
|
@@ -140,7 +141,7 @@ describe MandrillMailer::TemplateMailer do
|
|
140
141
|
subject.message.should eq ({
|
141
142
|
"subject" => args[:subject],
|
142
143
|
"from_email" => from_email,
|
143
|
-
"from_name" =>
|
144
|
+
"from_name" => from_name,
|
144
145
|
"to" => [{'email' => to_email, 'name' => to_name}],
|
145
146
|
"headers" => args[:headers],
|
146
147
|
"track_opens" => true,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -101,14 +101,12 @@ files:
|
|
101
101
|
- .gitignore
|
102
102
|
- .rspec
|
103
103
|
- Gemfile
|
104
|
-
- Gemfile.lock
|
105
104
|
- README.md
|
106
105
|
- lib/mandrill_mailer.rb
|
107
106
|
- lib/mandrill_mailer/mock.rb
|
108
107
|
- lib/mandrill_mailer/railtie.rb
|
109
108
|
- lib/mandrill_mailer/template_mailer.rb
|
110
109
|
- lib/mandrill_mailer/version.rb
|
111
|
-
- mandrill_mailer-0.0.2.gem
|
112
110
|
- mandrill_mailer.gemspec
|
113
111
|
- spec/fake_rails/fake_rails.rb
|
114
112
|
- spec/spec_helper.rb
|
data/Gemfile.lock
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
mandrill_mailer (0.2.1)
|
5
|
-
actionpack
|
6
|
-
activesupport
|
7
|
-
mandrill-api (~> 1.0.9)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: http://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actionpack (3.2.8)
|
13
|
-
activemodel (= 3.2.8)
|
14
|
-
activesupport (= 3.2.8)
|
15
|
-
builder (~> 3.0.0)
|
16
|
-
erubis (~> 2.7.0)
|
17
|
-
journey (~> 1.0.4)
|
18
|
-
rack (~> 1.4.0)
|
19
|
-
rack-cache (~> 1.2)
|
20
|
-
rack-test (~> 0.6.1)
|
21
|
-
sprockets (~> 2.1.3)
|
22
|
-
activemodel (3.2.8)
|
23
|
-
activesupport (= 3.2.8)
|
24
|
-
builder (~> 3.0.0)
|
25
|
-
activesupport (3.2.8)
|
26
|
-
i18n (~> 0.6)
|
27
|
-
multi_json (~> 1.0)
|
28
|
-
builder (3.0.4)
|
29
|
-
coderay (1.0.7)
|
30
|
-
diff-lcs (1.1.3)
|
31
|
-
erubis (2.7.0)
|
32
|
-
excon (0.15.5)
|
33
|
-
hike (1.2.1)
|
34
|
-
i18n (0.6.1)
|
35
|
-
journey (1.0.4)
|
36
|
-
json (1.7.5)
|
37
|
-
mandrill-api (1.0.9)
|
38
|
-
excon (~> 0.15.4)
|
39
|
-
json (~> 1.7.4)
|
40
|
-
method_source (0.8)
|
41
|
-
multi_json (1.3.6)
|
42
|
-
pry (0.9.10)
|
43
|
-
coderay (~> 1.0.5)
|
44
|
-
method_source (~> 0.8)
|
45
|
-
slop (~> 3.3.1)
|
46
|
-
rack (1.4.1)
|
47
|
-
rack-cache (1.2)
|
48
|
-
rack (>= 0.4)
|
49
|
-
rack-test (0.6.2)
|
50
|
-
rack (>= 1.0)
|
51
|
-
rspec (2.11.0)
|
52
|
-
rspec-core (~> 2.11.0)
|
53
|
-
rspec-expectations (~> 2.11.0)
|
54
|
-
rspec-mocks (~> 2.11.0)
|
55
|
-
rspec-core (2.11.1)
|
56
|
-
rspec-expectations (2.11.3)
|
57
|
-
diff-lcs (~> 1.1.3)
|
58
|
-
rspec-mocks (2.11.3)
|
59
|
-
slop (3.3.3)
|
60
|
-
sprockets (2.1.3)
|
61
|
-
hike (~> 1.2)
|
62
|
-
rack (~> 1.0)
|
63
|
-
tilt (~> 1.1, != 1.3.0)
|
64
|
-
tilt (1.3.3)
|
65
|
-
|
66
|
-
PLATFORMS
|
67
|
-
ruby
|
68
|
-
|
69
|
-
DEPENDENCIES
|
70
|
-
mandrill_mailer!
|
71
|
-
pry
|
72
|
-
rspec
|
data/mandrill_mailer-0.0.2.gem
DELETED
Binary file
|