replyr 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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