mailboxer-without-notification 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/.gitignore +18 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +11 -0
  4. data/.yardopts +2 -0
  5. data/Appraisals +19 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +298 -0
  9. data/Rakefile +11 -0
  10. data/app/mailers/message_mailer.rb +37 -0
  11. data/app/models/conversation.rb +179 -0
  12. data/app/models/mailbox.rb +122 -0
  13. data/app/models/message.rb +218 -0
  14. data/app/models/receipt.rb +176 -0
  15. data/app/uploaders/attachment_uploader.rb +3 -0
  16. data/app/views/message_mailer/new_message_email.html.erb +20 -0
  17. data/app/views/message_mailer/new_message_email.text.erb +10 -0
  18. data/app/views/message_mailer/reply_message_email.html.erb +20 -0
  19. data/app/views/message_mailer/reply_message_email.text.erb +10 -0
  20. data/config/locales/en.yml +7 -0
  21. data/config/locales/fr.yml +7 -0
  22. data/db/migrate/20110511145103_create_mailboxer.rb +61 -0
  23. data/db/migrate/20110719110700_add_notified_object.rb +17 -0
  24. data/db/migrate/20110912163911_add_notification_code.rb +13 -0
  25. data/db/migrate/20111204163911_add_attachments.rb +9 -0
  26. data/db/migrate/20120813110712_rename_receipts_read.rb +9 -0
  27. data/db/migrate/20130305144212_add_global_notification_support.rb +9 -0
  28. data/db/migrate/20131003144212_change_table_notification.rb +10 -0
  29. data/db/migrate/20131003214212_change_relations.rb +6 -0
  30. data/gemfiles/rails3.0.gemfile +8 -0
  31. data/gemfiles/rails3.1.gemfile +8 -0
  32. data/gemfiles/rails3.2.gemfile +8 -0
  33. data/gemfiles/rails4.0.gemfile +8 -0
  34. data/lib/generators/mailboxer/install_generator.rb +35 -0
  35. data/lib/generators/mailboxer/templates/initializer.rb +17 -0
  36. data/lib/generators/mailboxer/views_generator.rb +9 -0
  37. data/lib/mailboxer.rb +37 -0
  38. data/lib/mailboxer/concerns/configurable_mailer.rb +13 -0
  39. data/lib/mailboxer/engine.rb +17 -0
  40. data/lib/mailboxer/models/messageable.rb +225 -0
  41. data/mailboxer.gemspec +49 -0
  42. data/spec/dummy/.gitignore +5 -0
  43. data/spec/dummy/Gemfile +33 -0
  44. data/spec/dummy/Rakefile +7 -0
  45. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  46. data/spec/dummy/app/controllers/home_controller.rb +4 -0
  47. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  48. data/spec/dummy/app/mailers/.gitkeep +0 -0
  49. data/spec/dummy/app/models/.gitkeep +0 -0
  50. data/spec/dummy/app/models/cylon.rb +7 -0
  51. data/spec/dummy/app/models/duck.rb +11 -0
  52. data/spec/dummy/app/models/user.rb +6 -0
  53. data/spec/dummy/app/views/home/index.html.haml +7 -0
  54. data/spec/dummy/app/views/layouts/application.html.haml +11 -0
  55. data/spec/dummy/config.ru +4 -0
  56. data/spec/dummy/config/application.rb +42 -0
  57. data/spec/dummy/config/boot.rb +10 -0
  58. data/spec/dummy/config/database.yml +24 -0
  59. data/spec/dummy/config/environment.rb +5 -0
  60. data/spec/dummy/config/environments/development.rb +26 -0
  61. data/spec/dummy/config/environments/production.rb +49 -0
  62. data/spec/dummy/config/environments/test.rb +33 -0
  63. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  64. data/spec/dummy/config/initializers/inflections.rb +10 -0
  65. data/spec/dummy/config/initializers/mailboxer.rb +17 -0
  66. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  67. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  68. data/spec/dummy/config/initializers/session_store.rb +8 -0
  69. data/spec/dummy/config/locales/en.yml +5 -0
  70. data/spec/dummy/config/routes.rb +58 -0
  71. data/spec/dummy/config/sunspot.yml +17 -0
  72. data/spec/dummy/db/migrate/20110228120600_create_users.rb +14 -0
  73. data/spec/dummy/db/migrate/20110306002940_create_ducks.rb +14 -0
  74. data/spec/dummy/db/migrate/20110306015107_create_cylons.rb +14 -0
  75. data/spec/dummy/db/migrate/20120305103200_create_mailboxer.rb +61 -0
  76. data/spec/dummy/db/migrate/20120305103201_add_notified_object.rb +17 -0
  77. data/spec/dummy/db/migrate/20120305103202_add_notification_code.rb +13 -0
  78. data/spec/dummy/db/migrate/20120305103203_add_attachments.rb +5 -0
  79. data/spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb +9 -0
  80. data/spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb +11 -0
  81. data/spec/dummy/db/migrate/20131003144212_change_table_notification.rb +10 -0
  82. data/spec/dummy/db/migrate/20131003214212_change_relations.rb +6 -0
  83. data/spec/dummy/db/schema.rb +74 -0
  84. data/spec/dummy/public/404.html +26 -0
  85. data/spec/dummy/public/422.html +26 -0
  86. data/spec/dummy/public/500.html +26 -0
  87. data/spec/dummy/public/favicon.ico +0 -0
  88. data/spec/dummy/public/index.html +239 -0
  89. data/spec/dummy/public/robots.txt +5 -0
  90. data/spec/dummy/public/uploads/testfile.txt +1 -0
  91. data/spec/dummy/script/rails +6 -0
  92. data/spec/factories/cylon.rb +10 -0
  93. data/spec/factories/duck.rb +10 -0
  94. data/spec/factories/user.rb +10 -0
  95. data/spec/integration/message_and_receipt_spec.rb +903 -0
  96. data/spec/integration/navigation_spec.rb +9 -0
  97. data/spec/mailboxer/concerns/configurable_mailer_spec.rb +27 -0
  98. data/spec/mailboxer_spec.rb +7 -0
  99. data/spec/mailers/message_mailer_spec.rb +109 -0
  100. data/spec/models/conversation_spec.rb +154 -0
  101. data/spec/models/mailbox_spec.rb +160 -0
  102. data/spec/models/mailboxer_models_messageable_spec.rb +324 -0
  103. data/spec/models/message_spec.rb +222 -0
  104. data/spec/models/receipt_spec.rb +56 -0
  105. data/spec/spec_helper.rb +36 -0
  106. data/spec/testfile.txt +1 -0
  107. metadata +301 -0
@@ -0,0 +1,56 @@
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.message
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
+ it "should be able to be marked as deleted" do
33
+ @mail1.deleted.should==false
34
+ @mail1.mark_as_deleted
35
+ @mail1.deleted.should==true
36
+ end
37
+
38
+ it "should be able to be marked as not deleted" do
39
+ @mail1.deleted=true
40
+ @mail1.mark_as_not_deleted
41
+ @mail1.deleted.should==false
42
+ end
43
+
44
+ context "STI models" do
45
+ before do
46
+ @entity3 = FactoryGirl.create(:user)
47
+ @entity4 = FactoryGirl.create(:user)
48
+ @mail2 = @entity3.send_message(@entity4, "Body", "Subject")
49
+ end
50
+
51
+ it "should refer to the correct base class" do
52
+ @mail2.receiver_type.should == @entity3.class.base_class.to_s
53
+ end
54
+ end
55
+
56
+ end
@@ -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,301 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mailboxer-without-notification
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.11.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Eduardo Casanova Cuesta
9
+ - Yves Baumann
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-11-09 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: foreigner
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.9.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.9.1
31
+ - !ruby/object:Gem::Dependency
32
+ name: rails
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>'
37
+ - !ruby/object:Gem::Version
38
+ version: 3.0.0
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>'
45
+ - !ruby/object:Gem::Version
46
+ version: 3.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: carrierwave
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.8
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.5.8
63
+ - !ruby/object:Gem::Dependency
64
+ name: rspec-rails
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: 2.6.1
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: 2.6.1
79
+ - !ruby/object:Gem::Dependency
80
+ name: appraisal
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: factory_girl
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: 2.6.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 2.6.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: forgery
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: 0.3.6
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: 0.3.6
127
+ - !ruby/object:Gem::Dependency
128
+ name: capybara
129
+ requirement: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: 0.3.9
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: 0.3.9
143
+ - !ruby/object:Gem::Dependency
144
+ name: sqlite3
145
+ requirement: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ type: :development
152
+ prerelease: false
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ description: A Rails engine that allows any model to act as messageable, adding the
160
+ ability to exchange messages with any other messageable model, even different ones.
161
+ It supports the use of conversations with two or more recipients to organize the
162
+ messages. You have a complete use of a mailbox object for each messageable model
163
+ that manages an inbox, sentbox and trash for conversations. It also supports sending
164
+ notifications to messageable models, intended to be used as system notifications.
165
+ email: texicitys@gmail.com
166
+ executables: []
167
+ extensions: []
168
+ extra_rdoc_files: []
169
+ files:
170
+ - .gitignore
171
+ - .rspec
172
+ - .travis.yml
173
+ - .yardopts
174
+ - Appraisals
175
+ - Gemfile
176
+ - LICENSE.txt
177
+ - README.md
178
+ - Rakefile
179
+ - app/mailers/message_mailer.rb
180
+ - app/models/conversation.rb
181
+ - app/models/mailbox.rb
182
+ - app/models/message.rb
183
+ - app/models/receipt.rb
184
+ - app/uploaders/attachment_uploader.rb
185
+ - app/views/message_mailer/new_message_email.html.erb
186
+ - app/views/message_mailer/new_message_email.text.erb
187
+ - app/views/message_mailer/reply_message_email.html.erb
188
+ - app/views/message_mailer/reply_message_email.text.erb
189
+ - config/locales/en.yml
190
+ - config/locales/fr.yml
191
+ - db/migrate/20110511145103_create_mailboxer.rb
192
+ - db/migrate/20110719110700_add_notified_object.rb
193
+ - db/migrate/20110912163911_add_notification_code.rb
194
+ - db/migrate/20111204163911_add_attachments.rb
195
+ - db/migrate/20120813110712_rename_receipts_read.rb
196
+ - db/migrate/20130305144212_add_global_notification_support.rb
197
+ - db/migrate/20131003144212_change_table_notification.rb
198
+ - db/migrate/20131003214212_change_relations.rb
199
+ - gemfiles/rails3.0.gemfile
200
+ - gemfiles/rails3.1.gemfile
201
+ - gemfiles/rails3.2.gemfile
202
+ - gemfiles/rails4.0.gemfile
203
+ - lib/generators/mailboxer/install_generator.rb
204
+ - lib/generators/mailboxer/templates/initializer.rb
205
+ - lib/generators/mailboxer/views_generator.rb
206
+ - lib/mailboxer.rb
207
+ - lib/mailboxer/concerns/configurable_mailer.rb
208
+ - lib/mailboxer/engine.rb
209
+ - lib/mailboxer/models/messageable.rb
210
+ - mailboxer.gemspec
211
+ - spec/dummy/.gitignore
212
+ - spec/dummy/Gemfile
213
+ - spec/dummy/Rakefile
214
+ - spec/dummy/app/controllers/application_controller.rb
215
+ - spec/dummy/app/controllers/home_controller.rb
216
+ - spec/dummy/app/helpers/application_helper.rb
217
+ - spec/dummy/app/mailers/.gitkeep
218
+ - spec/dummy/app/models/.gitkeep
219
+ - spec/dummy/app/models/cylon.rb
220
+ - spec/dummy/app/models/duck.rb
221
+ - spec/dummy/app/models/user.rb
222
+ - spec/dummy/app/views/home/index.html.haml
223
+ - spec/dummy/app/views/layouts/application.html.haml
224
+ - spec/dummy/config.ru
225
+ - spec/dummy/config/application.rb
226
+ - spec/dummy/config/boot.rb
227
+ - spec/dummy/config/database.yml
228
+ - spec/dummy/config/environment.rb
229
+ - spec/dummy/config/environments/development.rb
230
+ - spec/dummy/config/environments/production.rb
231
+ - spec/dummy/config/environments/test.rb
232
+ - spec/dummy/config/initializers/backtrace_silencers.rb
233
+ - spec/dummy/config/initializers/inflections.rb
234
+ - spec/dummy/config/initializers/mailboxer.rb
235
+ - spec/dummy/config/initializers/mime_types.rb
236
+ - spec/dummy/config/initializers/secret_token.rb
237
+ - spec/dummy/config/initializers/session_store.rb
238
+ - spec/dummy/config/locales/en.yml
239
+ - spec/dummy/config/routes.rb
240
+ - spec/dummy/config/sunspot.yml
241
+ - spec/dummy/db/migrate/20110228120600_create_users.rb
242
+ - spec/dummy/db/migrate/20110306002940_create_ducks.rb
243
+ - spec/dummy/db/migrate/20110306015107_create_cylons.rb
244
+ - spec/dummy/db/migrate/20120305103200_create_mailboxer.rb
245
+ - spec/dummy/db/migrate/20120305103201_add_notified_object.rb
246
+ - spec/dummy/db/migrate/20120305103202_add_notification_code.rb
247
+ - spec/dummy/db/migrate/20120305103203_add_attachments.rb
248
+ - spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb
249
+ - spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb
250
+ - spec/dummy/db/migrate/20131003144212_change_table_notification.rb
251
+ - spec/dummy/db/migrate/20131003214212_change_relations.rb
252
+ - spec/dummy/db/schema.rb
253
+ - spec/dummy/public/404.html
254
+ - spec/dummy/public/422.html
255
+ - spec/dummy/public/500.html
256
+ - spec/dummy/public/favicon.ico
257
+ - spec/dummy/public/index.html
258
+ - spec/dummy/public/robots.txt
259
+ - spec/dummy/public/uploads/testfile.txt
260
+ - spec/dummy/script/rails
261
+ - spec/factories/cylon.rb
262
+ - spec/factories/duck.rb
263
+ - spec/factories/user.rb
264
+ - spec/integration/message_and_receipt_spec.rb
265
+ - spec/integration/navigation_spec.rb
266
+ - spec/mailboxer/concerns/configurable_mailer_spec.rb
267
+ - spec/mailboxer_spec.rb
268
+ - spec/mailers/message_mailer_spec.rb
269
+ - spec/models/conversation_spec.rb
270
+ - spec/models/mailbox_spec.rb
271
+ - spec/models/mailboxer_models_messageable_spec.rb
272
+ - spec/models/message_spec.rb
273
+ - spec/models/receipt_spec.rb
274
+ - spec/spec_helper.rb
275
+ - spec/testfile.txt
276
+ homepage: https://github.com/Texicitys/mailboxer-without-notification
277
+ licenses:
278
+ - MIT
279
+ post_install_message:
280
+ rdoc_options: []
281
+ require_paths:
282
+ - lib
283
+ required_ruby_version: !ruby/object:Gem::Requirement
284
+ none: false
285
+ requirements:
286
+ - - ! '>='
287
+ - !ruby/object:Gem::Version
288
+ version: '0'
289
+ required_rubygems_version: !ruby/object:Gem::Requirement
290
+ none: false
291
+ requirements:
292
+ - - ! '>='
293
+ - !ruby/object:Gem::Version
294
+ version: '0'
295
+ requirements: []
296
+ rubyforge_project:
297
+ rubygems_version: 1.8.24
298
+ signing_key:
299
+ specification_version: 3
300
+ summary: It is the mailboxer gem in wich I have deleted the notification system.
301
+ test_files: []