curationexperts-mailboxer 0.10.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +1 -0
- data/.travis.yml +10 -0
- data/.yardopts +2 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +273 -0
- data/Rakefile +7 -0
- data/app/mailers/message_mailer.rb +37 -0
- data/app/mailers/notification_mailer.rb +21 -0
- data/app/models/conversation.rb +143 -0
- data/app/models/mailbox.rb +121 -0
- data/app/models/message.rb +66 -0
- data/app/models/notification.rb +184 -0
- data/app/models/receipt.rb +151 -0
- data/app/uploaders/attachment_uploader.rb +3 -0
- data/app/views/message_mailer/new_message_email.html.erb +20 -0
- data/app/views/message_mailer/new_message_email.text.erb +10 -0
- data/app/views/message_mailer/reply_message_email.html.erb +20 -0
- data/app/views/message_mailer/reply_message_email.text.erb +10 -0
- data/app/views/notification_mailer/new_notification_email.html.erb +20 -0
- data/app/views/notification_mailer/new_notification_email.text.erb +10 -0
- data/config/locales/en.yml +7 -0
- data/db/migrate/20110511145103_create_mailboxer.rb +61 -0
- data/db/migrate/20110719110700_add_notified_object.rb +17 -0
- data/db/migrate/20110912163911_add_notification_code.rb +13 -0
- data/db/migrate/20111204163911_add_attachments.rb +9 -0
- data/db/migrate/20120813110712_rename_receipts_read.rb +9 -0
- data/db/migrate/20130305144212_add_global_notification_support.rb +9 -0
- data/lib/generators/mailboxer/install_generator.rb +35 -0
- data/lib/generators/mailboxer/templates/initializer.rb +17 -0
- data/lib/generators/mailboxer/views_generator.rb +9 -0
- data/lib/mailboxer.rb +31 -0
- data/lib/mailboxer/concerns/configurable_mailer.rb +13 -0
- data/lib/mailboxer/engine.rb +18 -0
- data/lib/mailboxer/models/messageable.rb +208 -0
- data/mailboxer.gemspec +47 -0
- data/spec/dummy/.gitignore +5 -0
- data/spec/dummy/Gemfile +33 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/home_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/cylon.rb +7 -0
- data/spec/dummy/app/models/duck.rb +11 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/views/home/index.html.haml +7 -0
- data/spec/dummy/app/views/layouts/application.html.haml +11 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +42 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +24 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +33 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mailboxer.rb +17 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config/sunspot.yml +17 -0
- data/spec/dummy/db/migrate/20110228120600_create_users.rb +14 -0
- data/spec/dummy/db/migrate/20110306002940_create_ducks.rb +14 -0
- data/spec/dummy/db/migrate/20110306015107_create_cylons.rb +14 -0
- data/spec/dummy/db/migrate/20120305103200_create_mailboxer.rb +61 -0
- data/spec/dummy/db/migrate/20120305103201_add_notified_object.rb +17 -0
- data/spec/dummy/db/migrate/20120305103202_add_notification_code.rb +13 -0
- data/spec/dummy/db/migrate/20120305103203_add_attachments.rb +5 -0
- data/spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb +9 -0
- data/spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb +11 -0
- data/spec/dummy/db/schema.rb +74 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +239 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/public/uploads/testfile.txt +1 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/cylon.rb +10 -0
- data/spec/factories/duck.rb +10 -0
- data/spec/factories/user.rb +10 -0
- data/spec/integration/message_and_receipt_spec.rb +903 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/mailboxer/concerns/configurable_mailer_spec.rb +27 -0
- data/spec/mailboxer_spec.rb +7 -0
- data/spec/mailers/message_mailer_spec.rb +110 -0
- data/spec/mailers/notification_mailer_spec.rb +61 -0
- data/spec/models/conversation_spec.rb +101 -0
- data/spec/models/mailbox_spec.rb +124 -0
- data/spec/models/mailboxer_models_messageable_spec.rb +315 -0
- data/spec/models/message_spec.rb +24 -0
- data/spec/models/notification_spec.rb +200 -0
- data/spec/models/receipt_spec.rb +44 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/testfile.txt +1 -0
- metadata +263 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Receipt do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@entity1 = FactoryGirl.create(:user)
|
7
|
+
@entity2 = FactoryGirl.create(:user)
|
8
|
+
@mail1 = @entity1.send_message(@entity2,"Body","Subject")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should belong to a message" do
|
12
|
+
assert @mail1.notification
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should belong to a conversation" do
|
16
|
+
assert @mail1.conversation
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to be marked as unread" do
|
20
|
+
@mail1.is_read.should==true
|
21
|
+
@mail1.mark_as_unread
|
22
|
+
@mail1.is_read.should==false
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be able to be marked as read" do
|
26
|
+
@mail1.is_read.should==true
|
27
|
+
@mail1.mark_as_unread
|
28
|
+
@mail1.mark_as_read
|
29
|
+
@mail1.is_read.should==true
|
30
|
+
end
|
31
|
+
|
32
|
+
context "STI models" do
|
33
|
+
before do
|
34
|
+
@entity3 = FactoryGirl.create(:user)
|
35
|
+
@entity4 = FactoryGirl.create(:user)
|
36
|
+
@mail2 = @entity3.send_message(@entity4, "Body", "Subject")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should refer to the correct base class" do
|
40
|
+
@mail2.receiver_type.should == @entity3.class.base_class.to_s
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Configure Rails Envinronment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rspec/rails"
|
6
|
+
|
7
|
+
ActionMailer::Base.delivery_method = :test
|
8
|
+
ActionMailer::Base.perform_deliveries = true
|
9
|
+
ActionMailer::Base.default_url_options[:host] = "test.com"
|
10
|
+
|
11
|
+
Rails.backtrace_cleaner.remove_silencers!
|
12
|
+
|
13
|
+
# Configure capybara for integration testing
|
14
|
+
require "capybara/rails"
|
15
|
+
Capybara.default_driver = :rack_test
|
16
|
+
Capybara.default_selector = :css
|
17
|
+
|
18
|
+
# Run any available migration
|
19
|
+
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
20
|
+
|
21
|
+
# Load support files
|
22
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
23
|
+
|
24
|
+
# Load Factories
|
25
|
+
require 'factory_girl'
|
26
|
+
Dir["#{File.dirname(__FILE__)}/factories/*.rb"].each {|f| require f}
|
27
|
+
|
28
|
+
RSpec.configure do |config|
|
29
|
+
# Remove this line if you don't want RSpec's should and should_not
|
30
|
+
# methods or matchers
|
31
|
+
require 'rspec/expectations'
|
32
|
+
config.include RSpec::Matchers
|
33
|
+
|
34
|
+
# == Mock Framework
|
35
|
+
config.mock_with :rspec
|
36
|
+
end
|
data/spec/testfile.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
this is a dummy file to test file uploads
|
metadata
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: curationexperts-mailboxer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.3.rc1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Coyne
|
8
|
+
- Eduardo Casanova Cuesta
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: foreigner
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.9.1
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.9.1
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rails
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>'
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 3.0.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>'
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 3.0.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: carrierwave
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.5.8
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.5.8
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec-rails
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.6.1
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.6.1
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: factory_girl
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.6.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ~>
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 2.6.0
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: forgery
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.3.6
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.3.6
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: capybara
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.3.9
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.3.9
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: sqlite3
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: A Rails engine that allows any model to act as messageable, adding the
|
127
|
+
ability to exchange messages with any other messageable model, even different ones.
|
128
|
+
It supports the use of conversations with two or more recipients to organize the
|
129
|
+
messages. You have a complete use of a mailbox object for each messageable model
|
130
|
+
that manages an inbox, sentbox and trash for conversations. It also supports sending
|
131
|
+
notifications to messageable models, intended to be used as system notifications.
|
132
|
+
email: justin@curationexperts.com
|
133
|
+
executables: []
|
134
|
+
extensions: []
|
135
|
+
extra_rdoc_files: []
|
136
|
+
files:
|
137
|
+
- .gitignore
|
138
|
+
- .rspec
|
139
|
+
- .travis.yml
|
140
|
+
- .yardopts
|
141
|
+
- Gemfile
|
142
|
+
- LICENSE.txt
|
143
|
+
- README.md
|
144
|
+
- Rakefile
|
145
|
+
- app/mailers/message_mailer.rb
|
146
|
+
- app/mailers/notification_mailer.rb
|
147
|
+
- app/models/conversation.rb
|
148
|
+
- app/models/mailbox.rb
|
149
|
+
- app/models/message.rb
|
150
|
+
- app/models/notification.rb
|
151
|
+
- app/models/receipt.rb
|
152
|
+
- app/uploaders/attachment_uploader.rb
|
153
|
+
- app/views/message_mailer/new_message_email.html.erb
|
154
|
+
- app/views/message_mailer/new_message_email.text.erb
|
155
|
+
- app/views/message_mailer/reply_message_email.html.erb
|
156
|
+
- app/views/message_mailer/reply_message_email.text.erb
|
157
|
+
- app/views/notification_mailer/new_notification_email.html.erb
|
158
|
+
- app/views/notification_mailer/new_notification_email.text.erb
|
159
|
+
- config/locales/en.yml
|
160
|
+
- db/migrate/20110511145103_create_mailboxer.rb
|
161
|
+
- db/migrate/20110719110700_add_notified_object.rb
|
162
|
+
- db/migrate/20110912163911_add_notification_code.rb
|
163
|
+
- db/migrate/20111204163911_add_attachments.rb
|
164
|
+
- db/migrate/20120813110712_rename_receipts_read.rb
|
165
|
+
- db/migrate/20130305144212_add_global_notification_support.rb
|
166
|
+
- lib/generators/mailboxer/install_generator.rb
|
167
|
+
- lib/generators/mailboxer/templates/initializer.rb
|
168
|
+
- lib/generators/mailboxer/views_generator.rb
|
169
|
+
- lib/mailboxer.rb
|
170
|
+
- lib/mailboxer/concerns/configurable_mailer.rb
|
171
|
+
- lib/mailboxer/engine.rb
|
172
|
+
- lib/mailboxer/models/messageable.rb
|
173
|
+
- mailboxer.gemspec
|
174
|
+
- spec/dummy/.gitignore
|
175
|
+
- spec/dummy/Gemfile
|
176
|
+
- spec/dummy/Rakefile
|
177
|
+
- spec/dummy/app/controllers/application_controller.rb
|
178
|
+
- spec/dummy/app/controllers/home_controller.rb
|
179
|
+
- spec/dummy/app/helpers/application_helper.rb
|
180
|
+
- spec/dummy/app/mailers/.gitkeep
|
181
|
+
- spec/dummy/app/models/.gitkeep
|
182
|
+
- spec/dummy/app/models/cylon.rb
|
183
|
+
- spec/dummy/app/models/duck.rb
|
184
|
+
- spec/dummy/app/models/user.rb
|
185
|
+
- spec/dummy/app/views/home/index.html.haml
|
186
|
+
- spec/dummy/app/views/layouts/application.html.haml
|
187
|
+
- spec/dummy/config.ru
|
188
|
+
- spec/dummy/config/application.rb
|
189
|
+
- spec/dummy/config/boot.rb
|
190
|
+
- spec/dummy/config/database.yml
|
191
|
+
- spec/dummy/config/environment.rb
|
192
|
+
- spec/dummy/config/environments/development.rb
|
193
|
+
- spec/dummy/config/environments/production.rb
|
194
|
+
- spec/dummy/config/environments/test.rb
|
195
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
196
|
+
- spec/dummy/config/initializers/inflections.rb
|
197
|
+
- spec/dummy/config/initializers/mailboxer.rb
|
198
|
+
- spec/dummy/config/initializers/mime_types.rb
|
199
|
+
- spec/dummy/config/initializers/secret_token.rb
|
200
|
+
- spec/dummy/config/initializers/session_store.rb
|
201
|
+
- spec/dummy/config/locales/en.yml
|
202
|
+
- spec/dummy/config/routes.rb
|
203
|
+
- spec/dummy/config/sunspot.yml
|
204
|
+
- spec/dummy/db/migrate/20110228120600_create_users.rb
|
205
|
+
- spec/dummy/db/migrate/20110306002940_create_ducks.rb
|
206
|
+
- spec/dummy/db/migrate/20110306015107_create_cylons.rb
|
207
|
+
- spec/dummy/db/migrate/20120305103200_create_mailboxer.rb
|
208
|
+
- spec/dummy/db/migrate/20120305103201_add_notified_object.rb
|
209
|
+
- spec/dummy/db/migrate/20120305103202_add_notification_code.rb
|
210
|
+
- spec/dummy/db/migrate/20120305103203_add_attachments.rb
|
211
|
+
- spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb
|
212
|
+
- spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb
|
213
|
+
- spec/dummy/db/schema.rb
|
214
|
+
- spec/dummy/public/404.html
|
215
|
+
- spec/dummy/public/422.html
|
216
|
+
- spec/dummy/public/500.html
|
217
|
+
- spec/dummy/public/favicon.ico
|
218
|
+
- spec/dummy/public/index.html
|
219
|
+
- spec/dummy/public/robots.txt
|
220
|
+
- spec/dummy/public/uploads/testfile.txt
|
221
|
+
- spec/dummy/script/rails
|
222
|
+
- spec/factories/cylon.rb
|
223
|
+
- spec/factories/duck.rb
|
224
|
+
- spec/factories/user.rb
|
225
|
+
- spec/integration/message_and_receipt_spec.rb
|
226
|
+
- spec/integration/navigation_spec.rb
|
227
|
+
- spec/mailboxer/concerns/configurable_mailer_spec.rb
|
228
|
+
- spec/mailboxer_spec.rb
|
229
|
+
- spec/mailers/message_mailer_spec.rb
|
230
|
+
- spec/mailers/notification_mailer_spec.rb
|
231
|
+
- spec/models/conversation_spec.rb
|
232
|
+
- spec/models/mailbox_spec.rb
|
233
|
+
- spec/models/mailboxer_models_messageable_spec.rb
|
234
|
+
- spec/models/message_spec.rb
|
235
|
+
- spec/models/notification_spec.rb
|
236
|
+
- spec/models/receipt_spec.rb
|
237
|
+
- spec/spec_helper.rb
|
238
|
+
- spec/testfile.txt
|
239
|
+
homepage: https://github.com/curationexperts/mailboxer
|
240
|
+
licenses: []
|
241
|
+
metadata: {}
|
242
|
+
post_install_message:
|
243
|
+
rdoc_options: []
|
244
|
+
require_paths:
|
245
|
+
- lib
|
246
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - '>='
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
251
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
|
+
requirements:
|
253
|
+
- - '>'
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
version: 1.3.1
|
256
|
+
requirements: []
|
257
|
+
rubyforge_project:
|
258
|
+
rubygems_version: 2.0.3
|
259
|
+
signing_key:
|
260
|
+
specification_version: 4
|
261
|
+
summary: Messaging system for rails apps.
|
262
|
+
test_files: []
|
263
|
+
has_rdoc:
|