mailboxer 0.12.0.rc1 → 0.12.0.rc2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e699bff86b951b515780d88e719ae2b02eca59e7
4
- data.tar.gz: 7024930841d1c7b675ecca3eab46767896fcc67c
3
+ metadata.gz: 38f9237485be3b51d9455f038fa12dcd5a8d0ed6
4
+ data.tar.gz: 001a61d76bf5735eb93070b6f0e9b02c7c33a507
5
5
  SHA512:
6
- metadata.gz: 81b0a14bd89091e70042fc95e215482bb3c64c2d352821f40c0da348b51eb0fa1d07c2d802bc73f933758f767e1b65c3f314e7741da3b8035c91607f10321848
7
- data.tar.gz: d9e30049e35052c5253f3587239ce9dfb6568c9350056d82fb261ed9a9d20096aef578c1252c3f48353aa4f88688782e019ba187c37e448a73c8f5092224634e
6
+ metadata.gz: 33d87aed32e8303d19ba5cf31164d6517f48c7b360a2fbcbe691ef6ddad138f48258b6185e559492c7b0366f3c0aba3b52bfaeae98a4f687fb8b404db7ccfb9b
7
+ data.tar.gz: 4d8e2e8e858855700a61a160874bd87ac66d9cc0c4575c1bbbe10aa137a402ba69e460047f65329a29544df84f6cc404993df5c5afa8fa56c86e13729271645a
data/README.md CHANGED
@@ -56,6 +56,21 @@ And don't forget to migrate your database:
56
56
  $ rake db:migrate
57
57
  ```
58
58
 
59
+ Upgrading
60
+ ---------
61
+
62
+ If upgrading from 0.11.0 to 0.12.0, run the following generator:
63
+
64
+ ```sh
65
+ $ rails generate mailboxer:namespacing_compatibility
66
+ ```
67
+
68
+ Then, migrate your database:
69
+
70
+ ```sh
71
+ $ rake db:migrate
72
+ ```
73
+
59
74
  ## Requirements & Settings
60
75
 
61
76
  ### Emails
@@ -0,0 +1,26 @@
1
+ class Mailboxer::BaseBuilder
2
+
3
+ attr_reader :params
4
+
5
+ def initialize(params)
6
+ @params = params.with_indifferent_access
7
+ end
8
+
9
+ def build
10
+ klass.new.tap do |object|
11
+ params.keys.each do |field|
12
+ object.send("#{field}=", get(field)) unless get(field).nil?
13
+ end
14
+ end
15
+ end
16
+
17
+ protected
18
+
19
+ def get(key)
20
+ respond_to?(key) ? send(key) : params[key]
21
+ end
22
+
23
+ def recipients
24
+ Array(params[:recipients]).uniq
25
+ end
26
+ end
@@ -0,0 +1,8 @@
1
+ class Mailboxer::ConversationBuilder < Mailboxer::BaseBuilder
2
+
3
+ protected
4
+
5
+ def klass
6
+ Mailboxer::Conversation
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ class Mailboxer::MessageBuilder < Mailboxer::BaseBuilder
2
+
3
+ protected
4
+
5
+ def klass
6
+ Mailboxer::Message
7
+ end
8
+
9
+ def subject
10
+ params[:subject] || default_subject
11
+ end
12
+
13
+ def default_subject
14
+ "#{params[:conversation].subject}"
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ class Mailboxer::NotificationBuilder < Mailboxer::BaseBuilder
2
+
3
+ protected
4
+
5
+ def klass
6
+ Mailboxer::Notification
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ class Mailboxer::ReceiptBuilder < Mailboxer::BaseBuilder
2
+
3
+ protected
4
+
5
+ def klass
6
+ Mailboxer::Receipt
7
+ end
8
+
9
+ def mailbox_type
10
+ params.fetch(:mailbox_type, 'inbox')
11
+ end
12
+
13
+ end
@@ -81,22 +81,22 @@ class Mailboxer::Conversation < ActiveRecord::Base
81
81
 
82
82
  #Originator of the conversation.
83
83
  def originator
84
- @originator ||= self.original_message.sender
84
+ @originator ||= original_message.sender
85
85
  end
86
86
 
87
87
  #First message of the conversation.
88
88
  def original_message
89
- @original_message ||= self.messages.order('created_at').first
89
+ @original_message ||= messages.order('created_at').first
90
90
  end
91
91
 
92
92
  #Sender of the last message.
93
93
  def last_sender
94
- @last_sender ||= self.last_message.sender
94
+ @last_sender ||= last_message.sender
95
95
  end
96
96
 
97
97
  #Last message in the conversation.
98
98
  def last_message
99
- @last_message ||= self.messages.order('created_at DESC').first
99
+ @last_message ||= messages.order('created_at DESC').first
100
100
  end
101
101
 
102
102
  #Returns the receipts of the conversation for one participants
@@ -117,29 +117,26 @@ class Mailboxer::Conversation < ActiveRecord::Base
117
117
 
118
118
  #Adds a new participant to the conversation
119
119
  def add_participant(participant)
120
- messages = self.messages
121
120
  messages.each do |message|
122
- receipt = Mailboxer::Receipt.new
123
- receipt.notification = message
124
- receipt.is_read = false
125
- receipt.receiver = participant
126
- receipt.mailbox_type = 'inbox'
127
- receipt.updated_at = message.updated_at
128
- receipt.created_at = message.created_at
129
- receipt.save
121
+ Mailboxer::ReceiptBuilder.new({
122
+ :notification => message,
123
+ :receiver => participant,
124
+ :updated_at => message.updated_at,
125
+ :created_at => message.created_at
126
+ }).build.save
130
127
  end
131
128
  end
132
129
 
133
130
  #Returns true if the participant has at least one trashed message of the conversation
134
131
  def is_trashed?(participant)
135
132
  return false unless participant
136
- self.receipts_for(participant).trash.count != 0
133
+ receipts_for(participant).trash.count != 0
137
134
  end
138
135
 
139
136
  #Returns true if the participant has deleted the conversation
140
137
  def is_deleted?(participant)
141
138
  return false unless participant
142
- return self.receipts_for(participant).deleted.count == self.receipts_for(participant).count
139
+ return receipts_for(participant).deleted.count == receipts_for(participant).count
143
140
  end
144
141
 
145
142
  #Returns true if both participants have deleted the conversation
@@ -1,5 +1,4 @@
1
1
  class Mailboxer::Mailbox
2
- attr_accessor :type
3
2
  attr_reader :messageable
4
3
 
5
4
  #Initializer method
@@ -10,8 +9,8 @@ class Mailboxer::Mailbox
10
9
  #Returns the notifications for the messageable
11
10
  def notifications(options = {})
12
11
  #:type => nil is a hack not to give Messages as Notifications
13
- notifs = Mailboxer::Notification.recipient(@messageable).where(:type => nil).order("mailboxer_notifications.created_at DESC")
14
- if (options[:read].present? and options[:read]==false) or (options[:unread].present? and options[:unread]==true)
12
+ notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order("mailboxer_notifications.created_at DESC")
13
+ if options[:read] == false || options[:unread]
15
14
  notifs = notifs.unread
16
15
  end
17
16
 
@@ -31,23 +30,10 @@ class Mailboxer::Mailbox
31
30
  #* :unread=true
32
31
  #
33
32
  def conversations(options = {})
34
- conv = Mailboxer::Conversation.participant(@messageable)
35
-
36
- if options[:mailbox_type].present?
37
- case options[:mailbox_type]
38
- when 'inbox'
39
- conv = Mailboxer::Conversation.inbox(@messageable)
40
- when 'sentbox'
41
- conv = Mailboxer::Conversation.sentbox(@messageable)
42
- when 'trash'
43
- conv = Mailboxer::Conversation.trash(@messageable)
44
- when 'not_trash'
45
- conv = Mailboxer::Conversation.not_trash(@messageable)
46
- end
47
- end
33
+ conv = get_conversations(options[:mailbox_type])
48
34
 
49
- if (options.has_key?(:read) && options[:read]==false) || (options.has_key?(:unread) && options[:unread]==true)
50
- conv = conv.unread(@messageable)
35
+ if options[:read] == false || options[:unread]
36
+ conv = conv.unread(messageable)
51
37
  end
52
38
 
53
39
  conv
@@ -58,7 +44,7 @@ class Mailboxer::Mailbox
58
44
  #Same as conversations({:mailbox_type => 'inbox'})
59
45
  def inbox(options={})
60
46
  options = options.merge(:mailbox_type => 'inbox')
61
- self.conversations(options)
47
+ conversations(options)
62
48
  end
63
49
 
64
50
  #Returns the conversations in the sentbox of messageable
@@ -66,7 +52,7 @@ class Mailboxer::Mailbox
66
52
  #Same as conversations({:mailbox_type => 'sentbox'})
67
53
  def sentbox(options={})
68
54
  options = options.merge(:mailbox_type => 'sentbox')
69
- self.conversations(options)
55
+ conversations(options)
70
56
  end
71
57
 
72
58
  #Returns the conversations in the trash of messageable
@@ -74,12 +60,12 @@ class Mailboxer::Mailbox
74
60
  #Same as conversations({:mailbox_type => 'trash'})
75
61
  def trash(options={})
76
62
  options = options.merge(:mailbox_type => 'trash')
77
- self.conversations(options)
63
+ conversations(options)
78
64
  end
79
65
 
80
66
  #Returns all the receipts of messageable, from Messages and Notifications
81
67
  def receipts(options = {})
82
- Mailboxer::Receipt.where(options).recipient(@messageable)
68
+ Mailboxer::Receipt.where(options).recipient(messageable)
83
69
  end
84
70
 
85
71
  #Deletes all the messages in the trash of messageable. NOT IMPLEMENTED.
@@ -90,17 +76,17 @@ class Mailboxer::Mailbox
90
76
 
91
77
  #Returns if messageable is a participant of conversation
92
78
  def has_conversation?(conversation)
93
- conversation.is_participant?(@messageable)
79
+ conversation.is_participant?(messageable)
94
80
  end
95
81
 
96
82
  #Returns true if messageable has at least one trashed message of the conversation
97
83
  def is_trashed?(conversation)
98
- conversation.is_trashed?(@messageable)
84
+ conversation.is_trashed?(messageable)
99
85
  end
100
86
 
101
87
  #Returns true if messageable has trashed all the messages of the conversation
102
88
  def is_completely_trashed?(conversation)
103
- conversation.is_completely_trashed?(@messageable)
89
+ conversation.is_completely_trashed?(messageable)
104
90
  end
105
91
 
106
92
  #Returns the receipts of object for messageable as a ActiveRecord::Relation
@@ -114,9 +100,26 @@ class Mailboxer::Mailbox
114
100
  def receipts_for(object)
115
101
  case object
116
102
  when Mailboxer::Message, Mailboxer::Notification
117
- object.receipt_for(@messageable)
103
+ object.receipt_for(messageable)
118
104
  when Mailboxer::Conversation
119
- object.receipts_for(@messageable)
105
+ object.receipts_for(messageable)
106
+ end
107
+ end
108
+
109
+ private
110
+
111
+ def get_conversations(mailbox)
112
+ case mailbox
113
+ when 'inbox'
114
+ Mailboxer::Conversation.inbox(messageable)
115
+ when 'sentbox'
116
+ Mailboxer::Conversation.sentbox(messageable)
117
+ when 'trash'
118
+ Mailboxer::Conversation.trash(messageable)
119
+ when 'not_trash'
120
+ Mailboxer::Conversation.not_trash(messageable)
121
+ else
122
+ Mailboxer::Conversation.participant(messageable)
120
123
  end
121
124
  end
122
125
  end
@@ -33,8 +33,7 @@ class Mailboxer::Message < Mailboxer::Notification
33
33
 
34
34
  temp_receipts << sender_receipt
35
35
 
36
- if temp_receipts.all?(&:valid?)
37
- temp_receipts.each(&:save!) #Save receipts
36
+ if temp_receipts.all?(&:save!)
38
37
 
39
38
  Mailboxer::MailDispatcher.new(self, recipients).call
40
39
 
@@ -33,11 +33,15 @@ class Mailboxer::Notification < ActiveRecord::Base
33
33
 
34
34
  class << self
35
35
  #Sends a Notification to all the recipients
36
- def notify_all(recipients,subject,body,obj = nil,sanitize_text = true,notification_code=nil,send_mail=true)
37
- notification = Mailboxer::Notification.new({:body => body, :subject => subject})
38
- notification.recipients = Array(recipients).uniq
39
- notification.notified_object = obj if obj.present?
40
- notification.notification_code = notification_code if notification_code.present?
36
+ def notify_all(recipients, subject, body, obj = nil, sanitize_text = true, notification_code=nil, send_mail=true)
37
+ notification = Mailboxer::NotificationBuilder.new({
38
+ :recipients => recipients,
39
+ :subject => subject,
40
+ :body => body,
41
+ :notified_object => obj,
42
+ :notification_code => notification_code
43
+ }).build
44
+
41
45
  notification.deliver sanitize_text, send_mail
42
46
  end
43
47
 
@@ -47,10 +51,8 @@ class Mailboxer::Notification < ActiveRecord::Base
47
51
  case receipts
48
52
  when Mailboxer::Receipt
49
53
  receipts.valid?
50
- receipts.errors.empty?
51
54
  when Array
52
- receipts.each(&:valid?)
53
- receipts.all? { |t| t.errors.empty? }
55
+ receipts.all?(&:valid?)
54
56
  else
55
57
  false
56
58
  end
@@ -58,18 +60,18 @@ class Mailboxer::Notification < ActiveRecord::Base
58
60
  end
59
61
 
60
62
  def expired?
61
- self.expires.present? && (self.expires < Time.now)
63
+ expires.present? && (expires < Time.now)
62
64
  end
63
65
 
64
66
  def expire!
65
- unless self.expired?
66
- self.expire
67
- self.save
67
+ unless expired?
68
+ expire
69
+ save
68
70
  end
69
71
  end
70
72
 
71
73
  def expire
72
- unless self.expired?
74
+ unless expired?
73
75
  self.expires = Time.now - 1.second
74
76
  end
75
77
  end
@@ -78,12 +80,7 @@ class Mailboxer::Notification < ActiveRecord::Base
78
80
  #Use Mailboxer::Models::Message.notify and Notification.notify_all instead.
79
81
  def deliver(should_clean = true, send_mail = true)
80
82
  clean if should_clean
81
- temp_receipts = Array.new
82
-
83
- #Receiver receipts
84
- self.recipients.each do |r|
85
- temp_receipts << build_receipt(r, nil, false)
86
- end
83
+ temp_receipts = recipients.map { |r| build_receipt(r, nil, false) }
87
84
 
88
85
  if temp_receipts.all?(&:valid?)
89
86
  temp_receipts.each(&:save!) #Save receipts
@@ -97,16 +94,8 @@ class Mailboxer::Notification < ActiveRecord::Base
97
94
 
98
95
  #Returns the recipients of the Notification
99
96
  def recipients
100
- if @recipients.blank?
101
- recipients_array = Array.new
102
- self.receipts.each do |receipt|
103
- recipients_array << receipt.receiver
104
- end
105
-
106
- recipients_array
107
- else
108
- @recipients
109
- end
97
+ return Array.wrap(@recipients) unless @recipients.blank?
98
+ @recipients = receipts.map { |receipt| receipt.receiver }
110
99
  end
111
100
 
112
101
  #Returns the receipt for the participant
@@ -122,53 +111,53 @@ class Mailboxer::Notification < ActiveRecord::Base
122
111
  #Returns if the participant have read the Notification
123
112
  def is_unread?(participant)
124
113
  return false if participant.nil?
125
- !self.receipt_for(participant).first.is_read
114
+ !receipt_for(participant).first.is_read
126
115
  end
127
116
 
128
117
  def is_read?(participant)
129
- !self.is_unread?(participant)
118
+ !is_unread?(participant)
130
119
  end
131
120
 
132
121
  #Returns if the participant have trashed the Notification
133
122
  def is_trashed?(participant)
134
123
  return false if participant.nil?
135
- self.receipt_for(participant).first.trashed
124
+ receipt_for(participant).first.trashed
136
125
  end
137
126
 
138
127
  #Returns if the participant have deleted the Notification
139
128
  def is_deleted?(participant)
140
129
  return false if participant.nil?
141
- return self.receipt_for(participant).first.deleted
130
+ return receipt_for(participant).first.deleted
142
131
  end
143
132
 
144
133
  #Mark the notification as read
145
134
  def mark_as_read(participant)
146
135
  return if participant.nil?
147
- self.receipt_for(participant).mark_as_read
136
+ receipt_for(participant).mark_as_read
148
137
  end
149
138
 
150
139
  #Mark the notification as unread
151
140
  def mark_as_unread(participant)
152
141
  return if participant.nil?
153
- self.receipt_for(participant).mark_as_unread
142
+ receipt_for(participant).mark_as_unread
154
143
  end
155
144
 
156
145
  #Move the notification to the trash
157
146
  def move_to_trash(participant)
158
147
  return if participant.nil?
159
- self.receipt_for(participant).move_to_trash
148
+ receipt_for(participant).move_to_trash
160
149
  end
161
150
 
162
151
  #Takes the notification out of the trash
163
152
  def untrash(participant)
164
153
  return if participant.nil?
165
- self.receipt_for(participant).untrash
154
+ receipt_for(participant).untrash
166
155
  end
167
156
 
168
157
  #Mark the notification as deleted for one of the participant
169
158
  def mark_as_deleted(participant)
170
159
  return if participant.nil?
171
- return self.receipt_for(participant).mark_as_deleted
160
+ return receipt_for(participant).mark_as_deleted
172
161
  end
173
162
 
174
163
  #Sanitizes the body and subject
@@ -190,12 +179,12 @@ class Mailboxer::Notification < ActiveRecord::Base
190
179
  private
191
180
 
192
181
  def build_receipt(receiver, mailbox_type, is_read = false)
193
- Mailboxer::Receipt.new.tap do |receipt|
194
- receipt.notification = self
195
- receipt.is_read = is_read
196
- receipt.receiver = receiver
197
- receipt.mailbox_type = mailbox_type
198
- end
182
+ Mailboxer::ReceiptBuilder.new({
183
+ :notification => self,
184
+ :mailbox_type => mailbox_type,
185
+ :receiver => receiver,
186
+ :is_read => is_read
187
+ }).build
199
188
  end
200
189
 
201
190
  end
@@ -73,13 +73,10 @@ class Mailboxer::Receipt < ActiveRecord::Base
73
73
  end
74
74
 
75
75
  #This methods helps to do a update_all with table joins, not currently supported by rails.
76
- #Acording to the github ticket https://github.com/rails/rails/issues/522 it should be
76
+ #According to the github ticket https://github.com/rails/rails/issues/522 it should be
77
77
  #supported with 3.2.
78
78
  def update_receipts(updates,options={})
79
- ids = Array.new
80
- where(options).each do |rcp|
81
- ids << rcp.id
82
- end
79
+ ids = where(options).map { |rcp| rcp.id }
83
80
  unless ids.empty?
84
81
  conditions = [""].concat(ids)
85
82
  condition = "id = ? "
@@ -140,12 +137,12 @@ class Mailboxer::Receipt < ActiveRecord::Base
140
137
 
141
138
  #Returns if the participant have read the Notification
142
139
  def is_unread?
143
- !self.is_read
140
+ !is_read
144
141
  end
145
142
 
146
143
  #Returns if the participant have trashed the Notification
147
144
  def is_trashed?
148
- self.trashed
145
+ trashed
149
146
  end
150
147
 
151
148
  protected
@@ -153,9 +150,9 @@ class Mailboxer::Receipt < ActiveRecord::Base
153
150
  #Removes the duplicate error about not present subject from Conversation if it has been already
154
151
  #raised by Message
155
152
  def remove_duplicate_errors
156
- if self.errors["mailboxer_notification.conversation.subject"].present? and self.errors["mailboxer_notification.subject"].present?
157
- self.errors["mailboxer_notification.conversation.subject"].each do |msg|
158
- self.errors["mailboxer_notification.conversation.subject"].delete(msg)
153
+ if errors["mailboxer_notification.conversation.subject"].present? and errors["mailboxer_notification.subject"].present?
154
+ errors["mailboxer_notification.conversation.subject"].each do |msg|
155
+ errors["mailboxer_notification.conversation.subject"].delete(msg)
159
156
  end
160
157
  end
161
158
  end
@@ -0,0 +1,3 @@
1
+ class Mailboxer::AttachmentUploader < CarrierWave::Uploader::Base
2
+ storage :file
3
+ end
@@ -47,9 +47,7 @@ module Mailboxer
47
47
 
48
48
  #Gets the mailbox of the messageable
49
49
  def mailbox
50
- @mailbox = Mailboxer::Mailbox.new(self) if @mailbox.nil?
51
- @mailbox.type = :all
52
- @mailbox
50
+ @mailbox ||= Mailboxer::Mailbox.new(self)
53
51
  end
54
52
 
55
53
  #Sends a notification to the messageable
@@ -60,26 +58,39 @@ module Mailboxer
60
58
  #Sends a messages, starting a new conversation, with the messageable
61
59
  #as originator
62
60
  def send_message(recipients, msg_body, subject, sanitize_text=true, attachment=nil, message_timestamp = Time.now)
63
- convo = Mailboxer::Conversation.new({:subject => subject})
64
- convo.created_at = message_timestamp
65
- convo.updated_at = message_timestamp
66
- message = messages.new({:body => msg_body, :subject => subject, :attachment => attachment})
67
- message.created_at = message_timestamp
68
- message.updated_at = message_timestamp
69
- message.conversation = convo
70
- message.recipients = recipients.is_a?(Array) ? recipients : [recipients]
71
- message.recipients = message.recipients.uniq
61
+ convo = Mailboxer::ConversationBuilder.new({
62
+ :subject => subject,
63
+ :created_at => message_timestamp,
64
+ :updated_at => message_timestamp
65
+ }).build
66
+
67
+ message = Mailboxer::MessageBuilder.new({
68
+ :sender => self,
69
+ :conversation => convo,
70
+ :recipients => recipients,
71
+ :body => msg_body,
72
+ :subject => subject,
73
+ :attachment => attachment,
74
+ :created_at => message_timestamp,
75
+ :updated_at => message_timestamp
76
+ }).build
77
+
72
78
  message.deliver false, sanitize_text
73
79
  end
74
80
 
75
81
  #Basic reply method. USE NOT RECOMENDED.
76
82
  #Use reply_to_sender, reply_to_all and reply_to_conversation instead.
77
83
  def reply(conversation, recipients, reply_body, subject=nil, sanitize_text=true, attachment=nil)
78
- subject = subject || "RE: #{conversation.subject}"
79
- response = messages.new({:body => reply_body, :subject => subject, :attachment => attachment})
80
- response.conversation = conversation
81
- response.recipients = recipients.is_a?(Array) ? recipients : [recipients]
82
- response.recipients = response.recipients.uniq
84
+ subject = subject || "#{conversation.subject}"
85
+ response = Mailboxer::MessageBuilder.new({
86
+ :sender => self,
87
+ :conversation => conversation,
88
+ :recipients => recipients,
89
+ :body => reply_body,
90
+ :subject => subject,
91
+ :attachment => attachment
92
+ }).build
93
+
83
94
  response.recipients.delete(self)
84
95
  response.deliver true, sanitize_text
85
96
  end
@@ -1,3 +1,3 @@
1
1
  module Mailboxer
2
- VERSION = "0.12.0.rc1"
2
+ VERSION = "0.12.0.rc2"
3
3
  end
data/spec/dummy/Gemfile CHANGED
@@ -9,25 +9,3 @@ gem 'factory_girl'
9
9
 
10
10
  gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
11
11
  gem "jdbc-sqlite3", :platform => :jruby
12
-
13
- # Use unicorn as the web server
14
- # gem 'unicorn'
15
-
16
- # Deploy with Capistrano
17
- # gem 'capistrano'
18
-
19
- # To use debugger
20
- # gem 'ruby-debug'
21
-
22
- # Bundle the extra gems:
23
- # gem 'bj'
24
- # gem 'nokogiri'
25
- # gem 'sqlite3-ruby', :require => 'sqlite3'
26
- # gem 'aws-s3', :require => 'aws/s3'
27
-
28
- # Bundle gems for the local environment. Make sure to
29
- # put test-only gems in this group so their generators
30
- # and rake tasks are available in development mode:
31
- # group :development, :test do
32
- # gem 'webrat'
33
- # end
@@ -61,8 +61,8 @@ describe "Messages And Mailboxer::Receipts" do
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
- assert @message2.body.eql?"Reply body"
65
- assert @message2.subject.eql?"RE: Subject"
64
+ @message2.body.should eq "Reply body"
65
+ @message2.subject.should eq "Subject"
66
66
  end
67
67
 
68
68
  it "should create proper mails" do
@@ -108,7 +108,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
111
+ assert @message2.subject.eql?"Subject"
112
112
  end
113
113
 
114
114
  it "should create proper mails" do
@@ -153,7 +153,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
156
+ assert @message2.subject.eql?"Subject"
157
157
  end
158
158
 
159
159
  it "should create proper mails" do
@@ -248,7 +248,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
251
+ assert @message2.subject.eql?"Subject"
252
252
  end
253
253
 
254
254
  it "should create proper mails" do
@@ -294,7 +294,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
297
+ assert @message2.subject.eql?"Subject"
298
298
  end
299
299
 
300
300
  it "should create proper mails" do
@@ -417,7 +417,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
420
+ assert @message2.subject.eql?"Subject"
421
421
  end
422
422
 
423
423
  it "should create proper mails" do
@@ -473,7 +473,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
476
+ assert @message2.subject.eql?"Subject"
477
477
  end
478
478
 
479
479
  it "should create proper mails" do
@@ -599,7 +599,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
602
+ assert @message2.subject.eql?"Subject"
603
603
  end
604
604
 
605
605
  it "should create proper mails" do
@@ -655,7 +655,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
658
+ assert @message2.subject.eql?"Subject"
659
659
  end
660
660
 
661
661
  it "should create proper mails" do
@@ -775,7 +775,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
778
+ assert @message2.subject.eql?"Subject"
779
779
  end
780
780
 
781
781
  it "should create proper mails" do
@@ -821,7 +821,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
824
+ assert @message2.subject.eql?"Subject"
825
825
  end
826
826
 
827
827
  it "should create proper mails" do
@@ -866,7 +866,7 @@ describe "Messages And Mailboxer::Receipts" 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
- assert @message2.subject.eql?"RE: Subject"
869
+ assert @message2.subject.eql?"Subject"
870
870
  end
871
871
 
872
872
  it "should create proper mails" do
@@ -47,7 +47,7 @@ describe Mailboxer::Notification do
47
47
  end
48
48
 
49
49
  it "should notify several users" do
50
- recipients = Set.new [@entity1,@entity2,@entity3]
50
+ recipients = [@entity1,@entity2,@entity3]
51
51
  Mailboxer::Notification.notify_all(recipients,"Subject","Body")
52
52
  #Check getting ALL receipts
53
53
  @entity1.mailbox.receipts.size.should==1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailboxer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0.rc1
4
+ version: 0.12.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Casanova Cuesta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-12 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreigner
@@ -170,6 +170,11 @@ files:
170
170
  - LICENSE.txt
171
171
  - README.md
172
172
  - Rakefile
173
+ - app/builders/mailboxer/base_builder.rb
174
+ - app/builders/mailboxer/conversation_builder.rb
175
+ - app/builders/mailboxer/message_builder.rb
176
+ - app/builders/mailboxer/notification_builder.rb
177
+ - app/builders/mailboxer/receipt_builder.rb
173
178
  - app/mailers/mailboxer/base_mailer.rb
174
179
  - app/mailers/mailboxer/message_mailer.rb
175
180
  - app/mailers/mailboxer/notification_mailer.rb
@@ -179,7 +184,7 @@ files:
179
184
  - app/models/mailboxer/message.rb
180
185
  - app/models/mailboxer/notification.rb
181
186
  - app/models/mailboxer/receipt.rb
182
- - app/uploaders/attachment_uploader.rb
187
+ - app/uploaders/mailboxer/attachment_uploader.rb
183
188
  - app/views/mailboxer/message_mailer/new_message_email.html.erb
184
189
  - app/views/mailboxer/message_mailer/new_message_email.text.erb
185
190
  - app/views/mailboxer/message_mailer/reply_message_email.html.erb
@@ -1,3 +0,0 @@
1
- class AttachmentUploader < CarrierWave::Uploader::Base
2
- storage :file
3
- end