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.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -1
- data/.scss-lint.yml +7 -0
- data/.simplecov +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +6 -2
- data/LICENSE.txt +2 -2
- data/README.rdoc +5 -5
- data/Rakefile +22 -21
- data/VERSION +1 -1
- data/app/assets/javascripts/message_train.js +1 -1
- data/app/assets/stylesheets/message_train.scss +29 -19
- data/app/controllers/concerns/message_train_support.rb +41 -37
- data/app/controllers/message_train/application_controller.rb +1 -0
- data/app/controllers/message_train/boxes_controller.rb +5 -4
- data/app/controllers/message_train/conversations_controller.rb +8 -7
- data/app/controllers/message_train/messages_controller.rb +25 -22
- data/app/controllers/message_train/participants_controller.rb +27 -23
- data/app/controllers/message_train/unsubscribes_controller.rb +37 -23
- data/app/helpers/message_train/application_helper.rb +6 -8
- data/app/helpers/message_train/attachments_helper.rb +12 -4
- data/app/helpers/message_train/boxes_helper.rb +38 -11
- data/app/helpers/message_train/collectives_helper.rb +38 -12
- data/app/helpers/message_train/conversations_helper.rb +43 -35
- data/app/helpers/message_train/messages_helper.rb +32 -25
- data/app/mailers/message_train/application_mailer.rb +7 -4
- data/app/mailers/message_train/previews/receipt_mailer_preview.rb +2 -3
- data/app/mailers/message_train/receipt_mailer.rb +14 -4
- data/app/models/message_train/attachment.rb +41 -25
- data/app/models/message_train/box.rb +159 -122
- data/app/models/message_train/conversation.rb +84 -41
- data/app/models/message_train/ignore.rb +8 -2
- data/app/models/message_train/message.rb +72 -42
- data/app/models/message_train/receipt.rb +30 -17
- data/app/models/message_train/unsubscribe.rb +1 -0
- data/app/views/application/404.html.haml +1 -1
- data/app/views/layouts/mailer.html.haml +2 -2
- data/app/views/layouts/mailer.text.haml +1 -1
- data/app/views/message_train/application/_attachment_fields.html.haml +1 -1
- data/app/views/message_train/application/_widget.html.haml +1 -1
- data/app/views/message_train/application/results.json.jbuilder +1 -1
- data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/boxes/_list_item.html.haml +1 -1
- data/app/views/message_train/boxes/show.html.haml +1 -1
- data/app/views/message_train/collectives/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/collectives/_list_item.html.haml +1 -1
- data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_ignored_toggle.html.haml +2 -2
- data/app/views/message_train/conversations/_read_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_trashed_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/show.html.haml +2 -2
- data/app/views/message_train/conversations/show.json.jbuilder +5 -1
- data/app/views/message_train/messages/_form.html.haml +1 -1
- data/app/views/message_train/messages/_message.html.haml +6 -6
- data/app/views/message_train/messages/_toggle.html.haml +1 -1
- data/app/views/message_train/messages/show.json.jbuilder +5 -1
- data/app/views/message_train/participants/_participant.json.jbuilder +1 -1
- data/app/views/message_train/participants/index.json.jbuilder +1 -1
- data/app/views/message_train/participants/show.json.jbuilder +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.html.haml +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.text.haml +1 -1
- data/app/views/message_train/unsubscribes/index.html.haml +1 -1
- data/config/environment.rb +1 -1
- data/config/initializers/date_time.rb +2 -2
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +37 -15
- data/lib/generators/message_train/install/install_generator.rb +26 -11
- data/lib/generators/message_train/install/templates/initializer.rb +0 -2
- data/lib/generators/message_train/utils.rb +11 -4
- data/lib/message_train/configuration.rb +4 -5
- data/lib/message_train/engine.rb +1 -7
- data/lib/message_train/localization.rb +14 -18
- data/lib/message_train/mixin.rb +211 -150
- data/lib/message_train/version.rb +1 -0
- data/lib/message_train.rb +7 -6
- data/message_train.gemspec +24 -11
- data/spec/controllers/message_train/boxes_controller_spec.rb +63 -15
- data/spec/controllers/message_train/concerns_spec.rb +17 -13
- data/spec/controllers/message_train/conversations_controller_spec.rb +44 -12
- data/spec/controllers/message_train/messages_controller_spec.rb +87 -40
- data/spec/controllers/message_train/participants_controller_spec.rb +10 -4
- data/spec/controllers/message_train/unsubscribes_controller_spec.rb +43 -13
- data/spec/dummy/Rakefile +2 -1
- data/spec/dummy/app/assets/stylesheets/application.css.scss +7 -23
- data/spec/dummy/app/controllers/application_controller.rb +7 -7
- data/spec/dummy/app/models/group.rb +1 -1
- data/spec/dummy/app/models/role.rb +11 -7
- data/spec/dummy/app/models/user.rb +6 -5
- data/spec/dummy/app/views/layouts/_top_navigation.html.haml +1 -1
- data/spec/dummy/app/views/layouts/application.html.haml +1 -1
- data/spec/dummy/app/views/pages/index.html.haml +1 -1
- data/spec/dummy/config/application.rb +23 -17
- data/spec/dummy/config/environments/development.rb +5 -4
- data/spec/dummy/config/environments/production.rb +10 -6
- data/spec/dummy/config/environments/test.rb +4 -3
- data/spec/dummy/config/initializers/assets.rb +2 -1
- data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -2
- data/spec/dummy/config/initializers/bootstrap_leather.rb +1 -1
- data/spec/dummy/config/initializers/devise.rb +63 -44
- data/spec/dummy/config/initializers/high_voltage.rb +1 -1
- data/spec/dummy/config/initializers/message_train.rb +5 -2
- data/spec/dummy/config/initializers/mime_types.rb +1 -1
- data/spec/dummy/config/initializers/paperclip.rb +5 -2
- data/spec/dummy/config/initializers/rolify.rb +3 -2
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -1
- data/spec/dummy/config/routes.rb +1 -3
- data/spec/dummy/config/settings.yml +1 -1
- data/spec/dummy/db/schema.rb +98 -98
- data/spec/dummy/db/seeds/conversations.seeds.rb +160 -160
- data/spec/dummy/db/seeds/development/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/groups.seeds.rb +11 -12
- data/spec/dummy/db/seeds/test/attachments.seeds.rb +13 -3
- data/spec/dummy/db/seeds/test/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/unsubscribes.seeds.rb +1 -1
- data/spec/dummy/db/seeds/users.seeds.rb +47 -42
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/attachment.rb +6 -2
- data/spec/factories/group.rb +1 -4
- data/spec/factories/message.rb +29 -23
- data/spec/factories/user.rb +6 -4
- data/spec/features/boxes_spec.rb +76 -24
- data/spec/features/conversations_spec.rb +19 -7
- data/spec/features/messages_spec.rb +24 -5
- data/spec/features/unsubscribes_spec.rb +36 -9
- data/spec/helpers/message_train/application_helper_spec.rb +1 -1
- data/spec/helpers/message_train/attachment_helper_spec.rb +27 -12
- data/spec/helpers/message_train/boxes_helper_spec.rb +1 -1
- data/spec/helpers/message_train/collectives_helper_spec.rb +25 -9
- data/spec/helpers/message_train/conversations_helper_spec.rb +239 -120
- data/spec/helpers/message_train/messages_helper_spec.rb +137 -81
- data/spec/message_train_spec.rb +3 -2
- data/spec/models/group_spec.rb +12 -9
- data/spec/models/message_train/attachment_spec.rb +33 -30
- data/spec/models/message_train/box_spec.rb +243 -60
- data/spec/models/message_train/conversation_spec.rb +16 -12
- data/spec/models/message_train/ignore_spec.rb +3 -1
- data/spec/models/message_train/message_spec.rb +22 -7
- data/spec/models/message_train/receipt_spec.rb +14 -4
- data/spec/models/role_spec.rb +10 -6
- data/spec/models/user_spec.rb +74 -22
- data/spec/rails_helper.rb +9 -4
- data/spec/spec_helper.rb +6 -54
- data/spec/support/controller_behaviors.rb +8 -5
- data/spec/support/controller_macros.rb +2 -2
- data/spec/support/factory_girl.rb +1 -1
- data/spec/support/feature_behaviors.rb +42 -13
- data/spec/support/loaded_site/attachments.rb +8 -0
- data/spec/support/loaded_site/conversations.rb +73 -0
- data/spec/support/{groups.rb → loaded_site/groups.rb} +1 -1
- data/spec/support/{loaded_site.rb → loaded_site/loaded_site.rb} +1 -1
- data/spec/support/{messages.rb → loaded_site/messages.rb} +13 -5
- data/spec/support/{roles.rb → loaded_site/roles.rb} +1 -1
- data/spec/support/{users.rb → loaded_site/users.rb} +1 -1
- data/spec/support/shared_connection.rb +8 -6
- data/spec/support/utilities.rb +10 -10
- metadata +67 -10
- data/spec/dummy/config/unused/temporary_i18n_debugging.rb +0 -12
- data/spec/support/attachments.rb +0 -4
- 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
|
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
|
21
|
-
it { should_not match
|
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
|
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
|
30
|
+
it { should match(/hide/) }
|
31
31
|
end
|
32
32
|
context 'in the trash box' do
|
33
|
-
subject
|
34
|
-
|
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
|
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
|
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
|
50
|
-
|
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
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
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
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
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
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
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
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
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
|
213
|
-
it { should match
|
214
|
-
it { should match
|
215
|
-
it { should match
|
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
|
data/spec/message_train_spec.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'MessageTrain' do
|
4
4
|
it 'should return correct version string' do
|
5
|
-
MessageTrain.version_string
|
5
|
+
MessageTrain.version_string
|
6
|
+
.should == "MessageTrain version #{MessageTrain::VERSION}"
|
6
7
|
end
|
7
8
|
end
|
data/spec/models/group_spec.rb
CHANGED
@@ -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
|
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
|
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
|
-
|
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
|
-
|
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
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|