mailboxer 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "mailboxer"
3
- s.version = "0.7.0"
3
+ s.version = "0.8.0"
4
4
  s.authors = ["Eduardo Casanova Cuesta"]
5
5
  s.summary = "Messaging system for rails apps."
6
6
  s.description = "A Rails engine that allows any model to act as messageable, adding the ability to exchange messages " +
@@ -27,11 +27,12 @@ Gem::Specification.new do |s|
27
27
  # Specs
28
28
  s.add_development_dependency('rspec-rails', '>= 2.6.1')
29
29
  # Fixtures
30
- if RUBY_VERSION >= '1.9.2'
31
- s.add_development_dependency('factory_girl', '>= 3.0.0')
32
- else
33
- s.add_development_dependency('factory_girl', '~> 2.6.0')
34
- end
30
+ #if RUBY_VERSION >= '1.9.2'
31
+ # s.add_development_dependency('factory_girl', '>= 3.0.0')
32
+ #else
33
+ #s.add_development_dependency('factory_girl', '~> 2.6.0')
34
+ #end
35
+ s.add_development_dependency('factory_girl', '~> 2.6.0')
35
36
  # Population
36
37
  s.add_development_dependency('forgery', '>= 0.3.6')
37
38
  # Integration testing
@@ -0,0 +1,9 @@
1
+ class RenameReceiptsRead < ActiveRecord::Migration
2
+ def up
3
+ rename_column :receipts, :read, :is_read
4
+ end
5
+
6
+ def down
7
+ rename_column :receipts, :is_read, :read
8
+ end
9
+ end
@@ -54,7 +54,7 @@ ActiveRecord::Schema.define(:version => 20120305103203) do
54
54
  t.integer "receiver_id"
55
55
  t.string "receiver_type"
56
56
  t.integer "notification_id", :null => false
57
- t.boolean "read", :default => false
57
+ t.boolean "is_read", :default => false
58
58
  t.boolean "trashed", :default => false
59
59
  t.boolean "deleted", :default => false
60
60
  t.string "mailbox_type", :limit => 25
@@ -27,7 +27,7 @@ describe "Messages And Receipts" do
27
27
  mail = Receipt.recipient(@entity1).notification(@message1).first
28
28
  assert mail
29
29
  if mail
30
- mail.read.should==true
30
+ mail.is_read.should==true
31
31
  mail.trashed.should==false
32
32
  mail.mailbox_type.should=="sentbox"
33
33
  end
@@ -35,7 +35,7 @@ describe "Messages And Receipts" do
35
35
  mail = Receipt.recipient(@entity2).notification(@message1).first
36
36
  assert mail
37
37
  if mail
38
- mail.read.should==false
38
+ mail.is_read.should==false
39
39
  mail.trashed.should==false
40
40
  mail.mailbox_type.should=="inbox"
41
41
  end
@@ -70,7 +70,7 @@ describe "Messages And Receipts" do
70
70
  mail = Receipt.recipient(@entity2).notification(@message2).first
71
71
  assert mail
72
72
  if mail
73
- mail.read.should==true
73
+ mail.is_read.should==true
74
74
  mail.trashed.should==false
75
75
  mail.mailbox_type.should=="sentbox"
76
76
  end
@@ -78,7 +78,7 @@ describe "Messages And Receipts" do
78
78
  mail = Receipt.recipient(@entity1).notification(@message2).first
79
79
  assert mail
80
80
  if mail
81
- mail.read.should==false
81
+ mail.is_read.should==false
82
82
  mail.trashed.should==false
83
83
  mail.mailbox_type.should=="inbox"
84
84
  end
@@ -116,7 +116,7 @@ describe "Messages And Receipts" do
116
116
  mail = Receipt.recipient(@entity2).notification(@message2).first
117
117
  assert mail
118
118
  if mail
119
- mail.read.should==true
119
+ mail.is_read.should==true
120
120
  mail.trashed.should==false
121
121
  mail.mailbox_type.should=="sentbox"
122
122
  end
@@ -124,7 +124,7 @@ describe "Messages And Receipts" do
124
124
  mail = Receipt.recipient(@entity1).notification(@message2).first
125
125
  assert mail
126
126
  if mail
127
- mail.read.should==false
127
+ mail.is_read.should==false
128
128
  mail.trashed.should==false
129
129
  mail.mailbox_type.should=="inbox"
130
130
  end
@@ -161,7 +161,7 @@ describe "Messages And Receipts" do
161
161
  mail = Receipt.recipient(@entity2).notification(@message2).first
162
162
  assert mail
163
163
  if mail
164
- mail.read.should==true
164
+ mail.is_read.should==true
165
165
  mail.trashed.should==false
166
166
  mail.mailbox_type.should=="sentbox"
167
167
  end
@@ -169,7 +169,7 @@ describe "Messages And Receipts" do
169
169
  mail = Receipt.recipient(@entity1).notification(@message2).first
170
170
  assert mail
171
171
  if mail
172
- mail.read.should==false
172
+ mail.is_read.should==false
173
173
  mail.trashed.should==false
174
174
  mail.mailbox_type.should=="inbox"
175
175
  end
@@ -213,7 +213,7 @@ describe "Messages And Receipts" do
213
213
  mail = Receipt.recipient(@entity1).notification(@message1).first
214
214
  assert mail
215
215
  if mail
216
- mail.read.should==true
216
+ mail.is_read.should==true
217
217
  mail.trashed.should==false
218
218
  mail.mailbox_type.should=="sentbox"
219
219
  end
@@ -221,7 +221,7 @@ describe "Messages And Receipts" do
221
221
  mail = Receipt.recipient(@entity2).notification(@message1).first
222
222
  assert mail
223
223
  if mail
224
- mail.read.should==false
224
+ mail.is_read.should==false
225
225
  mail.trashed.should==false
226
226
  mail.mailbox_type.should=="inbox"
227
227
  end
@@ -256,7 +256,7 @@ describe "Messages And Receipts" do
256
256
  mail = Receipt.recipient(@entity2).notification(@message2).first
257
257
  assert mail
258
258
  if mail
259
- mail.read.should==true
259
+ mail.is_read.should==true
260
260
  mail.trashed.should==false
261
261
  mail.mailbox_type.should=="sentbox"
262
262
  end
@@ -264,7 +264,7 @@ describe "Messages And Receipts" do
264
264
  mail = Receipt.recipient(@entity1).notification(@message2).first
265
265
  assert mail
266
266
  if mail
267
- mail.read.should==false
267
+ mail.is_read.should==false
268
268
  mail.trashed.should==false
269
269
  mail.mailbox_type.should=="inbox"
270
270
  end
@@ -302,7 +302,7 @@ describe "Messages And Receipts" do
302
302
  mail = Receipt.recipient(@entity2).notification(@message2).first
303
303
  assert mail
304
304
  if mail
305
- mail.read.should==true
305
+ mail.is_read.should==true
306
306
  mail.trashed.should==false
307
307
  mail.mailbox_type.should=="sentbox"
308
308
  end
@@ -310,7 +310,7 @@ describe "Messages And Receipts" do
310
310
  mail = Receipt.recipient(@entity1).notification(@message2).first
311
311
  assert mail
312
312
  if mail
313
- mail.read.should==false
313
+ mail.is_read.should==false
314
314
  mail.trashed.should==false
315
315
  mail.mailbox_type.should=="inbox"
316
316
  end
@@ -379,7 +379,7 @@ describe "Messages And Receipts" do
379
379
  mail = Receipt.recipient(@entity1).notification(@message1).first
380
380
  assert mail
381
381
  if mail
382
- mail.read.should==true
382
+ mail.is_read.should==true
383
383
  mail.trashed.should==false
384
384
  mail.mailbox_type.should=="sentbox"
385
385
  end
@@ -388,7 +388,7 @@ describe "Messages And Receipts" do
388
388
  mail = Receipt.recipient(receiver).notification(@message1).first
389
389
  assert mail
390
390
  if mail
391
- mail.read.should==false
391
+ mail.is_read.should==false
392
392
  mail.trashed.should==false
393
393
  mail.mailbox_type.should=="inbox"
394
394
  end
@@ -425,7 +425,7 @@ describe "Messages And Receipts" do
425
425
  mail = Receipt.recipient(@entity2).notification(@message2).first
426
426
  assert mail
427
427
  if mail
428
- mail.read.should==true
428
+ mail.is_read.should==true
429
429
  mail.trashed.should==false
430
430
  mail.mailbox_type.should=="sentbox"
431
431
  end
@@ -433,7 +433,7 @@ describe "Messages And Receipts" do
433
433
  mail = Receipt.recipient(@entity1).notification(@message2).first
434
434
  assert mail
435
435
  if mail
436
- mail.read.should==false
436
+ mail.is_read.should==false
437
437
  mail.trashed.should==false
438
438
  mail.mailbox_type.should=="inbox"
439
439
  end
@@ -481,7 +481,7 @@ describe "Messages And Receipts" do
481
481
  mail = Receipt.recipient(@entity2).notification(@message2).first
482
482
  assert mail
483
483
  if mail
484
- mail.read.should==true
484
+ mail.is_read.should==true
485
485
  mail.trashed.should==false
486
486
  mail.mailbox_type.should=="sentbox"
487
487
  end
@@ -490,7 +490,7 @@ describe "Messages And Receipts" do
490
490
  mail = Receipt.recipient(receiver).notification(@message2).first
491
491
  assert mail
492
492
  if mail
493
- mail.read.should==false
493
+ mail.is_read.should==false
494
494
  mail.trashed.should==false
495
495
  mail.mailbox_type.should=="inbox"
496
496
  end
@@ -561,7 +561,7 @@ describe "Messages And Receipts" do
561
561
  mail = Receipt.recipient(@entity1).notification(@message1).first
562
562
  assert mail
563
563
  if mail
564
- mail.read.should==true
564
+ mail.is_read.should==true
565
565
  mail.trashed.should==false
566
566
  mail.mailbox_type.should=="sentbox"
567
567
  end
@@ -570,7 +570,7 @@ describe "Messages And Receipts" do
570
570
  mail = Receipt.recipient(receiver).notification(@message1).first
571
571
  assert mail
572
572
  if mail
573
- mail.read.should==false
573
+ mail.is_read.should==false
574
574
  mail.trashed.should==false
575
575
  mail.mailbox_type.should=="inbox"
576
576
  end
@@ -607,7 +607,7 @@ describe "Messages And Receipts" do
607
607
  mail = Receipt.recipient(@entity2).notification(@message2).first
608
608
  assert mail
609
609
  if mail
610
- mail.read.should==true
610
+ mail.is_read.should==true
611
611
  mail.trashed.should==false
612
612
  mail.mailbox_type.should=="sentbox"
613
613
  end
@@ -615,7 +615,7 @@ describe "Messages And Receipts" do
615
615
  mail = Receipt.recipient(@entity1).notification(@message2).first
616
616
  assert mail
617
617
  if mail
618
- mail.read.should==false
618
+ mail.is_read.should==false
619
619
  mail.trashed.should==false
620
620
  mail.mailbox_type.should=="inbox"
621
621
  end
@@ -663,7 +663,7 @@ describe "Messages And Receipts" do
663
663
  mail = Receipt.recipient(@entity2).notification(@message2).first
664
664
  assert mail
665
665
  if mail
666
- mail.read.should==true
666
+ mail.is_read.should==true
667
667
  mail.trashed.should==false
668
668
  mail.mailbox_type.should=="sentbox"
669
669
  end
@@ -672,7 +672,7 @@ describe "Messages And Receipts" do
672
672
  mail = Receipt.recipient(receiver).notification(@message2).first
673
673
  assert mail
674
674
  if mail
675
- mail.read.should==false
675
+ mail.is_read.should==false
676
676
  mail.trashed.should==false
677
677
  mail.mailbox_type.should=="inbox"
678
678
  end
@@ -29,32 +29,32 @@ describe "Mailboxer::Models::Messageable through User" do
29
29
 
30
30
  it "should be able to unread an owned Receipt (mark as unread)" do
31
31
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
32
- @receipt.read.should==true
33
- @entity1.unread(@receipt)
34
- @receipt.read.should==false
32
+ @receipt.is_read.should==true
33
+ @entity1.mark_as_unread(@receipt)
34
+ @receipt.is_read.should==false
35
35
  end
36
36
 
37
37
  it "should be able to read an owned Receipt (mark as read)" do
38
38
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
39
- @receipt.read.should==true
40
- @entity1.unread(@receipt)
41
- @entity1.read(@receipt)
42
- @receipt.read.should==true
39
+ @receipt.is_read.should==true
40
+ @entity1.mark_as_unread(@receipt)
41
+ @entity1.mark_as_read(@receipt)
42
+ @receipt.is_read.should==true
43
43
  end
44
44
 
45
45
  it "should not be able to unread a not owned Receipt (mark as unread)" do
46
46
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
47
- @receipt.read.should==true
48
- @entity2.unread(@receipt) #Should not change
49
- @receipt.read.should==true
47
+ @receipt.is_read.should==true
48
+ @entity2.mark_as_unread(@receipt) #Should not change
49
+ @receipt.is_read.should==true
50
50
  end
51
51
 
52
52
  it "should not be able to read a not owned Receipt (mark as read)" do
53
53
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
54
- @receipt.read.should==true
55
- @entity1.unread(@receipt) #From read to unread
56
- @entity2.read(@receipt) #Should not change
57
- @receipt.read.should==false
54
+ @receipt.is_read.should==true
55
+ @entity1.mark_as_unread(@receipt) #From read to unread
56
+ @entity2.mark_as_read(@receipt) #Should not change
57
+ @receipt.is_read.should==false
58
58
  end
59
59
 
60
60
  it "should be able to trash an owned Receipt" do
@@ -92,35 +92,35 @@ describe "Mailboxer::Models::Messageable through User" do
92
92
  it "should be able to unread an owned Message (mark as unread)" do
93
93
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
94
94
  @message = @receipt.message
95
- @receipt.read.should==true
96
- @entity1.unread(@message)
97
- @message.receipt_for(@entity1).first.read.should==false
95
+ @receipt.is_read.should==true
96
+ @entity1.mark_as_unread(@message)
97
+ @message.receipt_for(@entity1).first.is_read.should==false
98
98
  end
99
99
 
100
100
  it "should be able to read an owned Message (mark as read)" do
101
101
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
102
102
  @message = @receipt.message
103
- @receipt.read.should==true
104
- @entity1.unread(@message)
105
- @entity1.read(@message)
106
- @message.receipt_for(@entity1).first.read.should==true
103
+ @receipt.is_read.should==true
104
+ @entity1.mark_as_unread(@message)
105
+ @entity1.mark_as_read(@message)
106
+ @message.receipt_for(@entity1).first.is_read.should==true
107
107
  end
108
108
 
109
109
  it "should not be able to unread a not owned Message (mark as unread)" do
110
110
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
111
111
  @message = @receipt.message
112
- @receipt.read.should==true
113
- @entity2.unread(@message) #Should not change
114
- @message.receipt_for(@entity1).first.read.should==true
112
+ @receipt.is_read.should==true
113
+ @entity2.mark_as_unread(@message) #Should not change
114
+ @message.receipt_for(@entity1).first.is_read.should==true
115
115
  end
116
116
 
117
117
  it "should not be able to read a not owned Message (mark as read)" do
118
118
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
119
119
  @message = @receipt.message
120
- @receipt.read.should==true
121
- @entity1.unread(@message) #From read to unread
122
- @entity2.read(@message) #Should not change
123
- @message.receipt_for(@entity1).first.read.should==false
120
+ @receipt.is_read.should==true
121
+ @entity1.mark_as_unread(@message) #From read to unread
122
+ @entity2.mark_as_read(@message) #Should not change
123
+ @message.receipt_for(@entity1).first.is_read.should==false
124
124
  end
125
125
 
126
126
  it "should be able to trash an owned Message" do
@@ -162,35 +162,35 @@ describe "Mailboxer::Models::Messageable through User" do
162
162
  it "should be able to unread an owned Notification (mark as unread)" do
163
163
  @receipt = @entity1.notify("Subject","Body")
164
164
  @notification = @receipt.notification
165
- @receipt.read.should==false
166
- @entity1.read(@notification)
167
- @entity1.unread(@notification)
168
- @notification.receipt_for(@entity1).first.read.should==false
165
+ @receipt.is_read.should==false
166
+ @entity1.mark_as_read(@notification)
167
+ @entity1.mark_as_unread(@notification)
168
+ @notification.receipt_for(@entity1).first.is_read.should==false
169
169
  end
170
170
 
171
171
  it "should be able to read an owned Notification (mark as read)" do
172
172
  @receipt = @entity1.notify("Subject","Body")
173
173
  @notification = @receipt.notification
174
- @receipt.read.should==false
175
- @entity1.read(@notification)
176
- @notification.receipt_for(@entity1).first.read.should==true
174
+ @receipt.is_read.should==false
175
+ @entity1.mark_as_read(@notification)
176
+ @notification.receipt_for(@entity1).first.is_read.should==true
177
177
  end
178
178
 
179
179
  it "should not be able to unread a not owned Notification (mark as unread)" do
180
180
  @receipt = @entity1.notify("Subject","Body")
181
181
  @notification = @receipt.notification
182
- @receipt.read.should==false
183
- @entity1.read(@notification)
184
- @entity2.unread(@notification)
185
- @notification.receipt_for(@entity1).first.read.should==true
182
+ @receipt.is_read.should==false
183
+ @entity1.mark_as_read(@notification)
184
+ @entity2.mark_as_unread(@notification)
185
+ @notification.receipt_for(@entity1).first.is_read.should==true
186
186
  end
187
187
 
188
188
  it "should not be able to read a not owned Notification (mark as read)" do
189
189
  @receipt = @entity1.notify("Subject","Body")
190
190
  @notification = @receipt.notification
191
- @receipt.read.should==false
192
- @entity2.read(@notification)
193
- @notification.receipt_for(@entity1).first.read.should==false
191
+ @receipt.is_read.should==false
192
+ @entity2.mark_as_read(@notification)
193
+ @notification.receipt_for(@entity1).first.is_read.should==false
194
194
  end
195
195
 
196
196
  it "should be able to trash an owned Notification" do
@@ -232,35 +232,35 @@ describe "Mailboxer::Models::Messageable through User" do
232
232
  it "should be able to unread an owned Conversation (mark as unread)" do
233
233
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
234
234
  @conversation = @receipt.conversation
235
- @receipt.read.should==true
236
- @entity1.unread(@conversation)
237
- @conversation.receipts_for(@entity1).first.read.should==false
235
+ @receipt.is_read.should==true
236
+ @entity1.mark_as_unread(@conversation)
237
+ @conversation.receipts_for(@entity1).first.is_read.should==false
238
238
  end
239
239
 
240
240
  it "should be able to read an owned Conversation (mark as read)" do
241
241
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
242
242
  @conversation = @receipt.conversation
243
- @receipt.read.should==true
244
- @entity1.unread(@conversation)
245
- @entity1.read(@conversation)
246
- @conversation.receipts_for(@entity1).first.read.should==true
243
+ @receipt.is_read.should==true
244
+ @entity1.mark_as_unread(@conversation)
245
+ @entity1.mark_as_read(@conversation)
246
+ @conversation.receipts_for(@entity1).first.is_read.should==true
247
247
  end
248
248
 
249
249
  it "should not be able to unread a not owned Conversation (mark as unread)" do
250
250
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
251
251
  @conversation = @receipt.conversation
252
- @receipt.read.should==true
253
- @entity2.unread(@conversation)
254
- @conversation.receipts_for(@entity1).first.read.should==true
252
+ @receipt.is_read.should==true
253
+ @entity2.mark_as_unread(@conversation)
254
+ @conversation.receipts_for(@entity1).first.is_read.should==true
255
255
  end
256
256
 
257
257
  it "should not be able to read a not owned Conversation (mark as read)" do
258
258
  @receipt = @entity1.send_message(@entity2,"Body","Subject")
259
259
  @conversation = @receipt.conversation
260
- @receipt.read.should==true
261
- @entity1.unread(@conversation)
262
- @entity2.read(@conversation)
263
- @conversation.receipts_for(@entity1).first.read.should==false
260
+ @receipt.is_read.should==true
261
+ @entity1.mark_as_unread(@conversation)
262
+ @entity2.mark_as_read(@conversation)
263
+ @conversation.receipts_for(@entity1).first.is_read.should==false
264
264
  end
265
265
 
266
266
  it "should be able to trash an owned Conversation" do