message_train 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +20 -0
  3. data/.ruby-gemset +1 -1
  4. data/.scss-lint.yml +7 -0
  5. data/.simplecov +1 -1
  6. data/.travis.yml +1 -1
  7. data/Gemfile +6 -2
  8. data/LICENSE.txt +2 -2
  9. data/README.rdoc +5 -5
  10. data/Rakefile +22 -21
  11. data/VERSION +1 -1
  12. data/app/assets/javascripts/message_train.js +1 -1
  13. data/app/assets/stylesheets/message_train.scss +29 -19
  14. data/app/controllers/concerns/message_train_support.rb +41 -37
  15. data/app/controllers/message_train/application_controller.rb +1 -0
  16. data/app/controllers/message_train/boxes_controller.rb +5 -4
  17. data/app/controllers/message_train/conversations_controller.rb +8 -7
  18. data/app/controllers/message_train/messages_controller.rb +25 -22
  19. data/app/controllers/message_train/participants_controller.rb +27 -23
  20. data/app/controllers/message_train/unsubscribes_controller.rb +37 -23
  21. data/app/helpers/message_train/application_helper.rb +6 -8
  22. data/app/helpers/message_train/attachments_helper.rb +12 -4
  23. data/app/helpers/message_train/boxes_helper.rb +38 -11
  24. data/app/helpers/message_train/collectives_helper.rb +38 -12
  25. data/app/helpers/message_train/conversations_helper.rb +43 -35
  26. data/app/helpers/message_train/messages_helper.rb +32 -25
  27. data/app/mailers/message_train/application_mailer.rb +7 -4
  28. data/app/mailers/message_train/previews/receipt_mailer_preview.rb +2 -3
  29. data/app/mailers/message_train/receipt_mailer.rb +14 -4
  30. data/app/models/message_train/attachment.rb +41 -25
  31. data/app/models/message_train/box.rb +159 -122
  32. data/app/models/message_train/conversation.rb +84 -41
  33. data/app/models/message_train/ignore.rb +8 -2
  34. data/app/models/message_train/message.rb +72 -42
  35. data/app/models/message_train/receipt.rb +30 -17
  36. data/app/models/message_train/unsubscribe.rb +1 -0
  37. data/app/views/application/404.html.haml +1 -1
  38. data/app/views/layouts/mailer.html.haml +2 -2
  39. data/app/views/layouts/mailer.text.haml +1 -1
  40. data/app/views/message_train/application/_attachment_fields.html.haml +1 -1
  41. data/app/views/message_train/application/_widget.html.haml +1 -1
  42. data/app/views/message_train/application/results.json.jbuilder +1 -1
  43. data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -1
  44. data/app/views/message_train/boxes/_list_item.html.haml +1 -1
  45. data/app/views/message_train/boxes/show.html.haml +1 -1
  46. data/app/views/message_train/collectives/_dropdown_list.html.haml +1 -1
  47. data/app/views/message_train/collectives/_list_item.html.haml +1 -1
  48. data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
  49. data/app/views/message_train/conversations/_ignored_toggle.html.haml +2 -2
  50. data/app/views/message_train/conversations/_read_toggle.html.haml +1 -1
  51. data/app/views/message_train/conversations/_toggle.html.haml +1 -1
  52. data/app/views/message_train/conversations/_trashed_toggle.html.haml +1 -1
  53. data/app/views/message_train/conversations/show.html.haml +2 -2
  54. data/app/views/message_train/conversations/show.json.jbuilder +5 -1
  55. data/app/views/message_train/messages/_form.html.haml +1 -1
  56. data/app/views/message_train/messages/_message.html.haml +6 -6
  57. data/app/views/message_train/messages/_toggle.html.haml +1 -1
  58. data/app/views/message_train/messages/show.json.jbuilder +5 -1
  59. data/app/views/message_train/participants/_participant.json.jbuilder +1 -1
  60. data/app/views/message_train/participants/index.json.jbuilder +1 -1
  61. data/app/views/message_train/participants/show.json.jbuilder +1 -1
  62. data/app/views/message_train/receipt_mailer/notification_email.html.haml +1 -1
  63. data/app/views/message_train/receipt_mailer/notification_email.text.haml +1 -1
  64. data/app/views/message_train/unsubscribes/index.html.haml +1 -1
  65. data/config/environment.rb +1 -1
  66. data/config/initializers/date_time.rb +2 -2
  67. data/config/locales/en.yml +1 -1
  68. data/config/routes.rb +37 -15
  69. data/lib/generators/message_train/install/install_generator.rb +26 -11
  70. data/lib/generators/message_train/install/templates/initializer.rb +0 -2
  71. data/lib/generators/message_train/utils.rb +11 -4
  72. data/lib/message_train/configuration.rb +4 -5
  73. data/lib/message_train/engine.rb +1 -7
  74. data/lib/message_train/localization.rb +14 -18
  75. data/lib/message_train/mixin.rb +211 -150
  76. data/lib/message_train/version.rb +1 -0
  77. data/lib/message_train.rb +7 -6
  78. data/message_train.gemspec +24 -11
  79. data/spec/controllers/message_train/boxes_controller_spec.rb +63 -15
  80. data/spec/controllers/message_train/concerns_spec.rb +17 -13
  81. data/spec/controllers/message_train/conversations_controller_spec.rb +44 -12
  82. data/spec/controllers/message_train/messages_controller_spec.rb +87 -40
  83. data/spec/controllers/message_train/participants_controller_spec.rb +10 -4
  84. data/spec/controllers/message_train/unsubscribes_controller_spec.rb +43 -13
  85. data/spec/dummy/Rakefile +2 -1
  86. data/spec/dummy/app/assets/stylesheets/application.css.scss +7 -23
  87. data/spec/dummy/app/controllers/application_controller.rb +7 -7
  88. data/spec/dummy/app/models/group.rb +1 -1
  89. data/spec/dummy/app/models/role.rb +11 -7
  90. data/spec/dummy/app/models/user.rb +6 -5
  91. data/spec/dummy/app/views/layouts/_top_navigation.html.haml +1 -1
  92. data/spec/dummy/app/views/layouts/application.html.haml +1 -1
  93. data/spec/dummy/app/views/pages/index.html.haml +1 -1
  94. data/spec/dummy/config/application.rb +23 -17
  95. data/spec/dummy/config/environments/development.rb +5 -4
  96. data/spec/dummy/config/environments/production.rb +10 -6
  97. data/spec/dummy/config/environments/test.rb +4 -3
  98. data/spec/dummy/config/initializers/assets.rb +2 -1
  99. data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -2
  100. data/spec/dummy/config/initializers/bootstrap_leather.rb +1 -1
  101. data/spec/dummy/config/initializers/devise.rb +63 -44
  102. data/spec/dummy/config/initializers/high_voltage.rb +1 -1
  103. data/spec/dummy/config/initializers/message_train.rb +5 -2
  104. data/spec/dummy/config/initializers/mime_types.rb +1 -1
  105. data/spec/dummy/config/initializers/paperclip.rb +5 -2
  106. data/spec/dummy/config/initializers/rolify.rb +3 -2
  107. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -1
  108. data/spec/dummy/config/routes.rb +1 -3
  109. data/spec/dummy/config/settings.yml +1 -1
  110. data/spec/dummy/db/schema.rb +98 -98
  111. data/spec/dummy/db/seeds/conversations.seeds.rb +160 -160
  112. data/spec/dummy/db/seeds/development/conversations.seeds.rb +6 -2
  113. data/spec/dummy/db/seeds/groups.seeds.rb +11 -12
  114. data/spec/dummy/db/seeds/test/attachments.seeds.rb +13 -3
  115. data/spec/dummy/db/seeds/test/conversations.seeds.rb +6 -2
  116. data/spec/dummy/db/seeds/unsubscribes.seeds.rb +1 -1
  117. data/spec/dummy/db/seeds/users.seeds.rb +47 -42
  118. data/spec/dummy/db/test.sqlite3 +0 -0
  119. data/spec/factories/attachment.rb +6 -2
  120. data/spec/factories/group.rb +1 -4
  121. data/spec/factories/message.rb +29 -23
  122. data/spec/factories/user.rb +6 -4
  123. data/spec/features/boxes_spec.rb +76 -24
  124. data/spec/features/conversations_spec.rb +19 -7
  125. data/spec/features/messages_spec.rb +24 -5
  126. data/spec/features/unsubscribes_spec.rb +36 -9
  127. data/spec/helpers/message_train/application_helper_spec.rb +1 -1
  128. data/spec/helpers/message_train/attachment_helper_spec.rb +27 -12
  129. data/spec/helpers/message_train/boxes_helper_spec.rb +1 -1
  130. data/spec/helpers/message_train/collectives_helper_spec.rb +25 -9
  131. data/spec/helpers/message_train/conversations_helper_spec.rb +239 -120
  132. data/spec/helpers/message_train/messages_helper_spec.rb +137 -81
  133. data/spec/message_train_spec.rb +3 -2
  134. data/spec/models/group_spec.rb +12 -9
  135. data/spec/models/message_train/attachment_spec.rb +33 -30
  136. data/spec/models/message_train/box_spec.rb +243 -60
  137. data/spec/models/message_train/conversation_spec.rb +16 -12
  138. data/spec/models/message_train/ignore_spec.rb +3 -1
  139. data/spec/models/message_train/message_spec.rb +22 -7
  140. data/spec/models/message_train/receipt_spec.rb +14 -4
  141. data/spec/models/role_spec.rb +10 -6
  142. data/spec/models/user_spec.rb +74 -22
  143. data/spec/rails_helper.rb +9 -4
  144. data/spec/spec_helper.rb +6 -54
  145. data/spec/support/controller_behaviors.rb +8 -5
  146. data/spec/support/controller_macros.rb +2 -2
  147. data/spec/support/factory_girl.rb +1 -1
  148. data/spec/support/feature_behaviors.rb +42 -13
  149. data/spec/support/loaded_site/attachments.rb +8 -0
  150. data/spec/support/loaded_site/conversations.rb +73 -0
  151. data/spec/support/{groups.rb → loaded_site/groups.rb} +1 -1
  152. data/spec/support/{loaded_site.rb → loaded_site/loaded_site.rb} +1 -1
  153. data/spec/support/{messages.rb → loaded_site/messages.rb} +13 -5
  154. data/spec/support/{roles.rb → loaded_site/roles.rb} +1 -1
  155. data/spec/support/{users.rb → loaded_site/users.rb} +1 -1
  156. data/spec/support/shared_connection.rb +8 -6
  157. data/spec/support/utilities.rb +10 -10
  158. metadata +67 -10
  159. data/spec/dummy/config/unused/temporary_i18n_debugging.rb +0 -12
  160. data/spec/support/attachments.rb +0 -4
  161. data/spec/support/conversations.rb +0 -23
@@ -13,41 +13,45 @@ describe MessageTrain::MessagesHelper do
13
13
  describe '#messages_class' do
14
14
  context 'when it is unread' do
15
15
  subject { helper.message_class(first_user.box(:in), unread_message) }
16
- it { should match /unread/ }
16
+ it { should match(/unread/) }
17
17
  end
18
18
  context 'when it is read' do
19
19
  subject { helper.message_class(first_user.box(:in), read_message) }
20
- it { should match /read/ }
21
- it { should_not match /unread/ }
20
+ it { should match(/read/) }
21
+ it { should_not match(/unread/) }
22
22
  end
23
23
  context 'when it is a draft' do
24
24
  subject { helper.message_class(first_user.box(:in), draft_message) }
25
- it { should match /draft/ }
25
+ it { should match(/draft/) }
26
26
  end
27
27
  context 'when it is trashed' do
28
28
  context 'in the inbox' do
29
29
  subject { helper.message_class(first_user.box(:in), trashed_message) }
30
- it { should match /hide/ }
30
+ it { should match(/hide/) }
31
31
  end
32
32
  context 'in the trash box' do
33
- subject { helper.message_class(first_user.box(:trash), trashed_message) }
34
- it { should_not match /hide/ }
33
+ subject do
34
+ helper.message_class(first_user.box(:trash), trashed_message)
35
+ end
36
+ it { should_not match(/hide/) }
35
37
  end
36
38
  end
37
39
  context 'when it is not trashed' do
38
40
  context 'in the inbox' do
39
41
  subject { helper.message_class(first_user.box(:in), unread_message) }
40
- it { should_not match /hide/ }
42
+ it { should_not match(/hide/) }
41
43
  end
42
44
  context 'in the trash box' do
43
45
  subject { helper.message_class(first_user.box(:trash), unread_message) }
44
- it { should match /hide/ }
46
+ it { should match(/hide/) }
45
47
  end
46
48
  end
47
49
  context 'when it is ignored' do
48
50
  context 'in the trash box' do
49
- subject { helper.message_class(first_user.box(:trash), ignored_message) }
50
- it { should match /hide/ }
51
+ subject do
52
+ helper.message_class(first_user.box(:trash), ignored_message)
53
+ end
54
+ it { should match(/hide/) }
51
55
  end
52
56
  end
53
57
  end
@@ -59,13 +63,18 @@ describe MessageTrain::MessagesHelper do
59
63
  assign(:box, first_user.box(:in))
60
64
  end
61
65
  subject { helper.message_trashed_toggle(unread_message) }
62
- it { should have_tag(:a, with: {
63
- 'rel' => 'nofollow',
64
- 'title' => 'Mark as Trashed',
65
- 'data-confirm' => 'Are you sure?',
66
- 'data-method' => 'put',
67
- 'data-remote' => 'true'
68
- }) }
66
+ it do
67
+ should have_tag(
68
+ :a,
69
+ with: {
70
+ 'rel' => 'nofollow',
71
+ 'title' => 'Mark as Trashed',
72
+ 'data-confirm' => 'Are you sure?',
73
+ 'data-method' => 'put',
74
+ 'data-remote' => 'true'
75
+ }
76
+ )
77
+ end
69
78
  it { should have_tag(:span, with: { class: 'glyphicon-trash' }) }
70
79
  end
71
80
  context 'when the message is trashed' do
@@ -73,12 +82,17 @@ describe MessageTrain::MessagesHelper do
73
82
  assign(:box, first_user.box(:trash))
74
83
  end
75
84
  subject { helper.message_trashed_toggle(trashed_message) }
76
- it { should have_tag(:a, with: {
77
- 'rel' => 'nofollow',
78
- 'title' => 'Mark as Untrashed',
79
- 'data-method' => 'put',
80
- 'data-remote' => 'true'
81
- }) }
85
+ it do
86
+ should have_tag(
87
+ :a,
88
+ with: {
89
+ 'rel' => 'nofollow',
90
+ 'title' => 'Mark as Untrashed',
91
+ 'data-method' => 'put',
92
+ 'data-remote' => 'true'
93
+ }
94
+ )
95
+ end
82
96
  it { should have_tag(:span, with: { class: 'glyphicon-inbox' }) }
83
97
  end
84
98
  end
@@ -88,26 +102,38 @@ describe MessageTrain::MessagesHelper do
88
102
  assign(:box, membered_group.box(:in, first_user))
89
103
  end
90
104
  subject { helper.message_trashed_toggle(membered_group_message) }
91
- it { should have_tag(:a, with: {
92
- 'rel' => 'nofollow',
93
- 'title' => 'Mark as Trashed',
94
- 'data-confirm' => 'Are you sure?',
95
- 'data-method' => 'put',
96
- 'data-remote' => 'true'
97
- }) }
105
+ it do
106
+ should have_tag(
107
+ :a,
108
+ with: {
109
+ 'rel' => 'nofollow',
110
+ 'title' => 'Mark as Trashed',
111
+ 'data-confirm' => 'Are you sure?',
112
+ 'data-method' => 'put',
113
+ 'data-remote' => 'true'
114
+ }
115
+ )
116
+ end
98
117
  it { should have_tag(:span, with: { class: 'glyphicon-trash' }) }
99
118
  end
100
119
  context 'when the message is trashed' do
101
120
  before do
102
121
  assign(:box, membered_group.box(:trash, first_user))
103
122
  end
104
- subject { helper.message_trashed_toggle(membered_group_trashed_message) }
105
- it { should have_tag(:a, with: {
106
- 'rel' => 'nofollow',
107
- 'title' => 'Mark as Untrashed',
108
- 'data-method' => 'put',
109
- 'data-remote' => 'true'
110
- }) }
123
+ subject do
124
+ helper.message_trashed_toggle(membered_group_trashed_message)
125
+ end
126
+ it do
127
+ should have_tag(
128
+ :a,
129
+ with: {
130
+ 'rel' => 'nofollow',
131
+ 'title' => 'Mark as Untrashed',
132
+ 'data-method' => 'put',
133
+ 'data-remote' => 'true'
134
+ }
135
+ )
136
+ end
111
137
  it { should have_tag(:span, with: { class: 'glyphicon-inbox' }) }
112
138
  end
113
139
  end
@@ -120,12 +146,17 @@ describe MessageTrain::MessagesHelper do
120
146
  assign(:box, first_user.box(:in))
121
147
  end
122
148
  subject { helper.message_read_toggle(unread_message) }
123
- it { should have_tag(:a, with: {
124
- 'rel' => 'nofollow',
125
- 'title' => 'Mark as Read',
126
- 'data-method' => 'put',
127
- 'data-remote' => 'true'
128
- }) }
149
+ it do
150
+ should have_tag(
151
+ :a,
152
+ with: {
153
+ 'rel' => 'nofollow',
154
+ 'title' => 'Mark as Read',
155
+ 'data-method' => 'put',
156
+ 'data-remote' => 'true'
157
+ }
158
+ )
159
+ end
129
160
  it { should have_tag(:span, with: { class: 'glyphicon-eye-open' }) }
130
161
  end
131
162
  context 'when the message is read' do
@@ -133,12 +164,17 @@ describe MessageTrain::MessagesHelper do
133
164
  assign(:box, first_user.box(:trash))
134
165
  end
135
166
  subject { helper.message_read_toggle(read_message) }
136
- it { should have_tag(:a, with: {
137
- 'rel' => 'nofollow',
138
- 'title' => 'Mark as Unread',
139
- 'data-method' => 'put',
140
- 'data-remote' => 'true'
141
- }) }
167
+ it do
168
+ should have_tag(
169
+ :a,
170
+ with: {
171
+ 'rel' => 'nofollow',
172
+ 'title' => 'Mark as Unread',
173
+ 'data-method' => 'put',
174
+ 'data-remote' => 'true'
175
+ }
176
+ )
177
+ end
142
178
  it { should have_tag(:span, with: { class: 'glyphicon-eye-close' }) }
143
179
  end
144
180
  end
@@ -148,12 +184,17 @@ describe MessageTrain::MessagesHelper do
148
184
  assign(:box, membered_group.box(:in, first_user))
149
185
  end
150
186
  subject { helper.message_read_toggle(membered_group_message) }
151
- it { should have_tag(:a, with: {
152
- 'rel' => 'nofollow',
153
- 'title' => 'Mark as Read',
154
- 'data-method' => 'put',
155
- 'data-remote' => 'true'
156
- }) }
187
+ it do
188
+ should have_tag(
189
+ :a,
190
+ with: {
191
+ 'rel' => 'nofollow',
192
+ 'title' => 'Mark as Read',
193
+ 'data-method' => 'put',
194
+ 'data-remote' => 'true'
195
+ }
196
+ )
197
+ end
157
198
  it { should have_tag(:span, with: { class: 'glyphicon-eye-open' }) }
158
199
  end
159
200
  context 'when the message is read' do
@@ -161,12 +202,17 @@ describe MessageTrain::MessagesHelper do
161
202
  assign(:box, membered_group.box(:trash, first_user))
162
203
  end
163
204
  subject { helper.message_read_toggle(membered_group_read_message) }
164
- it { should have_tag(:a, with: {
165
- 'rel' => 'nofollow',
166
- 'title' => 'Mark as Unread',
167
- 'data-method' => 'put',
168
- 'data-remote' => 'true'
169
- }) }
205
+ it do
206
+ should have_tag(
207
+ :a,
208
+ with: {
209
+ 'rel' => 'nofollow',
210
+ 'title' => 'Mark as Unread',
211
+ 'data-method' => 'put',
212
+ 'data-remote' => 'true'
213
+ }
214
+ )
215
+ end
170
216
  it { should have_tag(:span, with: { class: 'glyphicon-eye-close' }) }
171
217
  end
172
218
  end
@@ -179,13 +225,18 @@ describe MessageTrain::MessagesHelper do
179
225
  assign(:box, first_user.box(:trash))
180
226
  end
181
227
  subject { helper.message_deleted_toggle(unread_message) }
182
- it { should have_tag(:a, with: {
183
- 'rel' => 'nofollow',
184
- 'title' => 'Mark as Deleted',
185
- 'data-confirm' => 'Delete forever? This cannot be undone.',
186
- 'data-method' => 'put',
187
- 'data-remote' => 'true'
188
- }) }
228
+ it do
229
+ should have_tag(
230
+ :a,
231
+ with: {
232
+ 'rel' => 'nofollow',
233
+ 'title' => 'Mark as Deleted',
234
+ 'data-confirm' => 'Delete forever? This cannot be undone.',
235
+ 'data-method' => 'put',
236
+ 'data-remote' => 'true'
237
+ }
238
+ )
239
+ end
189
240
  it { should have_tag(:span, with: { class: 'glyphicon-remove' }) }
190
241
  end
191
242
  end
@@ -195,13 +246,18 @@ describe MessageTrain::MessagesHelper do
195
246
  assign(:box, membered_group.box(:trash, first_user))
196
247
  end
197
248
  subject { helper.message_deleted_toggle(membered_group_message) }
198
- it { should have_tag(:a, with: {
199
- 'rel' => 'nofollow',
200
- 'title' => 'Mark as Deleted',
201
- 'data-confirm' => 'Delete forever? This cannot be undone.',
202
- 'data-method' => 'put',
203
- 'data-remote' => 'true'
204
- }) }
249
+ it do
250
+ should have_tag(
251
+ :a,
252
+ with: {
253
+ 'rel' => 'nofollow',
254
+ 'title' => 'Mark as Deleted',
255
+ 'data-confirm' => 'Delete forever? This cannot be undone.',
256
+ 'data-method' => 'put',
257
+ 'data-remote' => 'true'
258
+ }
259
+ )
260
+ end
205
261
  it { should have_tag(:span, with: { class: 'glyphicon-remove' }) }
206
262
  end
207
263
  end
@@ -209,9 +265,9 @@ describe MessageTrain::MessagesHelper do
209
265
 
210
266
  describe '#message_recipients' do
211
267
  subject { helper.message_recipients(to_many_message) }
212
- it { should match /^([^\,]+\,){2} and ([^\,]+)$/ }
213
- it { should match /Second User/ }
214
- it { should match /Third User/ }
215
- it { should match /Fourth User/ }
268
+ it { should match(/^([^\,]+\,){2} and ([^\,]+)$/) }
269
+ it { should match(/Second User/) }
270
+ it { should match(/Third User/) }
271
+ it { should match(/Fourth User/) }
216
272
  end
217
- end
273
+ end
@@ -1,7 +1,8 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
- describe "MessageTrain" do
3
+ describe 'MessageTrain' do
4
4
  it 'should return correct version string' do
5
- MessageTrain.version_string.should == "MessageTrain version #{MessageTrain::VERSION}"
5
+ MessageTrain.version_string
6
+ .should == "MessageTrain version #{MessageTrain::VERSION}"
6
7
  end
7
8
  end
@@ -1,17 +1,16 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  RSpec.describe Group do
4
+ include_context 'loaded site'
5
+
4
6
  describe 'Model' do
5
7
  # MessageTrain Gem, and Rolify Gem by extension
6
8
  it { should have_many(:roles) }
7
-
8
9
  # MessageTrain Gem
9
10
  it { should have_many(:receipts) }
10
11
  end
11
12
 
12
13
  describe 'Scopes and Methods from Message Train' do
13
- include_context 'loaded site'
14
-
15
14
  describe '#slug_part' do
16
15
  subject { membered_group.slug_part }
17
16
  it { should eq 'membered-group' }
@@ -75,7 +74,9 @@ RSpec.describe Group do
75
74
 
76
75
  describe '#boxes_for_participant' do
77
76
  context 'when participant is a valid sender' do
78
- subject { membered_group.boxes_for_participant(second_user).collect { |x| x.division } }
77
+ subject do
78
+ membered_group.boxes_for_participant(second_user).collect(&:division)
79
+ end
79
80
  it { should_not include :in }
80
81
  it { should include :sent }
81
82
  it { should include :drafts }
@@ -84,7 +85,9 @@ RSpec.describe Group do
84
85
  it { should_not include :ignored }
85
86
  end
86
87
  context 'when participant is a valid recipient' do
87
- subject { membered_group.boxes_for_participant(first_user).collect { |x| x.division } }
88
+ subject do
89
+ membered_group.boxes_for_participant(first_user).collect(&:division)
90
+ end
88
91
  it { should include :in }
89
92
  it { should_not include :sent }
90
93
  it { should_not include :drafts }
@@ -100,7 +103,8 @@ RSpec.describe Group do
100
103
  its(:first) { should be_a MessageTrain::Conversation }
101
104
  it { should_not include unread_conversation }
102
105
  it { should include membered_group_conversation }
103
- it { should_not include membered_group_draft } # Because received_through not set on sender receipts
106
+ # Because received_through not set on sender receipts
107
+ it { should_not include membered_group_draft }
104
108
  end
105
109
  context 'when participant is a valid recipient' do
106
110
  subject { membered_group.all_conversations(first_user) }
@@ -117,7 +121,8 @@ RSpec.describe Group do
117
121
  its(:first) { should be_a MessageTrain::Message }
118
122
  it { should_not include unread_message }
119
123
  it { should include membered_group_message }
120
- it { should_not include membered_group_draft.messages.first } # Because received_through not set on sender receipts
124
+ # Because received_through not set on sender receipts
125
+ it { should_not include membered_group_draft.messages.first }
121
126
  end
122
127
  context 'when participant is a valid recipient' do
123
128
  subject { membered_group.all_messages(first_user) }
@@ -127,7 +132,5 @@ RSpec.describe Group do
127
132
  it { should_not include membered_group_draft.messages.first }
128
133
  end
129
134
  end
130
-
131
135
  end
132
-
133
136
  end
@@ -8,36 +8,39 @@ module MessageTrain
8
8
  it { should belong_to :message }
9
9
  it { should have_attached_file :attachment }
10
10
  it { should validate_attachment_presence :attachment }
11
- it { should validate_attachment_content_type(:attachment).allowing(
12
- 'application/pdf',
13
- 'application/vnd.ms-excel',
14
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
15
- 'application/msword',
16
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
17
- 'application/rtf',
18
- 'text/plain',
19
- 'image/bmp',
20
- 'image/gif',
21
- 'image/jpeg',
22
- 'image/pjpeg',
23
- 'image/png',
24
- 'image/x-png',
25
- 'application/bmp',
26
- 'application/gif',
27
- 'application/jpeg',
28
- 'application/pjpeg',
29
- 'application/png',
30
- 'application/x-png',
31
- 'x-application/bmp',
32
- 'x-application/gif',
33
- 'x-application/jpeg',
34
- 'x-application/pjpeg',
35
- 'x-application/png',
36
- 'x-application/x-png'
37
- ).rejecting(
38
- 'image/tiff',
39
- 'image/svg'
40
- ) }
11
+ it do
12
+ should validate_attachment_content_type(:attachment).allowing(
13
+ 'application/pdf',
14
+ 'application/vnd.ms-excel',
15
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
16
+ 'application/msword',
17
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.'\
18
+ 'document',
19
+ 'application/rtf',
20
+ 'text/plain',
21
+ 'image/bmp',
22
+ 'image/gif',
23
+ 'image/jpeg',
24
+ 'image/pjpeg',
25
+ 'image/png',
26
+ 'image/x-png',
27
+ 'application/bmp',
28
+ 'application/gif',
29
+ 'application/jpeg',
30
+ 'application/pjpeg',
31
+ 'application/png',
32
+ 'application/x-png',
33
+ 'x-application/bmp',
34
+ 'x-application/gif',
35
+ 'x-application/jpeg',
36
+ 'x-application/pjpeg',
37
+ 'x-application/png',
38
+ 'x-application/x-png'
39
+ ).rejecting(
40
+ 'image/tiff',
41
+ 'image/svg'
42
+ )
43
+ end
41
44
  end
42
45
  describe 'Scopes and Methods' do
43
46
  describe '#image?' do