mailboxer 0.9.0 → 0.10.0
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 +7 -0
- data/README.md +10 -1
- data/app/mailers/message_mailer.rb +2 -8
- data/app/mailers/notification_mailer.rb +1 -4
- data/app/models/conversation.rb +3 -0
- data/app/models/mailbox.rb +1 -1
- data/app/models/message.rb +1 -1
- data/app/models/notification.rb +23 -1
- data/app/models/receipt.rb +9 -8
- data/db/migrate/20130305144212_add_global_notification_support.rb +9 -0
- data/lib/generators/mailboxer/templates/initializer.rb +4 -4
- data/lib/generators/mailboxer/views_generator.rb +2 -2
- data/lib/mailboxer/models/messageable.rb +5 -1
- data/mailboxer.gemspec +1 -1
- data/spec/dummy/.gitignore +1 -0
- data/spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb +11 -0
- data/spec/integration/message_and_receipt_spec.rb +2 -2
- data/spec/models/mailbox_spec.rb +2 -2
- data/spec/models/mailboxer_models_messageable_spec.rb +9 -0
- data/spec/models/notification_spec.rb +122 -19
- data/spec/models/receipt_spec.rb +2 -2
- metadata +23 -45
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5c2e21ceea4cdf3d6933952a7039b9739409f830
|
4
|
+
data.tar.gz: f9316933c047181976de3d7eb332a888e70fb8a1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0f4bf22b86ab916878fb334a2392c116936de021233b827683291640ba08455b9b48d50423b39fb4a8a3901488bf70998c75932ae0bcd0951242457531ca973e
|
7
|
+
data.tar.gz: 00cc3ce48cf43ec9e6fc1b1443e31d014df3f97460f7a0854f42219fa6219cf925fbc2fbbfb951588ae5c9bf3cad9964296518f358be13a9d6ae5a3eaebb3e0d
|
data/README.md
CHANGED
@@ -60,7 +60,7 @@ $ rake db:migrate
|
|
60
60
|
|
61
61
|
### Emails
|
62
62
|
|
63
|
-
We are now adding support for sending emails when a Notification or a Message is sent to one
|
63
|
+
We are now adding support for sending emails when a Notification or a Message is sent to one or more recipients. You should modify mailboxer initializer (/config/initializer/mailboxer.rb) to edit this settings.
|
64
64
|
|
65
65
|
```ruby
|
66
66
|
Mailboxer.setup do |config|
|
@@ -262,3 +262,12 @@ If you need a GUI you should take a look a this links:
|
|
262
262
|
* [laserlemon](https://github.com/ging/mailboxer/commits/master?author=laserlemon) (Steve Richert)
|
263
263
|
* [daveworth](https://github.com/ging/mailboxer/commits/master?author=daveworth) (Dave Worth)
|
264
264
|
* [rafaelgg](https://github.com/ging/mailboxer/commits/master?author=rafaelgg) (Rafael Garcia)
|
265
|
+
* [joshblour](https://github.com/ging/mailboxer/commits/master?author=joshblour) (joshblour)
|
266
|
+
* [iamdeuterium](https://github.com/ging/mailboxer/commits/master?author=iamdeuterium) (iamdeuterium)
|
267
|
+
* [daveworth](https://github.com/ging/mailboxer/commits/master?author=daveworth) (Dave Worth)
|
268
|
+
* [parndt](https://github.com/ging/mailboxer/commits/master?author=parndt) (Philip Arndt)
|
269
|
+
* [atd](https://github.com/ging/mailboxer/commits/master?author=atd) (Antonio Tapiador)
|
270
|
+
* [mobilutz](https://github.com/ging/mailboxer/commits/master?author=mobilutz) (Lutz)
|
271
|
+
* [bennick](https://github.com/ging/mailboxer/commits/master?author=bennick) (Ryan Bennick)
|
272
|
+
* [rjst](https://github.com/ging/mailboxer/commits/master?author=rjst) (Ricardo Trindade)
|
273
|
+
* [fabianoalmeida](https://github.com/ging/mailboxer/commits/master?author=fabianoalmeida) (Fabiano Almeida)
|
@@ -19,10 +19,7 @@ class MessageMailer < ActionMailer::Base
|
|
19
19
|
@receiver = receiver
|
20
20
|
subject = message.subject.to_s
|
21
21
|
subject = strip_tags(subject) unless subject.html_safe?
|
22
|
-
mail(:to => receiver.send(Mailboxer.email_method,message), :subject => t('mailboxer.message_mailer.subject_new', :subject => subject))
|
23
|
-
format.text {render __method__}
|
24
|
-
format.html {render __method__}
|
25
|
-
end
|
22
|
+
mail(:to => receiver.send(Mailboxer.email_method,message), :subject => t('mailboxer.message_mailer.subject_new', :subject => subject))
|
26
23
|
end
|
27
24
|
|
28
25
|
#Sends and email for indicating a reply in an already created conversation
|
@@ -31,9 +28,6 @@ class MessageMailer < ActionMailer::Base
|
|
31
28
|
@receiver = receiver
|
32
29
|
subject = message.subject.to_s
|
33
30
|
subject = strip_tags(subject) unless subject.html_safe?
|
34
|
-
mail(:to => receiver.send(Mailboxer.email_method,message), :subject => t('mailboxer.message_mailer.subject_reply', :subject => subject))
|
35
|
-
format.text {render __method__}
|
36
|
-
format.html {render __method__}
|
37
|
-
end
|
31
|
+
mail(:to => receiver.send(Mailboxer.email_method,message), :subject => t('mailboxer.message_mailer.subject_reply', :subject => subject))
|
38
32
|
end
|
39
33
|
end
|
@@ -14,9 +14,6 @@ class NotificationMailer < ActionMailer::Base
|
|
14
14
|
@receiver = receiver
|
15
15
|
subject = notification.subject.to_s
|
16
16
|
subject = strip_tags(subject) unless subject.html_safe?
|
17
|
-
mail(:to => receiver.send(Mailboxer.email_method,notification), :subject => t('mailboxer.notification_mailer.subject', :subject => subject))
|
18
|
-
format.text {render __method__}
|
19
|
-
format.html {render __method__}
|
20
|
-
end
|
17
|
+
mail(:to => receiver.send(Mailboxer.email_method,notification), :subject => t('mailboxer.notification_mailer.subject', :subject => subject))
|
21
18
|
end
|
22
19
|
end
|
data/app/models/conversation.rb
CHANGED
@@ -26,6 +26,9 @@ class Conversation < ActiveRecord::Base
|
|
26
26
|
scope :unread, lambda {|participant|
|
27
27
|
participant(participant).merge(Receipt.is_unread)
|
28
28
|
}
|
29
|
+
scope :not_trash, lambda {|participant|
|
30
|
+
participant(participant).merge(Receipt.not_trash)
|
31
|
+
}
|
29
32
|
|
30
33
|
#Mark the conversation as read for one of the participants
|
31
34
|
def mark_as_read(participant)
|
data/app/models/mailbox.rb
CHANGED
data/app/models/message.rb
CHANGED
data/app/models/notification.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Notification < ActiveRecord::Base
|
2
2
|
attr_accessor :recipients
|
3
|
-
attr_accessible :body, :subject
|
3
|
+
attr_accessible :body, :subject, :global, :expires
|
4
4
|
|
5
5
|
belongs_to :sender, :polymorphic => :true
|
6
6
|
belongs_to :notified_object, :polymorphic => :true
|
@@ -19,6 +19,11 @@ class Notification < ActiveRecord::Base
|
|
19
19
|
scope :unread, lambda {
|
20
20
|
joins(:receipts).where('receipts.is_read' => false)
|
21
21
|
}
|
22
|
+
scope :global, lambda { where(:global => true) }
|
23
|
+
scope :expired, lambda { where("notifications.expires < ?", Time.now) }
|
24
|
+
scope :unexpired, lambda {
|
25
|
+
where("notifications.expires is NULL OR notifications.expires > ?", Time.now)
|
26
|
+
}
|
22
27
|
|
23
28
|
include Concerns::ConfigurableMailer
|
24
29
|
|
@@ -49,6 +54,23 @@ class Notification < ActiveRecord::Base
|
|
49
54
|
end
|
50
55
|
end
|
51
56
|
|
57
|
+
def expired?
|
58
|
+
return self.expires.present? && (self.expires < Time.now)
|
59
|
+
end
|
60
|
+
|
61
|
+
def expire!
|
62
|
+
unless self.expired?
|
63
|
+
self.expire
|
64
|
+
self.save
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def expire
|
69
|
+
unless self.expired?
|
70
|
+
self.expires = Time.now - 1.second
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
52
74
|
#Delivers a Notification. USE NOT RECOMENDED.
|
53
75
|
#Use Mailboxer::Models::Message.notify and Notification.notify_all instead.
|
54
76
|
def deliver(should_clean = true)
|
data/app/models/receipt.rb
CHANGED
@@ -4,26 +4,27 @@ class Receipt < ActiveRecord::Base
|
|
4
4
|
belongs_to :message, :foreign_key => "notification_id"
|
5
5
|
|
6
6
|
validates_presence_of :receiver
|
7
|
+
attr_accessible :trashed, :is_read
|
7
8
|
|
8
9
|
scope :recipient, lambda { |recipient|
|
9
10
|
where(:receiver_id => recipient.id,:receiver_type => recipient.class.base_class.to_s)
|
10
11
|
}
|
11
12
|
#Notifications Scope checks type to be nil, not Notification because of STI behaviour
|
12
13
|
#with the primary class (no type is saved)
|
13
|
-
scope :notifications_receipts, joins(:notification).where('notifications.type' => nil)
|
14
|
-
scope :messages_receipts, joins(:notification).where('notifications.type' => Message.to_s)
|
14
|
+
scope :notifications_receipts, lambda { joins(:notification).where('notifications.type' => nil) }
|
15
|
+
scope :messages_receipts, lambda { joins(:notification).where('notifications.type' => Message.to_s) }
|
15
16
|
scope :notification, lambda { |notification|
|
16
17
|
where(:notification_id => notification.id)
|
17
18
|
}
|
18
19
|
scope :conversation, lambda { |conversation|
|
19
20
|
joins(:message).where('notifications.conversation_id' => conversation.id)
|
20
21
|
}
|
21
|
-
scope :sentbox, where(:mailbox_type => "sentbox")
|
22
|
-
scope :inbox, where(:mailbox_type => "inbox")
|
23
|
-
scope :trash, where(:trashed => true)
|
24
|
-
scope :not_trash, where(:trashed => false)
|
25
|
-
scope :is_read, where(:is_read => true)
|
26
|
-
scope :is_unread, where(:is_read => false)
|
22
|
+
scope :sentbox, lambda { where(:mailbox_type => "sentbox") }
|
23
|
+
scope :inbox, lambda { where(:mailbox_type => "inbox") }
|
24
|
+
scope :trash, lambda { where(:trashed => true) }
|
25
|
+
scope :not_trash, lambda { where(:trashed => false) }
|
26
|
+
scope :is_read, lambda { where(:is_read => true) }
|
27
|
+
scope :is_unread, lambda { where(:is_read => false) }
|
27
28
|
|
28
29
|
after_validation :remove_duplicate_errors
|
29
30
|
class << self
|
@@ -1,17 +1,17 @@
|
|
1
1
|
Mailboxer.setup do |config|
|
2
|
-
|
2
|
+
|
3
3
|
#Configures if you applications uses or no the email sending for Notifications and Messages
|
4
4
|
config.uses_emails = true
|
5
|
-
|
5
|
+
|
6
6
|
#Configures the default from for the email sent for Messages and Notifications of Mailboxer
|
7
7
|
config.default_from = "no-reply@mailboxer.com"
|
8
|
-
|
8
|
+
|
9
9
|
#Configures the methods needed by mailboxer
|
10
10
|
config.email_method = :mailboxer_email
|
11
11
|
config.name_method = :name
|
12
12
|
|
13
13
|
#Configures if you use or not a search engine and wich one are you using
|
14
|
-
#Supported enignes: [:solr,:sphinx]
|
14
|
+
#Supported enignes: [:solr,:sphinx]
|
15
15
|
config.search_enabled = false
|
16
16
|
config.search_engine = :solr
|
17
17
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class Mailboxer::ViewsGenerator < Rails::Generators::Base
|
2
2
|
source_root File.expand_path("../../../../app/views", __FILE__)
|
3
|
-
|
3
|
+
|
4
4
|
desc "Copy Mailboxer views into your app"
|
5
|
-
def copy_views
|
5
|
+
def copy_views
|
6
6
|
directory('message_mailer', 'app/views/message_mailer')
|
7
7
|
directory('notification_mailer', 'app/views/notification_mailer')
|
8
8
|
end
|
@@ -52,9 +52,13 @@ module Mailboxer
|
|
52
52
|
|
53
53
|
#Sends a messages, starting a new conversation, with the messageable
|
54
54
|
#as originator
|
55
|
-
def send_message(recipients, msg_body, subject, sanitize_text=true, attachment=nil)
|
55
|
+
def send_message(recipients, msg_body, subject, sanitize_text=true, attachment=nil, message_timestamp = Time.now)
|
56
56
|
convo = Conversation.new({:subject => subject})
|
57
|
+
convo.created_at = message_timestamp
|
58
|
+
convo.updated_at = message_timestamp
|
57
59
|
message = messages.new({:body => msg_body, :subject => subject, :attachment => attachment})
|
60
|
+
message.created_at = message_timestamp
|
61
|
+
message.updated_at = message_timestamp
|
58
62
|
message.conversation = convo
|
59
63
|
message.recipients = recipients.is_a?(Array) ? recipients : [recipients]
|
60
64
|
message.recipients = message.recipients.uniq
|
data/mailboxer.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "mailboxer"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.10.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 " +
|
data/spec/dummy/.gitignore
CHANGED
@@ -717,8 +717,8 @@ describe "Messages And Receipts" do
|
|
717
717
|
|
718
718
|
describe "two STI entities" do
|
719
719
|
before do
|
720
|
-
@entity1 = FactoryGirl.create(:
|
721
|
-
@entity2 = FactoryGirl.create(:
|
720
|
+
@entity1 = FactoryGirl.create(:user)
|
721
|
+
@entity2 = FactoryGirl.create(:user)
|
722
722
|
end
|
723
723
|
|
724
724
|
describe "message sending" do
|
data/spec/models/mailbox_spec.rb
CHANGED
@@ -105,8 +105,8 @@ describe Mailbox do
|
|
105
105
|
|
106
106
|
context "STI models" do
|
107
107
|
before do
|
108
|
-
@sti_entity1 = FactoryGirl.create(:
|
109
|
-
@sti_entity2 = FactoryGirl.create(:
|
108
|
+
@sti_entity1 = FactoryGirl.create(:user)
|
109
|
+
@sti_entity2 = FactoryGirl.create(:user)
|
110
110
|
@sti_mail = @sti_entity1.send_message(@sti_entity2, "Body", "Subject")
|
111
111
|
end
|
112
112
|
|
@@ -302,5 +302,14 @@ describe "Mailboxer::Models::Messageable through User" do
|
|
302
302
|
@conversation = @receipt.conversation
|
303
303
|
@conversation.messages.first.attachment_identifier.should=='testfile.txt'
|
304
304
|
end
|
305
|
+
|
306
|
+
it "should be the same message time as passed" do
|
307
|
+
message_time = 5.days.ago.to_time
|
308
|
+
receipt = @entity1.send_message(@entity2, "Body", "Subject", nil, nil, message_time)
|
309
|
+
receipt.message.created_at.should eql(message_time)
|
310
|
+
receipt.message.updated_at.should eql(message_time)
|
311
|
+
receipt.message.conversation.created_at.should eql(message_time)
|
312
|
+
receipt.message.conversation.updated_at.should eql(message_time)
|
313
|
+
end
|
305
314
|
|
306
315
|
end
|
@@ -1,28 +1,28 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Message do
|
4
|
-
|
4
|
+
|
5
5
|
before do
|
6
6
|
@entity1 = FactoryGirl.create(:user)
|
7
7
|
@entity2 = FactoryGirl.create(:user)
|
8
8
|
@entity3 = FactoryGirl.create(:user)
|
9
|
-
end
|
10
|
-
|
9
|
+
end
|
10
|
+
|
11
11
|
it "should notify one user" do
|
12
|
-
@entity1.notify("Subject","Body")
|
13
|
-
|
12
|
+
@entity1.notify("Subject", "Body")
|
13
|
+
|
14
14
|
#Check getting ALL receipts
|
15
15
|
@entity1.mailbox.receipts.size.should==1
|
16
|
-
receipt
|
16
|
+
receipt = @entity1.mailbox.receipts.first
|
17
17
|
notification = receipt.notification
|
18
18
|
notification.subject.should=="Subject"
|
19
19
|
notification.body.should=="Body"
|
20
|
-
|
20
|
+
|
21
21
|
#Check getting NOTIFICATION receipts only
|
22
22
|
@entity1.mailbox.notifications.size.should==1
|
23
23
|
notification = @entity1.mailbox.notifications.first
|
24
24
|
notification.subject.should=="Subject"
|
25
|
-
notification.body.should=="Body"
|
25
|
+
notification.body.should=="Body"
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should be unread by default" do
|
@@ -39,28 +39,28 @@ describe Message do
|
|
39
39
|
notification.mark_as_read(@entity1)
|
40
40
|
notification.should be_is_read(@entity1)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
it "should notify several users" do
|
44
|
-
recipients = Set.new [@entity1
|
45
|
-
Notification.notify_all(recipients,"Subject","Body")
|
46
|
-
|
44
|
+
recipients = Set.new [@entity1, @entity2, @entity3]
|
45
|
+
Notification.notify_all(recipients, "Subject", "Body")
|
46
|
+
|
47
47
|
#Check getting ALL receipts
|
48
48
|
@entity1.mailbox.receipts.size.should==1
|
49
|
-
receipt
|
49
|
+
receipt = @entity1.mailbox.receipts.first
|
50
50
|
notification = receipt.notification
|
51
51
|
notification.subject.should=="Subject"
|
52
52
|
notification.body.should=="Body"
|
53
53
|
@entity2.mailbox.receipts.size.should==1
|
54
|
-
receipt
|
54
|
+
receipt = @entity2.mailbox.receipts.first
|
55
55
|
notification = receipt.notification
|
56
56
|
notification.subject.should=="Subject"
|
57
57
|
notification.body.should=="Body"
|
58
58
|
@entity3.mailbox.receipts.size.should==1
|
59
|
-
receipt
|
59
|
+
receipt = @entity3.mailbox.receipts.first
|
60
60
|
notification = receipt.notification
|
61
61
|
notification.subject.should=="Subject"
|
62
62
|
notification.body.should=="Body"
|
63
|
-
|
63
|
+
|
64
64
|
#Check getting NOTIFICATION receipts only
|
65
65
|
@entity1.mailbox.notifications.size.should==1
|
66
66
|
notification = @entity1.mailbox.notifications.first
|
@@ -74,15 +74,15 @@ describe Message do
|
|
74
74
|
notification = @entity3.mailbox.notifications.first
|
75
75
|
notification.subject.should=="Subject"
|
76
76
|
notification.body.should=="Body"
|
77
|
-
|
77
|
+
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should notify a single recipient" do
|
81
|
-
Notification.notify_all(@entity1,"Subject","Body")
|
81
|
+
Notification.notify_all(@entity1, "Subject", "Body")
|
82
82
|
|
83
83
|
#Check getting ALL receipts
|
84
84
|
@entity1.mailbox.receipts.size.should==1
|
85
|
-
receipt
|
85
|
+
receipt = @entity1.mailbox.receipts.first
|
86
86
|
notification = receipt.notification
|
87
87
|
notification.subject.should=="Subject"
|
88
88
|
notification.body.should=="Body"
|
@@ -93,5 +93,108 @@ describe Message do
|
|
93
93
|
notification.subject.should=="Subject"
|
94
94
|
notification.body.should=="Body"
|
95
95
|
end
|
96
|
+
|
97
|
+
describe "#expire" do
|
98
|
+
subject { Notification.new }
|
99
|
+
|
100
|
+
describe "when the notification is already expired" do
|
101
|
+
before do
|
102
|
+
subject.stub(:expired? => true)
|
103
|
+
end
|
104
|
+
it 'should not update the expires attribute' do
|
105
|
+
subject.should_not_receive :expires=
|
106
|
+
subject.should_not_receive :save
|
107
|
+
subject.expire
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "when the notification is not expired" do
|
112
|
+
let(:now) { Time.now }
|
113
|
+
let(:one_second_ago) { now - 1.second }
|
114
|
+
before do
|
115
|
+
Time.stub(:now => now)
|
116
|
+
subject.stub(:expired? => false)
|
117
|
+
end
|
118
|
+
it 'should update the expires attribute' do
|
119
|
+
subject.should_receive(:expires=).with(one_second_ago)
|
120
|
+
subject.expire
|
121
|
+
end
|
122
|
+
it 'should not save the record' do
|
123
|
+
subject.should_not_receive :save
|
124
|
+
subject.expire
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "#expire!" do
|
131
|
+
subject { Notification.new }
|
132
|
+
|
133
|
+
describe "when the notification is already expired" do
|
134
|
+
before do
|
135
|
+
subject.stub(:expired? => true)
|
136
|
+
end
|
137
|
+
it 'should not call expire' do
|
138
|
+
subject.should_not_receive :expire
|
139
|
+
subject.should_not_receive :save
|
140
|
+
subject.expire!
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "when the notification is not expired" do
|
145
|
+
let(:now) { Time.now }
|
146
|
+
let(:one_second_ago) { now - 1.second }
|
147
|
+
before do
|
148
|
+
Time.stub(:now => now)
|
149
|
+
subject.stub(:expired? => false)
|
150
|
+
end
|
151
|
+
it 'should call expire' do
|
152
|
+
subject.should_receive(:expire)
|
153
|
+
subject.expire!
|
154
|
+
end
|
155
|
+
it 'should save the record' do
|
156
|
+
subject.should_receive :save
|
157
|
+
subject.expire!
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
describe "#expired?" do
|
164
|
+
subject { Notification.new }
|
165
|
+
context "when the expiration date is in the past" do
|
166
|
+
before { subject.stub(:expires => Time.now - 1.second) }
|
167
|
+
it 'should be expired' do
|
168
|
+
subject.expired?.should be_true
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
context "when the expiration date is now" do
|
173
|
+
before {
|
174
|
+
time = Time.now
|
175
|
+
Time.stub(:now => time)
|
176
|
+
subject.stub(:expires => time)
|
177
|
+
}
|
178
|
+
|
179
|
+
it 'should not be expired' do
|
180
|
+
subject.expired?.should be_false
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
context "when the expiration date is in the future" do
|
185
|
+
before { subject.stub(:expires => Time.now + 1.second) }
|
186
|
+
it 'should not be expired' do
|
187
|
+
subject.expired?.should be_false
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context "when the expiration date is not set" do
|
192
|
+
before {subject.stub(:expires => nil)}
|
193
|
+
it 'should not be expired' do
|
194
|
+
subject.expired?.should be_false
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
96
199
|
|
97
200
|
end
|
data/spec/models/receipt_spec.rb
CHANGED
@@ -31,8 +31,8 @@ describe Receipt do
|
|
31
31
|
|
32
32
|
context "STI models" do
|
33
33
|
before do
|
34
|
-
@entity3 = FactoryGirl.create(:
|
35
|
-
@entity4 = FactoryGirl.create(:
|
34
|
+
@entity3 = FactoryGirl.create(:user)
|
35
|
+
@entity4 = FactoryGirl.create(:user)
|
36
36
|
@mail2 = @entity3.send_message(@entity4, "Body", "Subject")
|
37
37
|
end
|
38
38
|
|
metadata
CHANGED
@@ -1,84 +1,74 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailboxer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.10.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Eduardo Casanova Cuesta
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: foreigner
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.9.1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.9.1
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>'
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.0.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>'
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.0.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: carrierwave
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 0.5.8
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 0.5.8
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec-rails
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 2.6.1
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 2.6.1
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: factory_girl
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,49 +83,43 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: forgery
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: 0.3.6
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: 0.3.6
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: capybara
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 0.3.9
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: 0.3.9
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: sqlite3-ruby
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
description: A Rails engine that allows any model to act as messageable, adding the
|
@@ -178,6 +161,7 @@ files:
|
|
178
161
|
- db/migrate/20110912163911_add_notification_code.rb
|
179
162
|
- db/migrate/20111204163911_add_attachments.rb
|
180
163
|
- db/migrate/20120813110712_rename_receipts_read.rb
|
164
|
+
- db/migrate/20130305144212_add_global_notification_support.rb
|
181
165
|
- lib/generators/mailboxer/install_generator.rb
|
182
166
|
- lib/generators/mailboxer/templates/initializer.rb
|
183
167
|
- lib/generators/mailboxer/views_generator.rb
|
@@ -224,6 +208,7 @@ files:
|
|
224
208
|
- spec/dummy/db/migrate/20120305103202_add_notification_code.rb
|
225
209
|
- spec/dummy/db/migrate/20120305103203_add_attachments.rb
|
226
210
|
- spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb
|
211
|
+
- spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb
|
227
212
|
- spec/dummy/db/schema.rb
|
228
213
|
- spec/dummy/public/404.html
|
229
214
|
- spec/dummy/public/422.html
|
@@ -252,32 +237,25 @@ files:
|
|
252
237
|
- spec/testfile.txt
|
253
238
|
homepage: https://github.com/ging/mailboxer
|
254
239
|
licenses: []
|
240
|
+
metadata: {}
|
255
241
|
post_install_message:
|
256
242
|
rdoc_options: []
|
257
243
|
require_paths:
|
258
244
|
- lib
|
259
245
|
required_ruby_version: !ruby/object:Gem::Requirement
|
260
|
-
none: false
|
261
246
|
requirements:
|
262
|
-
- -
|
247
|
+
- - '>='
|
263
248
|
- !ruby/object:Gem::Version
|
264
249
|
version: '0'
|
265
|
-
segments:
|
266
|
-
- 0
|
267
|
-
hash: 1911356081747184373
|
268
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
|
-
none: false
|
270
251
|
requirements:
|
271
|
-
- -
|
252
|
+
- - '>='
|
272
253
|
- !ruby/object:Gem::Version
|
273
254
|
version: '0'
|
274
|
-
segments:
|
275
|
-
- 0
|
276
|
-
hash: 1911356081747184373
|
277
255
|
requirements: []
|
278
256
|
rubyforge_project:
|
279
|
-
rubygems_version:
|
257
|
+
rubygems_version: 2.0.0
|
280
258
|
signing_key:
|
281
|
-
specification_version:
|
259
|
+
specification_version: 4
|
282
260
|
summary: Messaging system for rails apps.
|
283
261
|
test_files: []
|