simple_postmark 0.4.4 → 0.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.
- data/simple_postmark.gemspec +1 -1
- data/spec/integration_spec.rb +6 -6
- data/spec/mail_ext/part_spec.rb +11 -11
- metadata +2 -2
data/simple_postmark.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'simple_postmark'
|
3
|
-
gem.version = '0.
|
3
|
+
gem.version = '0.5.0'
|
4
4
|
gem.authors = 'Mario Uher'
|
5
5
|
gem.email = 'uher.mario@gmail.com'
|
6
6
|
gem.description = 'SimplePostmark makes it easy to send mails via Postmark™ using Rails 3\'s ActionMailer.'
|
data/spec/integration_spec.rb
CHANGED
@@ -6,7 +6,7 @@ require 'simple_postmark/railtie'
|
|
6
6
|
WebMock.allow_net_connect!
|
7
7
|
|
8
8
|
class IntegrationMailer < ActionMailer::Base
|
9
|
-
default
|
9
|
+
default from: 'barney@himym.tld', to: 'ted@himym.tld'
|
10
10
|
|
11
11
|
def text
|
12
12
|
'Mail send via Postmark using SimplePostmark'
|
@@ -33,7 +33,7 @@ class IntegrationMailer < ActionMailer::Base
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def email_with_reply_to
|
36
|
-
mail(subject: 'SimplePostmark with Reply To', reply_to:
|
36
|
+
mail(subject: 'SimplePostmark with Reply To', reply_to: 'barney@barneystinsonblog.com') do |as|
|
37
37
|
as.text { render(text: text) }
|
38
38
|
end
|
39
39
|
end
|
@@ -41,7 +41,7 @@ end
|
|
41
41
|
|
42
42
|
describe 'SimplePostmark integration' do
|
43
43
|
before do
|
44
|
-
ActionMailer::Base.simple_postmark_settings = { api_key:
|
44
|
+
ActionMailer::Base.simple_postmark_settings = { api_key: 'POSTMARK_API_TEST', return_response: true }
|
45
45
|
ActionMailer::Base.raise_delivery_errors = true
|
46
46
|
end
|
47
47
|
|
@@ -87,15 +87,15 @@ describe 'SimplePostmark integration' do
|
|
87
87
|
|
88
88
|
describe 'setting return_response option' do
|
89
89
|
before do
|
90
|
-
ActionMailer::Base.simple_postmark_settings = { api_key:
|
90
|
+
ActionMailer::Base.simple_postmark_settings = { api_key: 'POSTMARK_API_TEST', return_response: true }
|
91
91
|
end
|
92
92
|
|
93
93
|
|
94
94
|
it 'returns the response from postmarkapp.com' do
|
95
95
|
response = IntegrationMailer.email.deliver!.parsed_response
|
96
96
|
|
97
|
-
response['To'].must_equal(
|
98
|
-
response['Message'].must_equal('
|
97
|
+
response['To'].must_equal('ted@himym.tld')
|
98
|
+
response['Message'].must_equal('Test job accepted')
|
99
99
|
response['MessageID'].wont_be_empty
|
100
100
|
end
|
101
101
|
end
|
data/spec/mail_ext/part_spec.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require File.expand_path('../../spec_helper', __FILE__)
|
2
2
|
|
3
|
-
describe Mail::Part do
|
3
|
+
describe 'Mail::Part' do
|
4
4
|
describe 'integration into Mail::Part' do
|
5
5
|
subject { Mail::Part.new }
|
6
6
|
|
7
7
|
|
8
8
|
it 'responds to +to_postmark+' do
|
9
|
-
subject.
|
9
|
+
subject.must_respond_to(:to_postmark)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -15,15 +15,15 @@ describe Mail::Part do
|
|
15
15
|
describe 'a text/plain part' do
|
16
16
|
let(:content) { "Think of me like Yoda, but instead of being little and green I wear suits and I'm awesome. I'm your bro-I'm Broda!" }
|
17
17
|
subject do
|
18
|
-
Mail::Part.new do
|
19
|
-
body
|
20
|
-
content_type 'text/plain'
|
18
|
+
Mail::Part.new.tap do |mail|
|
19
|
+
mail.body = content
|
20
|
+
mail.content_type = 'text/plain'
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
|
25
25
|
it 'returns body hash' do
|
26
|
-
|
26
|
+
subject.to_postmark.must_equal('Name' => nil, 'Content' => content, 'ContentType' => 'text/plain')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -31,15 +31,15 @@ describe Mail::Part do
|
|
31
31
|
describe 'a text/html part' do
|
32
32
|
let(:content) { "<p>Think of me like Yoda, but instead of being little and green I wear suits and I'm awesome.<br /><br />I'm your bro-I'm Broda!</p>" }
|
33
33
|
subject do
|
34
|
-
Mail::Part.new do
|
35
|
-
body
|
36
|
-
content_type 'text/html'
|
34
|
+
Mail::Part.new.tap do |mail|
|
35
|
+
mail.body = content
|
36
|
+
mail.content_type = 'text/html'
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
|
41
41
|
it 'returns body hash' do
|
42
|
-
|
42
|
+
subject.to_postmark.must_equal('Name' => nil, 'Content' => content, 'ContentType' => 'text/html')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -55,7 +55,7 @@ describe Mail::Part do
|
|
55
55
|
|
56
56
|
|
57
57
|
it 'returns base64-encoded file-content hash if part is an attachment' do
|
58
|
-
|
58
|
+
subject.to_postmark.must_equal('Name' => 'thebrocode.jpg', 'Content' => content, 'ContentType' => 'image/jpeg')
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_postmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
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-11-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|