replyr 0.0.7 → 0.0.8
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 +4 -0
- data/README.md +41 -5
- data/lib/generators/replyr/templates/mailman_server +3 -3
- data/lib/generators/replyr/templates/replyr.rb.erb +12 -3
- data/lib/replyr.rb +31 -4
- data/lib/replyr/address_builder.rb +69 -0
- data/lib/replyr/bounce_address.rb +52 -0
- data/lib/replyr/config.rb +18 -5
- data/lib/replyr/{reply_email.rb → email.rb} +20 -4
- data/lib/replyr/engine.rb +1 -0
- data/lib/replyr/handle_bounce.rb +35 -0
- data/lib/replyr/reply_address.rb +7 -68
- data/lib/replyr/version.rb +1 -1
- data/test/dummy/app/models/user.rb +5 -0
- data/test/dummy/config/initializers/replyr.rb +2 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +16508 -0
- data/test/replyr/bounce_address_test.rb +91 -0
- data/test/replyr/email_test.rb +93 -0
- data/test/replyr/emails/bounce_422.eml +98 -0
- data/test/replyr/emails/bounce_530.eml +96 -0
- data/test/replyr/handle_bounce_test.rb +33 -0
- data/test/replyr/handle_reply_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +11 -4
- data/test/replyr/reply_email_test.rb +0 -51
@@ -1,51 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require_relative '../test_helper'
|
3
|
-
require 'mail'
|
4
|
-
|
5
|
-
describe Replyr::ReplyEmail do
|
6
|
-
describe "#new" do
|
7
|
-
it 'parses plain message object correctly' do
|
8
|
-
mail = Mail.read('test/replyr/emails/reply_plain.eml')
|
9
|
-
reply_email = Replyr::ReplyEmail.new(mail)
|
10
|
-
assert_equal "wursttheke@me.com", reply_email.from
|
11
|
-
assert_equal "Das ist wunderschön", reply_email.stripped_body
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'parses multipart message object correctly' do
|
15
|
-
mail = Mail.read('test/replyr/emails/reply_multipart.eml')
|
16
|
-
reply_email = Replyr::ReplyEmail.new(mail)
|
17
|
-
assert_equal "wursttheke@me.com", reply_email.from
|
18
|
-
assert_equal "Das ist wunderschön", reply_email.stripped_body
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'removes signature from message object' do
|
22
|
-
mail = Mail.read('test/replyr/emails/reply_plain_signature.eml')
|
23
|
-
reply_email = Replyr::ReplyEmail.new(mail)
|
24
|
-
assert_equal "wursttheke@me.com", reply_email.from
|
25
|
-
assert_equal "Das ist wunderschön", reply_email.stripped_body
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#process' do
|
31
|
-
it 'returns false if mail is invalid' do
|
32
|
-
mail = Mail.read('test/replyr/emails/reply_plain.eml')
|
33
|
-
reply_email = Replyr::ReplyEmail.new(mail)
|
34
|
-
assert_equal false, reply_email.process
|
35
|
-
end
|
36
|
-
|
37
|
-
it "processes mail if it's valid and return true" do
|
38
|
-
address = Replyr::ReplyAddress.new(Comment.create, User.create).address
|
39
|
-
mail = Mail.read('test/replyr/emails/reply_plain.eml')
|
40
|
-
mail.to = address # set correct address
|
41
|
-
reply_email = Replyr::ReplyEmail.new(mail)
|
42
|
-
|
43
|
-
assert true, reply_email.is_reply_email?
|
44
|
-
|
45
|
-
comment_count = Comment.count
|
46
|
-
assert_equal true, reply_email.process
|
47
|
-
assert_equal comment_count + 1, Comment.count
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|