mailboxer 0.11.0 → 0.12.0.rc1
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/.gitignore +2 -0
- data/.travis.yml +4 -3
- data/Appraisals +6 -14
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/app/mailers/mailboxer/base_mailer.rb +14 -0
- data/app/mailers/{message_mailer.rb → mailboxer/message_mailer.rb} +9 -14
- data/app/mailers/mailboxer/notification_mailer.rb +17 -0
- data/app/models/mailboxer/conversation.rb +196 -0
- data/app/models/mailboxer/conversation/opt_out.rb +15 -0
- data/app/models/{mailbox.rb → mailboxer/mailbox.rb} +10 -10
- data/app/models/mailboxer/message.rb +49 -0
- data/app/models/{notification.rb → mailboxer/notification.rb} +44 -40
- data/app/models/{receipt.rb → mailboxer/receipt.rb} +12 -11
- data/app/views/{message_mailer → mailboxer/message_mailer}/new_message_email.html.erb +3 -3
- data/app/views/{message_mailer → mailboxer/message_mailer}/new_message_email.text.erb +2 -2
- data/app/views/{message_mailer → mailboxer/message_mailer}/reply_message_email.html.erb +3 -3
- data/app/views/{message_mailer → mailboxer/message_mailer}/reply_message_email.text.erb +2 -2
- data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.html.erb +0 -0
- data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.text.erb +0 -0
- data/db/migrate/20110511145103_create_mailboxer.rb +18 -14
- data/db/migrate/20131206080416_add_conversation_optout.rb +14 -0
- data/gemfiles/rails3.2.gemfile +2 -3
- data/gemfiles/rails4.0.gemfile +3 -4
- data/gemfiles/rails4.1.gemfile +7 -0
- data/lib/generators/mailboxer/install_generator.rb +1 -4
- data/lib/generators/mailboxer/namespacing_compatibility_generator.rb +22 -0
- data/lib/generators/mailboxer/templates/initializer.rb +8 -4
- data/lib/generators/mailboxer/templates/mailboxer_namespacing_compatibility.rb +24 -0
- data/lib/mailboxer.rb +7 -1
- data/lib/mailboxer/cleaner.rb +9 -0
- data/lib/mailboxer/engine.rb +1 -1
- data/lib/mailboxer/mail_dispatcher.rb +48 -0
- data/lib/mailboxer/models/messageable.rb +21 -20
- data/lib/mailboxer/version.rb +3 -0
- data/mailboxer.gemspec +16 -8
- data/spec/dummy/Gemfile +1 -1
- data/spec/dummy/app/models/duck.rb +2 -2
- data/spec/dummy/config/initializers/mailboxer.rb +4 -0
- data/spec/dummy/db/migrate/20120305103200_create_mailboxer.rb +18 -14
- data/spec/dummy/db/migrate/20131206080416_add_conversation_optout.rb +14 -0
- data/spec/dummy/db/schema.rb +30 -21
- data/spec/integration/message_and_receipt_spec.rb +212 -212
- data/spec/mailboxer/mail_dispatcher_spec.rb +114 -0
- data/spec/mailers/message_mailer_spec.rb +4 -4
- data/spec/mailers/notification_mailer_spec.rb +2 -2
- data/spec/models/conversation_spec.rb +148 -47
- data/spec/models/mailbox_spec.rb +50 -50
- data/spec/models/mailboxer_models_messageable_spec.rb +52 -52
- data/spec/models/message_spec.rb +1 -1
- data/spec/models/notification_spec.rb +50 -18
- data/spec/models/receipt_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- metadata +68 -57
- data/app/mailers/notification_mailer.rb +0 -21
- data/app/models/conversation.rb +0 -166
- data/app/models/message.rb +0 -68
- data/db/migrate/20110719110700_add_notified_object.rb +0 -17
- data/db/migrate/20110912163911_add_notification_code.rb +0 -13
- data/db/migrate/20111204163911_add_attachments.rb +0 -9
- data/db/migrate/20120813110712_rename_receipts_read.rb +0 -9
- data/db/migrate/20130305144212_add_global_notification_support.rb +0 -9
- data/gemfiles/rails3.0.gemfile +0 -8
- data/gemfiles/rails3.1.gemfile +0 -8
- data/lib/mailboxer/concerns/configurable_mailer.rb +0 -13
- data/spec/dummy/db/migrate/20120305103201_add_notified_object.rb +0 -17
- data/spec/dummy/db/migrate/20120305103202_add_notification_code.rb +0 -13
- data/spec/dummy/db/migrate/20120305103203_add_attachments.rb +0 -5
- data/spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb +0 -9
- data/spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb +0 -11
- data/spec/mailboxer/concerns/configurable_mailer_spec.rb +0 -27
@@ -1,38 +1,38 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "Messages And Receipts" do
|
4
|
-
|
3
|
+
describe "Messages And Mailboxer::Receipts" do
|
4
|
+
|
5
5
|
describe "two equal entities" do
|
6
6
|
before do
|
7
7
|
@entity1 = FactoryGirl.create(:user)
|
8
8
|
@entity2 = FactoryGirl.create(:user)
|
9
9
|
end
|
10
|
-
|
11
|
-
describe "message sending" do
|
12
|
-
|
10
|
+
|
11
|
+
describe "message sending" do
|
12
|
+
|
13
13
|
before do
|
14
14
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
15
15
|
@message1 = @receipt1.notification
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should create proper message" do
|
19
19
|
@message1.sender.id.should == @entity1.id
|
20
20
|
@message1.sender.class.should == @entity1.class
|
21
21
|
assert @message1.body.eql?"Body"
|
22
22
|
assert @message1.subject.eql?"Subject"
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should create proper mails" do
|
26
26
|
#Sender Mail
|
27
|
-
mail = Receipt.recipient(@entity1).notification(@message1).first
|
27
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message1).first
|
28
28
|
assert mail
|
29
29
|
if mail
|
30
30
|
mail.is_read.should==true
|
31
31
|
mail.trashed.should==false
|
32
32
|
mail.mailbox_type.should=="sentbox"
|
33
|
-
end
|
33
|
+
end
|
34
34
|
#Receiver Mail
|
35
|
-
mail = Receipt.recipient(@entity2).notification(@message1).first
|
35
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message1).first
|
36
36
|
assert mail
|
37
37
|
if mail
|
38
38
|
mail.is_read.should==false
|
@@ -40,16 +40,16 @@ describe "Messages And Receipts" do
|
|
40
40
|
mail.mailbox_type.should=="inbox"
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
it "should have the correct recipients" do
|
45
45
|
recipients = @message1.recipients
|
46
46
|
recipients.count.should==2
|
47
47
|
recipients.count(@entity1).should==1
|
48
48
|
recipients.count(@entity2).should==1
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
describe "message replying to sender" do
|
54
54
|
before do
|
55
55
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
@@ -57,25 +57,25 @@ describe "Messages And Receipts" do
|
|
57
57
|
@message1 = @receipt1.notification
|
58
58
|
@message2 = @receipt2.notification
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it "should create proper message" do
|
62
62
|
@message2.sender.id.should == @entity2.id
|
63
63
|
@message2.sender.class.should == @entity2.class
|
64
64
|
assert @message2.body.eql?"Reply body"
|
65
65
|
assert @message2.subject.eql?"RE: Subject"
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
it "should create proper mails" do
|
69
69
|
#Sender Mail
|
70
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
70
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
71
71
|
assert mail
|
72
72
|
if mail
|
73
73
|
mail.is_read.should==true
|
74
74
|
mail.trashed.should==false
|
75
75
|
mail.mailbox_type.should=="sentbox"
|
76
|
-
end
|
76
|
+
end
|
77
77
|
#Receiver Mail
|
78
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
78
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
79
79
|
assert mail
|
80
80
|
if mail
|
81
81
|
mail.is_read.should==false
|
@@ -83,19 +83,19 @@ describe "Messages And Receipts" do
|
|
83
83
|
mail.mailbox_type.should=="inbox"
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
it "should have the correct recipients" do
|
88
88
|
recipients = @message2.recipients
|
89
89
|
recipients.count.should==2
|
90
90
|
recipients.count(@entity1).should==1
|
91
91
|
recipients.count(@entity2).should==1
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
it "should be associated to the same conversation" do
|
95
|
-
@message1.conversation.id.should==@message2.conversation.id
|
96
|
-
end
|
95
|
+
@message1.conversation.id.should==@message2.conversation.id
|
96
|
+
end
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
describe "message replying to all" do
|
100
100
|
before do
|
101
101
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
@@ -103,25 +103,25 @@ describe "Messages And Receipts" do
|
|
103
103
|
@message1 = @receipt1.notification
|
104
104
|
@message2 = @receipt2.notification
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
it "should create proper message" do
|
108
108
|
@message2.sender.id.should == @entity2.id
|
109
109
|
@message2.sender.class.should == @entity2.class
|
110
110
|
assert @message2.body.eql?"Reply body"
|
111
111
|
assert @message2.subject.eql?"RE: Subject"
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
it "should create proper mails" do
|
115
115
|
#Sender Mail
|
116
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
116
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
117
117
|
assert mail
|
118
118
|
if mail
|
119
119
|
mail.is_read.should==true
|
120
120
|
mail.trashed.should==false
|
121
121
|
mail.mailbox_type.should=="sentbox"
|
122
|
-
end
|
122
|
+
end
|
123
123
|
#Receiver Mail
|
124
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
124
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
125
125
|
assert mail
|
126
126
|
if mail
|
127
127
|
mail.is_read.should==false
|
@@ -129,17 +129,17 @@ describe "Messages And Receipts" do
|
|
129
129
|
mail.mailbox_type.should=="inbox"
|
130
130
|
end
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
it "should have the correct recipients" do
|
134
134
|
recipients = @message2.recipients
|
135
135
|
recipients.count.should==2
|
136
136
|
recipients.count(@entity1).should==1
|
137
137
|
recipients.count(@entity2).should==1
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
140
|
it "should be associated to the same conversation" do
|
141
|
-
@message1.conversation.id.should==@message2.conversation.id
|
142
|
-
end
|
141
|
+
@message1.conversation.id.should==@message2.conversation.id
|
142
|
+
end
|
143
143
|
end
|
144
144
|
describe "message replying to conversation" do
|
145
145
|
before do
|
@@ -148,25 +148,25 @@ describe "Messages And Receipts" do
|
|
148
148
|
@message1 = @receipt1.notification
|
149
149
|
@message2 = @receipt2.notification
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
it "should create proper message" do
|
153
153
|
@message2.sender.id.should == @entity2.id
|
154
154
|
@message2.sender.class.should == @entity2.class
|
155
155
|
assert @message2.body.eql?"Reply body"
|
156
156
|
assert @message2.subject.eql?"RE: Subject"
|
157
157
|
end
|
158
|
-
|
158
|
+
|
159
159
|
it "should create proper mails" do
|
160
160
|
#Sender Mail
|
161
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
161
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
162
162
|
assert mail
|
163
163
|
if mail
|
164
164
|
mail.is_read.should==true
|
165
165
|
mail.trashed.should==false
|
166
166
|
mail.mailbox_type.should=="sentbox"
|
167
|
-
end
|
167
|
+
end
|
168
168
|
#Receiver Mail
|
169
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
169
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
170
170
|
assert mail
|
171
171
|
if mail
|
172
172
|
mail.is_read.should==false
|
@@ -174,51 +174,51 @@ describe "Messages And Receipts" do
|
|
174
174
|
mail.mailbox_type.should=="inbox"
|
175
175
|
end
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
it "should have the correct recipients" do
|
179
179
|
recipients = @message2.recipients
|
180
180
|
recipients.count.should==2
|
181
181
|
recipients.count(@entity1).should==1
|
182
182
|
recipients.count(@entity2).should==1
|
183
183
|
end
|
184
|
-
|
184
|
+
|
185
185
|
it "should be associated to the same conversation" do
|
186
|
-
@message1.conversation.id.should==@message2.conversation.id
|
187
|
-
end
|
186
|
+
@message1.conversation.id.should==@message2.conversation.id
|
187
|
+
end
|
188
188
|
end
|
189
189
|
end
|
190
|
-
|
190
|
+
|
191
191
|
describe "two different entities" do
|
192
192
|
before do
|
193
193
|
@entity1 = FactoryGirl.create(:user)
|
194
194
|
@entity2 = FactoryGirl.create(:duck)
|
195
195
|
end
|
196
|
-
|
197
|
-
describe "message sending" do
|
198
|
-
|
196
|
+
|
197
|
+
describe "message sending" do
|
198
|
+
|
199
199
|
before do
|
200
200
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
201
201
|
@message1 = @receipt1.notification
|
202
202
|
end
|
203
|
-
|
203
|
+
|
204
204
|
it "should create proper message" do
|
205
205
|
@message1.sender.id.should == @entity1.id
|
206
206
|
@message1.sender.class.should == @entity1.class
|
207
207
|
assert @message1.body.eql?"Body"
|
208
208
|
assert @message1.subject.eql?"Subject"
|
209
209
|
end
|
210
|
-
|
210
|
+
|
211
211
|
it "should create proper mails" do
|
212
212
|
#Sender Mail
|
213
|
-
mail = Receipt.recipient(@entity1).notification(@message1).first
|
213
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message1).first
|
214
214
|
assert mail
|
215
215
|
if mail
|
216
216
|
mail.is_read.should==true
|
217
217
|
mail.trashed.should==false
|
218
218
|
mail.mailbox_type.should=="sentbox"
|
219
|
-
end
|
219
|
+
end
|
220
220
|
#Receiver Mail
|
221
|
-
mail = Receipt.recipient(@entity2).notification(@message1).first
|
221
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message1).first
|
222
222
|
assert mail
|
223
223
|
if mail
|
224
224
|
mail.is_read.should==false
|
@@ -226,16 +226,16 @@ describe "Messages And Receipts" do
|
|
226
226
|
mail.mailbox_type.should=="inbox"
|
227
227
|
end
|
228
228
|
end
|
229
|
-
|
229
|
+
|
230
230
|
it "should have the correct recipients" do
|
231
231
|
recipients = @message1.recipients
|
232
232
|
recipients.count.should==2
|
233
233
|
recipients.count(@entity1).should==1
|
234
234
|
recipients.count(@entity2).should==1
|
235
235
|
end
|
236
|
-
|
236
|
+
|
237
237
|
end
|
238
|
-
|
238
|
+
|
239
239
|
describe "message replying to sender" do
|
240
240
|
before do
|
241
241
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
@@ -243,25 +243,25 @@ describe "Messages And Receipts" do
|
|
243
243
|
@message1 = @receipt1.notification
|
244
244
|
@message2 = @receipt2.notification
|
245
245
|
end
|
246
|
-
|
246
|
+
|
247
247
|
it "should create proper message" do
|
248
248
|
@message2.sender.id.should == @entity2.id
|
249
249
|
@message2.sender.class.should == @entity2.class
|
250
250
|
assert @message2.body.eql?"Reply body"
|
251
251
|
assert @message2.subject.eql?"RE: Subject"
|
252
252
|
end
|
253
|
-
|
253
|
+
|
254
254
|
it "should create proper mails" do
|
255
255
|
#Sender Mail
|
256
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
256
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
257
257
|
assert mail
|
258
258
|
if mail
|
259
259
|
mail.is_read.should==true
|
260
260
|
mail.trashed.should==false
|
261
261
|
mail.mailbox_type.should=="sentbox"
|
262
|
-
end
|
262
|
+
end
|
263
263
|
#Receiver Mail
|
264
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
264
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
265
265
|
assert mail
|
266
266
|
if mail
|
267
267
|
mail.is_read.should==false
|
@@ -269,19 +269,19 @@ describe "Messages And Receipts" do
|
|
269
269
|
mail.mailbox_type.should=="inbox"
|
270
270
|
end
|
271
271
|
end
|
272
|
-
|
272
|
+
|
273
273
|
it "should have the correct recipients" do
|
274
274
|
recipients = @message2.recipients
|
275
275
|
recipients.count.should==2
|
276
276
|
recipients.count(@entity1).should==1
|
277
277
|
recipients.count(@entity2).should==1
|
278
278
|
end
|
279
|
-
|
279
|
+
|
280
280
|
it "should be associated to the same conversation" do
|
281
|
-
@message1.conversation.id.should==@message2.conversation.id
|
282
|
-
end
|
281
|
+
@message1.conversation.id.should==@message2.conversation.id
|
282
|
+
end
|
283
283
|
end
|
284
|
-
|
284
|
+
|
285
285
|
describe "message replying to all" do
|
286
286
|
before do
|
287
287
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
@@ -289,25 +289,25 @@ describe "Messages And Receipts" do
|
|
289
289
|
@message1 = @receipt1.notification
|
290
290
|
@message2 = @receipt2.notification
|
291
291
|
end
|
292
|
-
|
292
|
+
|
293
293
|
it "should create proper message" do
|
294
294
|
@message2.sender.id.should == @entity2.id
|
295
295
|
@message2.sender.class.should == @entity2.class
|
296
296
|
assert @message2.body.eql?"Reply body"
|
297
297
|
assert @message2.subject.eql?"RE: Subject"
|
298
298
|
end
|
299
|
-
|
299
|
+
|
300
300
|
it "should create proper mails" do
|
301
301
|
#Sender Mail
|
302
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
302
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
303
303
|
assert mail
|
304
304
|
if mail
|
305
305
|
mail.is_read.should==true
|
306
306
|
mail.trashed.should==false
|
307
307
|
mail.mailbox_type.should=="sentbox"
|
308
|
-
end
|
308
|
+
end
|
309
309
|
#Receiver Mail
|
310
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
310
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
311
311
|
assert mail
|
312
312
|
if mail
|
313
313
|
mail.is_read.should==false
|
@@ -315,41 +315,41 @@ describe "Messages And Receipts" do
|
|
315
315
|
mail.mailbox_type.should=="inbox"
|
316
316
|
end
|
317
317
|
end
|
318
|
-
|
318
|
+
|
319
319
|
it "should have the correct recipients" do
|
320
320
|
recipients = @message2.recipients
|
321
321
|
recipients.count.should==2
|
322
322
|
recipients.count(@entity1).should==1
|
323
323
|
recipients.count(@entity2).should==1
|
324
324
|
end
|
325
|
-
|
325
|
+
|
326
326
|
it "should be associated to the same conversation" do
|
327
|
-
@message1.conversation.id.should==@message2.conversation.id
|
328
|
-
end
|
327
|
+
@message1.conversation.id.should==@message2.conversation.id
|
328
|
+
end
|
329
329
|
end
|
330
330
|
describe "message replying to conversation (TODO)" do
|
331
331
|
before do
|
332
|
-
#TODO
|
332
|
+
#TODO
|
333
333
|
end
|
334
|
-
|
334
|
+
|
335
335
|
it "should create proper message" do
|
336
|
-
#TODO
|
336
|
+
#TODO
|
337
337
|
end
|
338
|
-
|
338
|
+
|
339
339
|
it "should create proper mails" do
|
340
|
-
#TODO
|
340
|
+
#TODO
|
341
341
|
end
|
342
|
-
|
342
|
+
|
343
343
|
it "should have the correct recipients" do
|
344
|
-
#TODO
|
344
|
+
#TODO
|
345
345
|
end
|
346
|
-
|
346
|
+
|
347
347
|
it "should be associated to the same conversation" do
|
348
|
-
#TODO
|
349
|
-
end
|
348
|
+
#TODO
|
349
|
+
end
|
350
350
|
end
|
351
351
|
end
|
352
|
-
|
352
|
+
|
353
353
|
describe "three equal entities" do
|
354
354
|
before do
|
355
355
|
@entity1 = FactoryGirl.create(:user)
|
@@ -359,33 +359,33 @@ describe "Messages And Receipts" do
|
|
359
359
|
@recipients << @entity2
|
360
360
|
@recipients << @entity3
|
361
361
|
end
|
362
|
-
|
363
|
-
describe "message sending" do
|
364
|
-
|
362
|
+
|
363
|
+
describe "message sending" do
|
364
|
+
|
365
365
|
before do
|
366
366
|
@receipt1 = @entity1.send_message(@recipients,"Body","Subject")
|
367
367
|
@message1 = @receipt1.notification
|
368
368
|
end
|
369
|
-
|
369
|
+
|
370
370
|
it "should create proper message" do
|
371
371
|
@message1.sender.id.should == @entity1.id
|
372
372
|
@message1.sender.class.should == @entity1.class
|
373
373
|
assert @message1.body.eql?"Body"
|
374
374
|
assert @message1.subject.eql?"Subject"
|
375
375
|
end
|
376
|
-
|
376
|
+
|
377
377
|
it "should create proper mails" do
|
378
378
|
#Sender Mail
|
379
|
-
mail = Receipt.recipient(@entity1).notification(@message1).first
|
379
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message1).first
|
380
380
|
assert mail
|
381
381
|
if mail
|
382
382
|
mail.is_read.should==true
|
383
383
|
mail.trashed.should==false
|
384
384
|
mail.mailbox_type.should=="sentbox"
|
385
|
-
end
|
385
|
+
end
|
386
386
|
#Receiver Mails
|
387
387
|
@recipients.each do |receiver|
|
388
|
-
mail = Receipt.recipient(receiver).notification(@message1).first
|
388
|
+
mail = Mailboxer::Receipt.recipient(receiver).notification(@message1).first
|
389
389
|
assert mail
|
390
390
|
if mail
|
391
391
|
mail.is_read.should==false
|
@@ -394,7 +394,7 @@ describe "Messages And Receipts" do
|
|
394
394
|
end
|
395
395
|
end
|
396
396
|
end
|
397
|
-
|
397
|
+
|
398
398
|
it "should have the correct recipients" do
|
399
399
|
recipients = @message1.recipients
|
400
400
|
recipients.count.should==3
|
@@ -402,9 +402,9 @@ describe "Messages And Receipts" do
|
|
402
402
|
recipients.count(@entity2).should==1
|
403
403
|
recipients.count(@entity3).should==1
|
404
404
|
end
|
405
|
-
|
405
|
+
|
406
406
|
end
|
407
|
-
|
407
|
+
|
408
408
|
describe "message replying to sender" do
|
409
409
|
before do
|
410
410
|
@receipt1 = @entity1.send_message(@recipients,"Body","Subject")
|
@@ -412,38 +412,38 @@ describe "Messages And Receipts" do
|
|
412
412
|
@message1 = @receipt1.notification
|
413
413
|
@message2 = @receipt2.notification
|
414
414
|
end
|
415
|
-
|
415
|
+
|
416
416
|
it "should create proper message" do
|
417
417
|
@message2.sender.id.should == @entity2.id
|
418
418
|
@message2.sender.class.should == @entity2.class
|
419
419
|
assert @message2.body.eql?"Reply body"
|
420
420
|
assert @message2.subject.eql?"RE: Subject"
|
421
421
|
end
|
422
|
-
|
422
|
+
|
423
423
|
it "should create proper mails" do
|
424
424
|
#Sender Mail
|
425
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
425
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
426
426
|
assert mail
|
427
427
|
if mail
|
428
428
|
mail.is_read.should==true
|
429
429
|
mail.trashed.should==false
|
430
430
|
mail.mailbox_type.should=="sentbox"
|
431
|
-
end
|
431
|
+
end
|
432
432
|
#Receiver Mail
|
433
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
433
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
434
434
|
assert mail
|
435
435
|
if mail
|
436
436
|
mail.is_read.should==false
|
437
437
|
mail.trashed.should==false
|
438
438
|
mail.mailbox_type.should=="inbox"
|
439
439
|
end
|
440
|
-
|
440
|
+
|
441
441
|
#No Receiver, No Mail
|
442
|
-
mail = Receipt.recipient(@entity3).notification(@message2).first
|
442
|
+
mail = Mailboxer::Receipt.recipient(@entity3).notification(@message2).first
|
443
443
|
assert mail.nil?
|
444
|
-
|
444
|
+
|
445
445
|
end
|
446
|
-
|
446
|
+
|
447
447
|
it "should have the correct recipients" do
|
448
448
|
recipients = @message2.recipients
|
449
449
|
recipients.count.should==2
|
@@ -451,12 +451,12 @@ describe "Messages And Receipts" do
|
|
451
451
|
recipients.count(@entity2).should==1
|
452
452
|
recipients.count(@entity3).should==0
|
453
453
|
end
|
454
|
-
|
454
|
+
|
455
455
|
it "should be associated to the same conversation" do
|
456
|
-
@message1.conversation.id.should==@message2.conversation.id
|
457
|
-
end
|
456
|
+
@message1.conversation.id.should==@message2.conversation.id
|
457
|
+
end
|
458
458
|
end
|
459
|
-
|
459
|
+
|
460
460
|
describe "message replying to all" do
|
461
461
|
before do
|
462
462
|
@receipt1 = @entity1.send_message(@recipients,"Body","Subject")
|
@@ -466,28 +466,28 @@ describe "Messages And Receipts" do
|
|
466
466
|
@recipients2 = Array.new
|
467
467
|
@recipients2 << @entity1
|
468
468
|
@recipients2 << @entity3
|
469
|
-
|
469
|
+
|
470
470
|
end
|
471
|
-
|
471
|
+
|
472
472
|
it "should create proper message" do
|
473
473
|
@message2.sender.id.should == @entity2.id
|
474
474
|
@message2.sender.class.should == @entity2.class
|
475
475
|
assert @message2.body.eql?"Reply body"
|
476
476
|
assert @message2.subject.eql?"RE: Subject"
|
477
477
|
end
|
478
|
-
|
478
|
+
|
479
479
|
it "should create proper mails" do
|
480
480
|
#Sender Mail
|
481
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
481
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
482
482
|
assert mail
|
483
483
|
if mail
|
484
484
|
mail.is_read.should==true
|
485
485
|
mail.trashed.should==false
|
486
486
|
mail.mailbox_type.should=="sentbox"
|
487
|
-
end
|
487
|
+
end
|
488
488
|
#Receiver Mails
|
489
489
|
@recipients2.each do |receiver|
|
490
|
-
mail = Receipt.recipient(receiver).notification(@message2).first
|
490
|
+
mail = Mailboxer::Receipt.recipient(receiver).notification(@message2).first
|
491
491
|
assert mail
|
492
492
|
if mail
|
493
493
|
mail.is_read.should==false
|
@@ -496,7 +496,7 @@ describe "Messages And Receipts" do
|
|
496
496
|
end
|
497
497
|
end
|
498
498
|
end
|
499
|
-
|
499
|
+
|
500
500
|
it "should have the correct recipients" do
|
501
501
|
recipients = @message2.recipients
|
502
502
|
recipients.count.should==3
|
@@ -504,34 +504,34 @@ describe "Messages And Receipts" do
|
|
504
504
|
recipients.count(@entity2).should==1
|
505
505
|
recipients.count(@entity3).should==1
|
506
506
|
end
|
507
|
-
|
507
|
+
|
508
508
|
it "should be associated to the same conversation" do
|
509
|
-
@message1.conversation.id.should==@message2.conversation.id
|
510
|
-
end
|
509
|
+
@message1.conversation.id.should==@message2.conversation.id
|
510
|
+
end
|
511
511
|
end
|
512
512
|
describe "message replying to conversation (TODO)" do
|
513
513
|
before do
|
514
|
-
#TODO
|
514
|
+
#TODO
|
515
515
|
end
|
516
|
-
|
516
|
+
|
517
517
|
it "should create proper message" do
|
518
|
-
#TODO
|
518
|
+
#TODO
|
519
519
|
end
|
520
|
-
|
520
|
+
|
521
521
|
it "should create proper mails" do
|
522
|
-
#TODO
|
522
|
+
#TODO
|
523
523
|
end
|
524
|
-
|
524
|
+
|
525
525
|
it "should have the correct recipients" do
|
526
|
-
#TODO
|
526
|
+
#TODO
|
527
527
|
end
|
528
|
-
|
528
|
+
|
529
529
|
it "should be associated to the same conversation" do
|
530
|
-
#TODO
|
531
|
-
end
|
530
|
+
#TODO
|
531
|
+
end
|
532
532
|
end
|
533
533
|
end
|
534
|
-
|
534
|
+
|
535
535
|
describe "three different entities" do
|
536
536
|
before do
|
537
537
|
@entity1 = FactoryGirl.create(:user)
|
@@ -541,33 +541,33 @@ describe "Messages And Receipts" do
|
|
541
541
|
@recipients << @entity2
|
542
542
|
@recipients << @entity3
|
543
543
|
end
|
544
|
-
|
545
|
-
describe "message sending" do
|
546
|
-
|
544
|
+
|
545
|
+
describe "message sending" do
|
546
|
+
|
547
547
|
before do
|
548
548
|
@receipt1 = @entity1.send_message(@recipients,"Body","Subject")
|
549
549
|
@message1 = @receipt1.notification
|
550
550
|
end
|
551
|
-
|
551
|
+
|
552
552
|
it "should create proper message" do
|
553
553
|
@message1.sender.id.should == @entity1.id
|
554
554
|
@message1.sender.class.should == @entity1.class
|
555
555
|
assert @message1.body.eql?"Body"
|
556
556
|
assert @message1.subject.eql?"Subject"
|
557
557
|
end
|
558
|
-
|
558
|
+
|
559
559
|
it "should create proper mails" do
|
560
560
|
#Sender Mail
|
561
|
-
mail = Receipt.recipient(@entity1).notification(@message1).first
|
561
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message1).first
|
562
562
|
assert mail
|
563
563
|
if mail
|
564
564
|
mail.is_read.should==true
|
565
565
|
mail.trashed.should==false
|
566
566
|
mail.mailbox_type.should=="sentbox"
|
567
|
-
end
|
567
|
+
end
|
568
568
|
#Receiver Mails
|
569
569
|
@recipients.each do |receiver|
|
570
|
-
mail = Receipt.recipient(receiver).notification(@message1).first
|
570
|
+
mail = Mailboxer::Receipt.recipient(receiver).notification(@message1).first
|
571
571
|
assert mail
|
572
572
|
if mail
|
573
573
|
mail.is_read.should==false
|
@@ -576,7 +576,7 @@ describe "Messages And Receipts" do
|
|
576
576
|
end
|
577
577
|
end
|
578
578
|
end
|
579
|
-
|
579
|
+
|
580
580
|
it "should have the correct recipients" do
|
581
581
|
recipients = @message1.recipients
|
582
582
|
recipients.count.should==3
|
@@ -584,9 +584,9 @@ describe "Messages And Receipts" do
|
|
584
584
|
recipients.count(@entity2).should==1
|
585
585
|
recipients.count(@entity3).should==1
|
586
586
|
end
|
587
|
-
|
587
|
+
|
588
588
|
end
|
589
|
-
|
589
|
+
|
590
590
|
describe "message replying to sender" do
|
591
591
|
before do
|
592
592
|
@receipt1 = @entity1.send_message(@recipients,"Body","Subject")
|
@@ -594,38 +594,38 @@ describe "Messages And Receipts" do
|
|
594
594
|
@message1 = @receipt1.notification
|
595
595
|
@message2 = @receipt2.notification
|
596
596
|
end
|
597
|
-
|
597
|
+
|
598
598
|
it "should create proper message" do
|
599
599
|
@message2.sender.id.should == @entity2.id
|
600
600
|
@message2.sender.class.should == @entity2.class
|
601
601
|
assert @message2.body.eql?"Reply body"
|
602
602
|
assert @message2.subject.eql?"RE: Subject"
|
603
603
|
end
|
604
|
-
|
604
|
+
|
605
605
|
it "should create proper mails" do
|
606
606
|
#Sender Mail
|
607
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
607
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
608
608
|
assert mail
|
609
609
|
if mail
|
610
610
|
mail.is_read.should==true
|
611
611
|
mail.trashed.should==false
|
612
612
|
mail.mailbox_type.should=="sentbox"
|
613
|
-
end
|
613
|
+
end
|
614
614
|
#Receiver Mail
|
615
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
615
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
616
616
|
assert mail
|
617
617
|
if mail
|
618
618
|
mail.is_read.should==false
|
619
619
|
mail.trashed.should==false
|
620
620
|
mail.mailbox_type.should=="inbox"
|
621
621
|
end
|
622
|
-
|
622
|
+
|
623
623
|
#No Receiver, No Mail
|
624
|
-
mail = Receipt.recipient(@entity3).notification(@message2).first
|
624
|
+
mail = Mailboxer::Receipt.recipient(@entity3).notification(@message2).first
|
625
625
|
assert mail.nil?
|
626
|
-
|
626
|
+
|
627
627
|
end
|
628
|
-
|
628
|
+
|
629
629
|
it "should have the correct recipients" do
|
630
630
|
recipients = @message2.recipients
|
631
631
|
recipients.count.should==2
|
@@ -633,12 +633,12 @@ describe "Messages And Receipts" do
|
|
633
633
|
recipients.count(@entity2).should==1
|
634
634
|
recipients.count(@entity3).should==0
|
635
635
|
end
|
636
|
-
|
636
|
+
|
637
637
|
it "should be associated to the same conversation" do
|
638
|
-
@message1.conversation.id.should==@message2.conversation.id
|
639
|
-
end
|
638
|
+
@message1.conversation.id.should==@message2.conversation.id
|
639
|
+
end
|
640
640
|
end
|
641
|
-
|
641
|
+
|
642
642
|
describe "message replying to all" do
|
643
643
|
before do
|
644
644
|
@receipt1 = @entity1.send_message(@recipients,"Body","Subject")
|
@@ -648,28 +648,28 @@ describe "Messages And Receipts" do
|
|
648
648
|
@recipients2 = Array.new
|
649
649
|
@recipients2 << @entity1
|
650
650
|
@recipients2 << @entity3
|
651
|
-
|
651
|
+
|
652
652
|
end
|
653
|
-
|
653
|
+
|
654
654
|
it "should create proper message" do
|
655
655
|
@message2.sender.id.should == @entity2.id
|
656
656
|
@message2.sender.class.should == @entity2.class
|
657
657
|
assert @message2.body.eql?"Reply body"
|
658
658
|
assert @message2.subject.eql?"RE: Subject"
|
659
659
|
end
|
660
|
-
|
660
|
+
|
661
661
|
it "should create proper mails" do
|
662
662
|
#Sender Mail
|
663
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
663
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
664
664
|
assert mail
|
665
665
|
if mail
|
666
666
|
mail.is_read.should==true
|
667
667
|
mail.trashed.should==false
|
668
668
|
mail.mailbox_type.should=="sentbox"
|
669
|
-
end
|
669
|
+
end
|
670
670
|
#Receiver Mails
|
671
671
|
@recipients2.each do |receiver|
|
672
|
-
mail = Receipt.recipient(receiver).notification(@message2).first
|
672
|
+
mail = Mailboxer::Receipt.recipient(receiver).notification(@message2).first
|
673
673
|
assert mail
|
674
674
|
if mail
|
675
675
|
mail.is_read.should==false
|
@@ -678,7 +678,7 @@ describe "Messages And Receipts" do
|
|
678
678
|
end
|
679
679
|
end
|
680
680
|
end
|
681
|
-
|
681
|
+
|
682
682
|
it "should have the correct recipients" do
|
683
683
|
recipients = @message2.recipients
|
684
684
|
recipients.count.should==3
|
@@ -686,32 +686,32 @@ describe "Messages And Receipts" do
|
|
686
686
|
recipients.count(@entity2).should==1
|
687
687
|
recipients.count(@entity3).should==1
|
688
688
|
end
|
689
|
-
|
689
|
+
|
690
690
|
it "should be associated to the same conversation" do
|
691
|
-
@message1.conversation.id.should==@message2.conversation.id
|
692
|
-
end
|
691
|
+
@message1.conversation.id.should==@message2.conversation.id
|
692
|
+
end
|
693
693
|
end
|
694
|
-
|
694
|
+
|
695
695
|
describe "message replying to conversation (TODO)" do
|
696
696
|
before do
|
697
|
-
#TODO
|
697
|
+
#TODO
|
698
698
|
end
|
699
|
-
|
699
|
+
|
700
700
|
it "should create proper message" do
|
701
|
-
#TODO
|
701
|
+
#TODO
|
702
702
|
end
|
703
|
-
|
703
|
+
|
704
704
|
it "should create proper mails" do
|
705
|
-
#TODO
|
705
|
+
#TODO
|
706
706
|
end
|
707
|
-
|
707
|
+
|
708
708
|
it "should have the correct recipients" do
|
709
|
-
#TODO
|
709
|
+
#TODO
|
710
710
|
end
|
711
|
-
|
711
|
+
|
712
712
|
it "should be associated to the same conversation" do
|
713
|
-
#TODO
|
714
|
-
end
|
713
|
+
#TODO
|
714
|
+
end
|
715
715
|
end
|
716
716
|
end
|
717
717
|
|
@@ -720,32 +720,32 @@ describe "Messages And Receipts" do
|
|
720
720
|
@entity1 = FactoryGirl.create(:user)
|
721
721
|
@entity2 = FactoryGirl.create(:user)
|
722
722
|
end
|
723
|
-
|
724
|
-
describe "message sending" do
|
725
|
-
|
723
|
+
|
724
|
+
describe "message sending" do
|
725
|
+
|
726
726
|
before do
|
727
727
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
728
728
|
@message1 = @receipt1.notification
|
729
729
|
end
|
730
|
-
|
730
|
+
|
731
731
|
it "should create proper message" do
|
732
732
|
@message1.sender.id.should == @entity1.id
|
733
733
|
@message1.sender.class.should == @entity1.class
|
734
734
|
assert @message1.body.eql?"Body"
|
735
735
|
assert @message1.subject.eql?"Subject"
|
736
736
|
end
|
737
|
-
|
737
|
+
|
738
738
|
it "should create proper mails" do
|
739
739
|
#Sender Mail
|
740
|
-
mail = Receipt.recipient(@entity1).notification(@message1).first
|
740
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message1).first
|
741
741
|
assert mail
|
742
742
|
if mail
|
743
743
|
mail.is_read.should==true
|
744
744
|
mail.trashed.should==false
|
745
745
|
mail.mailbox_type.should=="sentbox"
|
746
|
-
end
|
746
|
+
end
|
747
747
|
#Receiver Mail
|
748
|
-
mail = Receipt.recipient(@entity2).notification(@message1).first
|
748
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message1).first
|
749
749
|
assert mail
|
750
750
|
if mail
|
751
751
|
mail.is_read.should==false
|
@@ -753,16 +753,16 @@ describe "Messages And Receipts" do
|
|
753
753
|
mail.mailbox_type.should=="inbox"
|
754
754
|
end
|
755
755
|
end
|
756
|
-
|
756
|
+
|
757
757
|
it "should have the correct recipients" do
|
758
758
|
recipients = @message1.recipients
|
759
759
|
recipients.count.should==2
|
760
760
|
recipients.count(@entity1).should==1
|
761
761
|
recipients.count(@entity2).should==1
|
762
762
|
end
|
763
|
-
|
763
|
+
|
764
764
|
end
|
765
|
-
|
765
|
+
|
766
766
|
describe "message replying to sender" do
|
767
767
|
before do
|
768
768
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
@@ -770,25 +770,25 @@ describe "Messages And Receipts" do
|
|
770
770
|
@message1 = @receipt1.notification
|
771
771
|
@message2 = @receipt2.notification
|
772
772
|
end
|
773
|
-
|
773
|
+
|
774
774
|
it "should create proper message" do
|
775
775
|
@message2.sender.id.should == @entity2.id
|
776
776
|
@message2.sender.class.should == @entity2.class
|
777
777
|
assert @message2.body.eql?"Reply body"
|
778
778
|
assert @message2.subject.eql?"RE: Subject"
|
779
779
|
end
|
780
|
-
|
780
|
+
|
781
781
|
it "should create proper mails" do
|
782
782
|
#Sender Mail
|
783
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
783
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
784
784
|
assert mail
|
785
785
|
if mail
|
786
786
|
mail.is_read.should==true
|
787
787
|
mail.trashed.should==false
|
788
788
|
mail.mailbox_type.should=="sentbox"
|
789
|
-
end
|
789
|
+
end
|
790
790
|
#Receiver Mail
|
791
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
791
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
792
792
|
assert mail
|
793
793
|
if mail
|
794
794
|
mail.is_read.should==false
|
@@ -796,19 +796,19 @@ describe "Messages And Receipts" do
|
|
796
796
|
mail.mailbox_type.should=="inbox"
|
797
797
|
end
|
798
798
|
end
|
799
|
-
|
799
|
+
|
800
800
|
it "should have the correct recipients" do
|
801
801
|
recipients = @message2.recipients
|
802
802
|
recipients.count.should==2
|
803
803
|
recipients.count(@entity1).should==1
|
804
804
|
recipients.count(@entity2).should==1
|
805
805
|
end
|
806
|
-
|
806
|
+
|
807
807
|
it "should be associated to the same conversation" do
|
808
|
-
@message1.conversation.id.should==@message2.conversation.id
|
809
|
-
end
|
808
|
+
@message1.conversation.id.should==@message2.conversation.id
|
809
|
+
end
|
810
810
|
end
|
811
|
-
|
811
|
+
|
812
812
|
describe "message replying to all" do
|
813
813
|
before do
|
814
814
|
@receipt1 = @entity1.send_message(@entity2,"Body","Subject")
|
@@ -816,25 +816,25 @@ describe "Messages And Receipts" do
|
|
816
816
|
@message1 = @receipt1.notification
|
817
817
|
@message2 = @receipt2.notification
|
818
818
|
end
|
819
|
-
|
819
|
+
|
820
820
|
it "should create proper message" do
|
821
821
|
@message2.sender.id.should == @entity2.id
|
822
822
|
@message2.sender.class.should == @entity2.class
|
823
823
|
assert @message2.body.eql?"Reply body"
|
824
824
|
assert @message2.subject.eql?"RE: Subject"
|
825
825
|
end
|
826
|
-
|
826
|
+
|
827
827
|
it "should create proper mails" do
|
828
828
|
#Sender Mail
|
829
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
829
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
830
830
|
assert mail
|
831
831
|
if mail
|
832
832
|
mail.is_read.should==true
|
833
833
|
mail.trashed.should==false
|
834
834
|
mail.mailbox_type.should=="sentbox"
|
835
|
-
end
|
835
|
+
end
|
836
836
|
#Receiver Mail
|
837
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
837
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
838
838
|
assert mail
|
839
839
|
if mail
|
840
840
|
mail.is_read.should==false
|
@@ -842,17 +842,17 @@ describe "Messages And Receipts" do
|
|
842
842
|
mail.mailbox_type.should=="inbox"
|
843
843
|
end
|
844
844
|
end
|
845
|
-
|
845
|
+
|
846
846
|
it "should have the correct recipients" do
|
847
847
|
recipients = @message2.recipients
|
848
848
|
recipients.count.should==2
|
849
849
|
recipients.count(@entity1).should==1
|
850
850
|
recipients.count(@entity2).should==1
|
851
851
|
end
|
852
|
-
|
852
|
+
|
853
853
|
it "should be associated to the same conversation" do
|
854
|
-
@message1.conversation.id.should==@message2.conversation.id
|
855
|
-
end
|
854
|
+
@message1.conversation.id.should==@message2.conversation.id
|
855
|
+
end
|
856
856
|
end
|
857
857
|
describe "message replying to conversation" do
|
858
858
|
before do
|
@@ -861,25 +861,25 @@ describe "Messages And Receipts" do
|
|
861
861
|
@message1 = @receipt1.notification
|
862
862
|
@message2 = @receipt2.notification
|
863
863
|
end
|
864
|
-
|
864
|
+
|
865
865
|
it "should create proper message" do
|
866
866
|
@message2.sender.id.should == @entity2.id
|
867
867
|
@message2.sender.class.should == @entity2.class
|
868
868
|
assert @message2.body.eql?"Reply body"
|
869
869
|
assert @message2.subject.eql?"RE: Subject"
|
870
870
|
end
|
871
|
-
|
871
|
+
|
872
872
|
it "should create proper mails" do
|
873
873
|
#Sender Mail
|
874
|
-
mail = Receipt.recipient(@entity2).notification(@message2).first
|
874
|
+
mail = Mailboxer::Receipt.recipient(@entity2).notification(@message2).first
|
875
875
|
assert mail
|
876
876
|
if mail
|
877
877
|
mail.is_read.should==true
|
878
878
|
mail.trashed.should==false
|
879
879
|
mail.mailbox_type.should=="sentbox"
|
880
|
-
end
|
880
|
+
end
|
881
881
|
#Receiver Mail
|
882
|
-
mail = Receipt.recipient(@entity1).notification(@message2).first
|
882
|
+
mail = Mailboxer::Receipt.recipient(@entity1).notification(@message2).first
|
883
883
|
assert mail
|
884
884
|
if mail
|
885
885
|
mail.is_read.should==false
|
@@ -887,17 +887,17 @@ describe "Messages And Receipts" do
|
|
887
887
|
mail.mailbox_type.should=="inbox"
|
888
888
|
end
|
889
889
|
end
|
890
|
-
|
890
|
+
|
891
891
|
it "should have the correct recipients" do
|
892
892
|
recipients = @message2.recipients
|
893
893
|
recipients.count.should==2
|
894
894
|
recipients.count(@entity1).should==1
|
895
895
|
recipients.count(@entity2).should==1
|
896
896
|
end
|
897
|
-
|
897
|
+
|
898
898
|
it "should be associated to the same conversation" do
|
899
|
-
@message1.conversation.id.should==@message2.conversation.id
|
900
|
-
end
|
899
|
+
@message1.conversation.id.should==@message2.conversation.id
|
900
|
+
end
|
901
901
|
end
|
902
902
|
end
|
903
903
|
end
|