mail-madmimi 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.arcconfig +5 -1
- data/.arclint +11 -0
- data/.gitmodules +3 -0
- data/.rubocop.yml +68 -0
- data/.travis.yml +1 -2
- data/Gemfile.lock +48 -32
- data/lib/mail/madmimi/version.rb +2 -2
- data/mail-madmimi.gemspec +8 -6
- data/spec/mail/madmimi/sender_spec.rb +43 -32
- data/spec/mail/madmimi_spec.rb +4 -4
- metadata +26 -7
data/.arcconfig
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
"project_id": "mail-madmimi",
|
3
3
|
"conduit_uri": "http://phabricator.tagview.com.br",
|
4
4
|
"load": [
|
5
|
-
"libphutil/src"
|
5
|
+
"libphutil/src",
|
6
|
+
".arcanist-extensions/rubocop_linter",
|
7
|
+
".arcanist-extensions/rspec_test_engine"
|
6
8
|
],
|
9
|
+
"unit.engine": "RSpecTestEngine",
|
10
|
+
"unit.engine.tap.command": "bundle exec rspec",
|
7
11
|
"base": "git:merge-base(origin/master)"
|
8
12
|
}
|
data/.arclint
ADDED
data/.gitmodules
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- "**/*.gemspec"
|
4
|
+
- "**/Rakefile"
|
5
|
+
- "**/Gemfile"
|
6
|
+
- "**/Vagrantfile"
|
7
|
+
- "**/config.ru"
|
8
|
+
Exclude:
|
9
|
+
- "vendor/**/*"
|
10
|
+
- "db/schema.rb"
|
11
|
+
|
12
|
+
Style/AlignHash:
|
13
|
+
EnforcedLastArgumentHashStyle: ignore_implicit
|
14
|
+
|
15
|
+
Style/BlockNesting:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Style/CaseIndentation:
|
19
|
+
IndentOneStep: true
|
20
|
+
|
21
|
+
Style/ClassAndModuleChildren:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/Documentation:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/Encoding:
|
28
|
+
EnforcedStyle: when_needed
|
29
|
+
|
30
|
+
Style/FormatString:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/GuardClause:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/IfUnlessModifier:
|
37
|
+
MaxLineLength: 120
|
38
|
+
|
39
|
+
Style/IndentHash:
|
40
|
+
EnforcedStyle: consistent
|
41
|
+
|
42
|
+
Style/LambdaCall:
|
43
|
+
EnforcedStyle: call
|
44
|
+
|
45
|
+
Style/LineLength:
|
46
|
+
Max: 120
|
47
|
+
|
48
|
+
Style/NonNilCheck:
|
49
|
+
IncludeSemanticChanges: true
|
50
|
+
|
51
|
+
Style/MethodLength:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/PredicateName:
|
55
|
+
NamePrefixBlacklist:
|
56
|
+
- is_
|
57
|
+
|
58
|
+
Style/RedundantReturn:
|
59
|
+
AllowMultipleReturnValues: true
|
60
|
+
|
61
|
+
Style/SingleLineBlockParams:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Style/StringLiterals:
|
65
|
+
EnforcedStyle: double_quotes
|
66
|
+
|
67
|
+
Style/WhileUntilModifier:
|
68
|
+
MaxLineLength: 120
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,64 +1,79 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mail-madmimi (0.0.
|
4
|
+
mail-madmimi (0.0.3)
|
5
5
|
actionmailer (>= 4.0.0)
|
6
|
-
httparty (~> 0.13.
|
6
|
+
httparty (~> 0.13.2)
|
7
7
|
mail (>= 2.5.4)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionmailer (4.1.
|
13
|
-
actionpack (= 4.1.
|
14
|
-
actionview (= 4.1.
|
15
|
-
mail (~> 2.5.4)
|
16
|
-
actionpack (4.1.
|
17
|
-
actionview (= 4.1.
|
18
|
-
activesupport (= 4.1.
|
12
|
+
actionmailer (4.1.7)
|
13
|
+
actionpack (= 4.1.7)
|
14
|
+
actionview (= 4.1.7)
|
15
|
+
mail (~> 2.5, >= 2.5.4)
|
16
|
+
actionpack (4.1.7)
|
17
|
+
actionview (= 4.1.7)
|
18
|
+
activesupport (= 4.1.7)
|
19
19
|
rack (~> 1.5.2)
|
20
20
|
rack-test (~> 0.6.2)
|
21
|
-
actionview (4.1.
|
22
|
-
activesupport (= 4.1.
|
21
|
+
actionview (4.1.7)
|
22
|
+
activesupport (= 4.1.7)
|
23
23
|
builder (~> 3.1)
|
24
24
|
erubis (~> 2.7.0)
|
25
|
-
activesupport (4.1.
|
25
|
+
activesupport (4.1.7)
|
26
26
|
i18n (~> 0.6, >= 0.6.9)
|
27
27
|
json (~> 1.7, >= 1.7.7)
|
28
28
|
minitest (~> 5.1)
|
29
29
|
thread_safe (~> 0.1)
|
30
30
|
tzinfo (~> 1.1)
|
31
|
+
ast (2.0.0)
|
32
|
+
astrolabe (1.3.0)
|
33
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
31
34
|
builder (3.2.2)
|
32
35
|
diff-lcs (1.2.5)
|
33
36
|
erubis (2.7.0)
|
34
|
-
httparty (0.13.
|
37
|
+
httparty (0.13.2)
|
35
38
|
json (~> 1.8)
|
36
39
|
multi_xml (>= 0.5.2)
|
37
40
|
i18n (0.6.11)
|
38
41
|
json (1.8.1)
|
39
|
-
mail (2.
|
40
|
-
mime-types (
|
41
|
-
|
42
|
-
|
43
|
-
minitest (5.4.0)
|
42
|
+
mail (2.6.3)
|
43
|
+
mime-types (>= 1.16, < 3)
|
44
|
+
mime-types (2.4.3)
|
45
|
+
minitest (5.4.2)
|
44
46
|
multi_xml (0.5.5)
|
45
|
-
|
47
|
+
parser (2.2.0.pre.7)
|
48
|
+
ast (>= 1.1, < 3.0)
|
49
|
+
slop (~> 3.4, >= 3.4.5)
|
50
|
+
powerpack (0.0.9)
|
46
51
|
rack (1.5.2)
|
47
52
|
rack-test (0.6.2)
|
48
53
|
rack (>= 1.0)
|
49
|
-
|
50
|
-
|
51
|
-
rspec-
|
52
|
-
rspec-
|
53
|
-
|
54
|
-
rspec-
|
55
|
-
|
56
|
-
rspec-
|
54
|
+
rainbow (2.0.0)
|
55
|
+
rspec (3.1.0)
|
56
|
+
rspec-core (~> 3.1.0)
|
57
|
+
rspec-expectations (~> 3.1.0)
|
58
|
+
rspec-mocks (~> 3.1.0)
|
59
|
+
rspec-core (3.1.7)
|
60
|
+
rspec-support (~> 3.1.0)
|
61
|
+
rspec-expectations (3.1.2)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.1.0)
|
64
|
+
rspec-mocks (3.1.3)
|
65
|
+
rspec-support (~> 3.1.0)
|
66
|
+
rspec-support (3.1.2)
|
67
|
+
rubocop (0.27.0)
|
68
|
+
astrolabe (~> 1.3)
|
69
|
+
parser (>= 2.2.0.pre.6, < 3.0)
|
70
|
+
powerpack (~> 0.0.6)
|
71
|
+
rainbow (>= 1.99.1, < 3.0)
|
72
|
+
ruby-progressbar (~> 1.4)
|
73
|
+
ruby-progressbar (1.6.1)
|
74
|
+
slop (3.6.0)
|
57
75
|
thread_safe (0.3.4)
|
58
|
-
|
59
|
-
polyglot
|
60
|
-
polyglot (>= 0.3.1)
|
61
|
-
tzinfo (1.2.1)
|
76
|
+
tzinfo (1.2.2)
|
62
77
|
thread_safe (~> 0.1)
|
63
78
|
|
64
79
|
PLATFORMS
|
@@ -66,4 +81,5 @@ PLATFORMS
|
|
66
81
|
|
67
82
|
DEPENDENCIES
|
68
83
|
mail-madmimi!
|
69
|
-
rspec (~>
|
84
|
+
rspec (~> 3.1.0)
|
85
|
+
rubocop (~> 0.27.0)
|
data/lib/mail/madmimi/version.rb
CHANGED
data/mail-madmimi.gemspec
CHANGED
@@ -11,17 +11,19 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = ["guilherme_otran@hotmail.com"]
|
12
12
|
s.summary = "A Mad Mimi Mail delivery for ActionMailer, Rails 4."
|
13
13
|
s.description = "ActionMailer send method for madmimi api"
|
14
|
-
s.homepage = "https://github.com/
|
14
|
+
s.homepage = "https://github.com/tagview/mail-madmimi"
|
15
15
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
# This gem will work with 1.9.3 or greater
|
22
|
-
s.required_ruby_version =
|
23
|
-
s.add_runtime_dependency "httparty", "~> 0.13.
|
21
|
+
# This gem will work with 1.9.3 or greater
|
22
|
+
s.required_ruby_version = ">= 1.9.3"
|
23
|
+
s.add_runtime_dependency "httparty", "~> 0.13.2"
|
24
24
|
s.add_runtime_dependency "mail", ">= 2.5.4"
|
25
25
|
s.add_runtime_dependency "actionmailer", ">= 4.0.0"
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
s.add_development_dependency "rspec", "~> 3.1.0"
|
28
|
+
s.add_development_dependency "rubocop", "~> 0.27.0"
|
29
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Mail::Madmimi::Sender do
|
4
4
|
let(:valid_settings) { { username: "none@example.com", api_key: "1234567890" } }
|
@@ -14,52 +14,62 @@ describe Mail::Madmimi::Sender do
|
|
14
14
|
|
15
15
|
describe "#email_post_body" do
|
16
16
|
context "return a hash with mimi required attributes" do
|
17
|
-
|
18
|
-
mimi_sender.email_post_body(email)[:promotion_name]
|
17
|
+
describe "promotion_name" do
|
18
|
+
subject { mimi_sender.email_post_body(email)[:promotion_name] }
|
19
|
+
it { is_expected.to eq("Promo") }
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
mimi_sender.email_post_body(email)[:recipients]
|
22
|
+
describe "recipients" do
|
23
|
+
subject { mimi_sender.email_post_body(email)[:recipients] }
|
24
|
+
it { is_expected.to eq("somebody@example.org") }
|
23
25
|
end
|
24
26
|
|
25
|
-
|
26
|
-
mimi_sender.email_post_body(email)[:raw_html]
|
27
|
+
describe "raw_html" do
|
28
|
+
subject { mimi_sender.email_post_body(email)[:raw_html] }
|
29
|
+
it { is_expected.to eq("Oi :P") }
|
27
30
|
end
|
28
31
|
|
29
|
-
|
30
|
-
mimi_sender.email_post_body(email)[:subject]
|
32
|
+
describe "subject" do
|
33
|
+
subject { mimi_sender.email_post_body(email)[:subject] }
|
34
|
+
it { is_expected.to eq("Hi") }
|
31
35
|
end
|
32
36
|
end
|
33
37
|
|
34
38
|
context "optional string attributes" do
|
35
39
|
[:from, :bcc].each do |attribute|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
context "when #{attribute} is present" do
|
41
|
+
let(:mail_options) { email_basic_options.merge(attribute => attribute.to_s) }
|
42
|
+
let(:email) { TestMailer.test_mail(mail_options) }
|
43
|
+
|
44
|
+
subject { mimi_sender.email_post_body(email)[attribute] }
|
45
|
+
it { is_expected.to eq(attribute.to_s) }
|
40
46
|
end
|
41
47
|
|
42
|
-
|
43
|
-
mimi_sender.email_post_body(email)
|
48
|
+
context "when #{attribute} is absent" do
|
49
|
+
subject { mimi_sender.email_post_body(email) }
|
50
|
+
it { is_expected.to_not have_key(attribute) }
|
44
51
|
end
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
48
55
|
context "optional boolean params" do
|
49
56
|
booleans = [:check_suppressed, :track_links, :hidden,
|
50
|
-
|
57
|
+
:skip_placeholders, :remove_unsubscribe]
|
51
58
|
|
52
59
|
booleans.each do |attribute|
|
53
60
|
[:on, :off].each do |boolean|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
61
|
+
context "when #{attribute} is #{boolean}" do
|
62
|
+
let(:mail_options) { email_basic_options.merge(attribute => boolean) }
|
63
|
+
let(:email) { TestMailer.test_mail(mail_options) }
|
64
|
+
|
65
|
+
subject { mimi_sender.email_post_body(email)[attribute] }
|
66
|
+
it { is_expected.to eq(boolean.to_s) }
|
58
67
|
end
|
59
68
|
end
|
60
69
|
|
61
|
-
|
62
|
-
mimi_sender.email_post_body(email)
|
70
|
+
context "when #{attribute} is absent" do
|
71
|
+
subject { mimi_sender.email_post_body(email) }
|
72
|
+
it { is_expected.to_not have_key(attribute) }
|
63
73
|
end
|
64
74
|
end
|
65
75
|
end
|
@@ -68,38 +78,39 @@ describe Mail::Madmimi::Sender do
|
|
68
78
|
describe "#parse_response" do
|
69
79
|
context "Received a ok response" do
|
70
80
|
let(:ok_reponse) { CorrectResponse.new }
|
81
|
+
subject { mimi_sender.parse_response(ok_reponse) }
|
71
82
|
|
72
|
-
it {
|
83
|
+
it { is_expected.to eq("1234567890") }
|
73
84
|
end
|
74
85
|
|
75
86
|
context "Received a non ok response" do
|
76
87
|
let(:invalid_response) { IncorrectResponse.new }
|
88
|
+
subject(:parse_response) { mimi_sender.parse_response(invalid_response) }
|
77
89
|
|
78
|
-
it
|
79
|
-
expect { mimi_sender.parse_response(invalid_response) }
|
80
|
-
.to raise_error Mail::Madmimi::Sender::MadmimiError
|
81
|
-
end
|
90
|
+
it { expect { parse_response }.to raise_error(Mail::Madmimi::Sender::MadmimiError) }
|
82
91
|
end
|
83
92
|
end
|
84
93
|
|
85
94
|
describe "#deliver!" do
|
86
95
|
it "posted the email" do
|
87
|
-
Mail::Madmimi::Sender.
|
96
|
+
expect(Mail::Madmimi::Sender).to receive(:post).and_return(CorrectResponse.new)
|
88
97
|
mimi_sender.deliver!(email)
|
89
98
|
end
|
90
99
|
|
91
100
|
it "posted with correct path" do
|
92
|
-
Mail::Madmimi::Sender.
|
93
|
-
.with(
|
101
|
+
expect(Mail::Madmimi::Sender).to receive(:post)
|
102
|
+
.with("/mailer", anything)
|
94
103
|
.and_return(CorrectResponse.new)
|
104
|
+
|
95
105
|
mimi_sender.deliver!(email)
|
96
106
|
end
|
97
107
|
|
98
108
|
it "posted with correct body" do
|
99
|
-
Mail::Madmimi::Sender.
|
109
|
+
expect(Mail::Madmimi::Sender).to receive(:post)
|
100
110
|
.with(anything, body: mimi_sender.email_post_body(email))
|
101
111
|
.and_return(CorrectResponse.new)
|
112
|
+
|
102
113
|
mimi_sender.deliver!(email)
|
103
114
|
end
|
104
115
|
end
|
105
|
-
end
|
116
|
+
end
|
data/spec/mail/madmimi_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Mail::Madmimi, "ActionMailer load process" do
|
4
4
|
it "registers as delivery method" do
|
5
|
-
ActionMailer::Base.delivery_methods[:mad_mimi].
|
5
|
+
expect(ActionMailer::Base.delivery_methods[:mad_mimi]).to eq(Mail::Madmimi::Sender)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -16,7 +16,7 @@ describe Mail::Madmimi, "ActionMailer integration process" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "Madmimi::Sender instance receives the mail to send after delivering it" do
|
19
|
-
Mail::Madmimi::Sender.
|
19
|
+
allow_any_instance_of(Mail::Madmimi::Sender).to receive(:deliver!).with(email)
|
20
20
|
email.deliver
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail-madmimi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2014-
|
12
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.13.
|
21
|
+
version: 0.13.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.13.
|
29
|
+
version: 0.13.2
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: mail
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 3.1.0
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,23 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 3.1.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rubocop
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.27.0
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.27.0
|
78
94
|
description: ActionMailer send method for madmimi api
|
79
95
|
email:
|
80
96
|
- guilherme_otran@hotmail.com
|
@@ -83,7 +99,10 @@ extensions: []
|
|
83
99
|
extra_rdoc_files: []
|
84
100
|
files:
|
85
101
|
- .arcconfig
|
102
|
+
- .arclint
|
86
103
|
- .gitignore
|
104
|
+
- .gitmodules
|
105
|
+
- .rubocop.yml
|
87
106
|
- .travis.yml
|
88
107
|
- Gemfile
|
89
108
|
- Gemfile.lock
|
@@ -96,7 +115,7 @@ files:
|
|
96
115
|
- spec/mail/madmimi/sender_spec.rb
|
97
116
|
- spec/mail/madmimi_spec.rb
|
98
117
|
- spec/spec_helper.rb
|
99
|
-
homepage: https://github.com/
|
118
|
+
homepage: https://github.com/tagview/mail-madmimi
|
100
119
|
licenses: []
|
101
120
|
post_install_message:
|
102
121
|
rdoc_options: []
|