message_train 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.simplecov +8 -0
- data/.travis.yml +7 -2
- data/Gemfile +3 -0
- data/README.rdoc +37 -1
- data/Rakefile +5 -6
- data/VERSION +1 -1
- data/app/assets/javascripts/message_train.js +33 -0
- data/app/assets/stylesheets/message_train.scss +26 -0
- data/app/controllers/concerns/message_train_support.rb +127 -0
- data/app/controllers/message_train/application_controller.rb +1 -60
- data/app/controllers/message_train/boxes_controller.rb +0 -4
- data/app/controllers/message_train/messages_controller.rb +12 -6
- data/app/controllers/message_train/participants_controller.rb +1 -1
- data/app/controllers/message_train/unsubscribes_controller.rb +59 -0
- data/app/helpers/message_train/application_helper.rb +26 -0
- data/app/helpers/message_train/attachments_helper.rb +19 -0
- data/app/helpers/message_train/boxes_helper.rb +16 -11
- data/app/helpers/message_train/collectives_helper.rb +48 -0
- data/app/helpers/message_train/conversations_helper.rb +24 -16
- data/app/helpers/message_train/messages_helper.rb +14 -12
- data/app/mailers/message_train/application_mailer.rb +8 -0
- data/app/mailers/message_train/previews/receipt_mailer_preview.rb +10 -0
- data/app/mailers/message_train/receipt_mailer.rb +17 -0
- data/app/models/message_train/attachment.rb +28 -10
- data/app/models/message_train/box.rb +114 -83
- data/app/models/message_train/conversation.rb +48 -39
- data/app/models/message_train/ignore.rb +2 -6
- data/app/models/message_train/message.rb +40 -24
- data/app/models/message_train/receipt.rb +20 -10
- data/app/models/message_train/unsubscribe.rb +7 -0
- data/app/views/layouts/mailer.html.haml +6 -0
- data/app/views/message_train/application/_attachment_fields.html.haml +7 -0
- data/app/views/message_train/application/_attachment_link.html.haml +4 -0
- data/app/views/message_train/application/_widget.html.haml +6 -0
- data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -2
- data/app/views/message_train/boxes/_list_item.html.haml +2 -2
- data/app/views/message_train/boxes/_widget.html.haml +4 -1
- data/app/views/message_train/boxes/show.html.haml +12 -4
- data/app/views/message_train/collectives/_dropdown_list.html.haml +6 -0
- data/app/views/message_train/collectives/_list_item.html.haml +5 -0
- data/app/views/message_train/collectives/_widget.html.haml +7 -0
- data/app/views/message_train/conversations/_conversation.html.haml +22 -7
- data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_ignored_toggle.html.haml +3 -3
- data/app/views/message_train/conversations/_read_toggle.html.haml +3 -3
- data/app/views/message_train/conversations/_toggle.html.haml +4 -1
- data/app/views/message_train/conversations/_trashed_toggle.html.haml +3 -3
- data/app/views/message_train/conversations/show.html.haml +4 -3
- data/app/views/message_train/messages/_deleted_toggle.html.haml +1 -1
- data/app/views/message_train/messages/_form.html.haml +22 -7
- data/app/views/message_train/messages/_message.html.haml +14 -4
- data/app/views/message_train/messages/_read_toggle.html.haml +1 -1
- data/app/views/message_train/messages/_trashed_toggle.html.haml +1 -1
- data/app/views/message_train/messages/edit.html.haml +1 -1
- data/app/views/message_train/messages/new.html.haml +4 -1
- data/app/views/message_train/participants/_field.html.haml +1 -1
- data/app/views/message_train/participants/_prefilled_field.html.haml +4 -0
- data/app/views/message_train/receipt_mailer/notification_email.html.haml +13 -0
- data/app/views/message_train/unsubscribes/index.html.haml +10 -0
- data/config/environment.rb +1 -0
- data/config/locales/en.yml +49 -7
- data/config/routes.rb +10 -2
- data/db/migrate/20150901183458_add_received_through_to_message_train_receipts.rb +6 -0
- data/db/migrate/20151004184347_add_unique_index_to_receipts.rb +5 -0
- data/db/migrate/20151124000820_create_message_train_unsubscribes.rb +14 -0
- data/lib/generators/message_train/install/install_generator.rb +8 -2
- data/lib/generators/message_train/install/templates/initializer.rb +5 -1
- data/lib/message_train/configuration.rb +11 -1
- data/lib/message_train/engine.rb +1 -0
- data/lib/message_train/mixin.rb +206 -21
- data/message_train.gemspec +66 -13
- data/spec/controllers/message_train/boxes_controller_spec.rb +10 -3
- data/spec/controllers/message_train/concerns_spec.rb +40 -0
- data/spec/controllers/message_train/conversations_controller_spec.rb +3 -3
- data/spec/controllers/message_train/messages_controller_spec.rb +60 -27
- data/spec/controllers/message_train/participants_controller_spec.rb +41 -6
- data/spec/controllers/message_train/unsubscribes_controller_spec.rb +56 -0
- data/spec/dummy/app/assets/files/message_train/attachments/{1917-Boys_Race_Above-Wiki.jpg → image-sample.jpg} +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/models/group.rb +16 -1
- data/spec/dummy/app/models/role.rb +22 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/app/views/layouts/_top_navigation.html.haml +4 -2
- data/spec/dummy/app/views/layouts/application.html.haml +2 -3
- data/spec/dummy/app/views/pages/index.html.haml +4 -0
- data/spec/dummy/config/application.rb +6 -0
- data/spec/dummy/config/environments/development.rb +1 -0
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/config/initializers/high_voltage.rb +3 -0
- data/spec/dummy/config/initializers/message_train.rb +6 -1
- data/spec/dummy/config/initializers/paperclip.rb +2 -2
- data/spec/dummy/config/routes.rb +2 -2
- data/spec/dummy/config/settings.yml +9 -0
- data/spec/dummy/db/migrate/{20150724142846_create_message_train_conversations.night_train.rb → 20150901183629_create_message_train_conversations.message_train.rb} +0 -0
- data/spec/dummy/db/migrate/{20150724142847_create_message_train_messages.night_train.rb → 20150901183630_create_message_train_messages.message_train.rb} +0 -0
- data/spec/dummy/db/migrate/{20150724142848_create_message_train_attachments.night_train.rb → 20150901183631_create_message_train_attachments.message_train.rb} +0 -0
- data/spec/dummy/db/migrate/{20150724142849_create_message_train_receipts.night_train.rb → 20150901183632_create_message_train_receipts.message_train.rb} +0 -0
- data/spec/dummy/db/migrate/{20150724142850_create_message_train_ignores.night_train.rb → 20150901183633_create_message_train_ignores.message_train.rb} +0 -0
- data/spec/dummy/db/migrate/20150901183634_add_received_through_to_message_train_receipts.message_train.rb +7 -0
- data/spec/dummy/db/migrate/20151004184519_add_unique_index_to_receipts.message_train.rb +6 -0
- data/spec/dummy/db/migrate/20151124001417_create_message_train_unsubscribes.message_train.rb +15 -0
- data/spec/dummy/db/schema.rb +24 -7
- data/spec/dummy/db/seeds/conversations.seeds.rb +92 -3
- data/spec/dummy/db/seeds/groups.seeds.rb +27 -0
- data/spec/dummy/db/seeds/test/attachments.seeds.rb +4 -0
- data/spec/dummy/db/seeds/unsubscribes.seeds.rb +12 -0
- data/spec/dummy/db/seeds/users.seeds.rb +27 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/group.rb +4 -4
- data/spec/factories/message.rb +10 -3
- data/spec/features/boxes_spec.rb +160 -33
- data/spec/features/conversations_spec.rb +11 -4
- data/spec/features/messages_spec.rb +20 -6
- data/spec/features/unsubscribes_spec.rb +38 -0
- data/spec/helpers/message_train/application_helper_spec.rb +60 -0
- data/spec/helpers/message_train/attachment_helper_spec.rb +35 -0
- data/spec/helpers/message_train/boxes_helper_spec.rb +11 -5
- data/spec/helpers/message_train/collectives_helper_spec.rb +76 -0
- data/spec/helpers/message_train/conversations_helper_spec.rb +295 -0
- data/spec/helpers/message_train/messages_helper_spec.rb +217 -0
- data/spec/models/group_spec.rb +112 -2
- data/spec/models/message_train/attachment_spec.rb +44 -1
- data/spec/models/message_train/box_spec.rb +306 -51
- data/spec/models/message_train/conversation_spec.rb +84 -6
- data/spec/models/message_train/ignore_spec.rb +0 -4
- data/spec/models/message_train/message_spec.rb +49 -12
- data/spec/models/message_train/receipt_spec.rb +44 -8
- data/spec/models/message_train/unsubscribe_spec.rb +16 -0
- data/spec/models/role_spec.rb +125 -0
- data/spec/models/user_spec.rb +155 -26
- data/spec/rails_helper.rb +8 -1
- data/spec/support/attachments.rb +4 -0
- data/spec/support/controller_behaviors.rb +28 -0
- data/spec/support/conversations.rb +13 -0
- data/spec/support/groups.rb +3 -0
- data/spec/support/loaded_site.rb +3 -0
- data/spec/support/messages.rb +23 -0
- data/spec/support/roles.rb +4 -0
- data/spec/support/users.rb +6 -0
- data/spec/support/wysihtml5_helper.rb +8 -0
- metadata +99 -12
- data/spec/dummy/app/assets/files/message_train/attachments/Haie_rci.svg +0 -1714
- data/spec/dummy/public/capybara.html +0 -193
data/message_train.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: message_train 0.
|
5
|
+
# stub: message_train 0.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "message_train"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.2.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Karen Lundgren"]
|
14
|
-
s.date = "2015-
|
15
|
-
s.description = "
|
14
|
+
s.date = "2015-11-24"
|
15
|
+
s.description = "Rails 4 Engine providing private/public messaging for any object, such as Users or Groups"
|
16
16
|
s.email = "karen.e.lundgren@gmail.com"
|
17
17
|
s.executables = ["rails"]
|
18
18
|
s.extra_rdoc_files = [
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
".rspec",
|
25
25
|
".ruby-gemset",
|
26
26
|
".ruby-version",
|
27
|
+
".simplecov",
|
27
28
|
".travis.yml",
|
28
29
|
"Gemfile",
|
29
30
|
"LICENSE.txt",
|
@@ -32,26 +33,42 @@ Gem::Specification.new do |s|
|
|
32
33
|
"VERSION",
|
33
34
|
"app/assets/javascripts/message_train.js",
|
34
35
|
"app/assets/stylesheets/message_train.scss",
|
36
|
+
"app/controllers/concerns/message_train_support.rb",
|
35
37
|
"app/controllers/message_train/application_controller.rb",
|
36
38
|
"app/controllers/message_train/boxes_controller.rb",
|
37
39
|
"app/controllers/message_train/conversations_controller.rb",
|
38
40
|
"app/controllers/message_train/messages_controller.rb",
|
39
41
|
"app/controllers/message_train/participants_controller.rb",
|
42
|
+
"app/controllers/message_train/unsubscribes_controller.rb",
|
43
|
+
"app/helpers/message_train/application_helper.rb",
|
44
|
+
"app/helpers/message_train/attachments_helper.rb",
|
40
45
|
"app/helpers/message_train/boxes_helper.rb",
|
46
|
+
"app/helpers/message_train/collectives_helper.rb",
|
41
47
|
"app/helpers/message_train/conversations_helper.rb",
|
42
48
|
"app/helpers/message_train/messages_helper.rb",
|
49
|
+
"app/mailers/message_train/application_mailer.rb",
|
50
|
+
"app/mailers/message_train/previews/receipt_mailer_preview.rb",
|
51
|
+
"app/mailers/message_train/receipt_mailer.rb",
|
43
52
|
"app/models/message_train/attachment.rb",
|
44
53
|
"app/models/message_train/box.rb",
|
45
54
|
"app/models/message_train/conversation.rb",
|
46
55
|
"app/models/message_train/ignore.rb",
|
47
56
|
"app/models/message_train/message.rb",
|
48
57
|
"app/models/message_train/receipt.rb",
|
58
|
+
"app/models/message_train/unsubscribe.rb",
|
49
59
|
"app/views/application/404.html.haml",
|
60
|
+
"app/views/layouts/mailer.html.haml",
|
61
|
+
"app/views/message_train/application/_attachment_fields.html.haml",
|
62
|
+
"app/views/message_train/application/_attachment_link.html.haml",
|
63
|
+
"app/views/message_train/application/_widget.html.haml",
|
50
64
|
"app/views/message_train/application/results.json.jbuilder",
|
51
65
|
"app/views/message_train/boxes/_dropdown_list.html.haml",
|
52
66
|
"app/views/message_train/boxes/_list_item.html.haml",
|
53
67
|
"app/views/message_train/boxes/_widget.html.haml",
|
54
68
|
"app/views/message_train/boxes/show.html.haml",
|
69
|
+
"app/views/message_train/collectives/_dropdown_list.html.haml",
|
70
|
+
"app/views/message_train/collectives/_list_item.html.haml",
|
71
|
+
"app/views/message_train/collectives/_widget.html.haml",
|
55
72
|
"app/views/message_train/conversations/_conversation.html.haml",
|
56
73
|
"app/views/message_train/conversations/_deleted_toggle.html.haml",
|
57
74
|
"app/views/message_train/conversations/_ignored_toggle.html.haml",
|
@@ -71,9 +88,13 @@ Gem::Specification.new do |s|
|
|
71
88
|
"app/views/message_train/messages/show.json.jbuilder",
|
72
89
|
"app/views/message_train/participants/_field.html.haml",
|
73
90
|
"app/views/message_train/participants/_participant.json.jbuilder",
|
91
|
+
"app/views/message_train/participants/_prefilled_field.html.haml",
|
74
92
|
"app/views/message_train/participants/index.json.jbuilder",
|
75
93
|
"app/views/message_train/participants/show.json.jbuilder",
|
94
|
+
"app/views/message_train/receipt_mailer/notification_email.html.haml",
|
95
|
+
"app/views/message_train/unsubscribes/index.html.haml",
|
76
96
|
"bin/rails",
|
97
|
+
"config/environment.rb",
|
77
98
|
"config/initializers/bootstrap_pager_config.rb",
|
78
99
|
"config/initializers/date_time.rb",
|
79
100
|
"config/locales/en.yml",
|
@@ -83,6 +104,9 @@ Gem::Specification.new do |s|
|
|
83
104
|
"db/migrate/20150721161144_create_message_train_attachments.rb",
|
84
105
|
"db/migrate/20150721161940_create_message_train_receipts.rb",
|
85
106
|
"db/migrate/20150721163838_create_message_train_ignores.rb",
|
107
|
+
"db/migrate/20150901183458_add_received_through_to_message_train_receipts.rb",
|
108
|
+
"db/migrate/20151004184347_add_unique_index_to_receipts.rb",
|
109
|
+
"db/migrate/20151124000820_create_message_train_unsubscribes.rb",
|
86
110
|
"lib/generators/message_train/install/install_generator.rb",
|
87
111
|
"lib/generators/message_train/install/templates/initializer.rb",
|
88
112
|
"lib/generators/message_train/utils.rb",
|
@@ -95,12 +119,13 @@ Gem::Specification.new do |s|
|
|
95
119
|
"lib/tasks/message_train_tasks.rake",
|
96
120
|
"message_train.gemspec",
|
97
121
|
"spec/controllers/message_train/boxes_controller_spec.rb",
|
122
|
+
"spec/controllers/message_train/concerns_spec.rb",
|
98
123
|
"spec/controllers/message_train/conversations_controller_spec.rb",
|
99
124
|
"spec/controllers/message_train/messages_controller_spec.rb",
|
100
125
|
"spec/controllers/message_train/participants_controller_spec.rb",
|
126
|
+
"spec/controllers/message_train/unsubscribes_controller_spec.rb",
|
101
127
|
"spec/dummy/.rspec",
|
102
128
|
"spec/dummy/Rakefile",
|
103
|
-
"spec/dummy/app/assets/files/message_train/attachments/1917-Boys_Race_Above-Wiki.jpg",
|
104
129
|
"spec/dummy/app/assets/files/message_train/attachments/ACD_Silverbarn's_Mayumi.jpg",
|
105
130
|
"spec/dummy/app/assets/files/message_train/attachments/ACD_obedience.jpg",
|
106
131
|
"spec/dummy/app/assets/files/message_train/attachments/A_Man_and_His_Dog.jpg",
|
@@ -120,7 +145,6 @@ Gem::Specification.new do |s|
|
|
120
145
|
"spec/dummy/app/assets/files/message_train/attachments/Galgo_Spanish_male_brindle.jpg",
|
121
146
|
"spec/dummy/app/assets/files/message_train/attachments/Golden-retriever-carlos-bei-der-dummyarbeit.jpg",
|
122
147
|
"spec/dummy/app/assets/files/message_train/attachments/Habavk.jpg",
|
123
|
-
"spec/dummy/app/assets/files/message_train/attachments/Haie_rci.svg",
|
124
148
|
"spec/dummy/app/assets/files/message_train/attachments/Hanging_18.jpg",
|
125
149
|
"spec/dummy/app/assets/files/message_train/attachments/Hundewa.jpg",
|
126
150
|
"spec/dummy/app/assets/files/message_train/attachments/K9ProSports_AttackOnHandler.jpg",
|
@@ -128,6 +152,7 @@ Gem::Specification.new do |s|
|
|
128
152
|
"spec/dummy/app/assets/files/message_train/attachments/K9Pro_Civil_agitation.JPG",
|
129
153
|
"spec/dummy/app/assets/files/message_train/attachments/TrainingSchutzhundRetrieveOverWall.jpg",
|
130
154
|
"spec/dummy/app/assets/files/message_train/attachments/example.pdf",
|
155
|
+
"spec/dummy/app/assets/files/message_train/attachments/image-sample.jpg",
|
131
156
|
"spec/dummy/app/assets/files/message_train/attachments/letterlegal5.doc",
|
132
157
|
"spec/dummy/app/assets/files/message_train/attachments/pdf-sample.pdf",
|
133
158
|
"spec/dummy/app/assets/files/message_train/attachments/sample.pdf",
|
@@ -145,6 +170,7 @@ Gem::Specification.new do |s|
|
|
145
170
|
"spec/dummy/app/models/user.rb",
|
146
171
|
"spec/dummy/app/views/layouts/_top_navigation.html.haml",
|
147
172
|
"spec/dummy/app/views/layouts/application.html.haml",
|
173
|
+
"spec/dummy/app/views/pages/index.html.haml",
|
148
174
|
"spec/dummy/bin/bundle",
|
149
175
|
"spec/dummy/bin/rails",
|
150
176
|
"spec/dummy/bin/rake",
|
@@ -163,6 +189,7 @@ Gem::Specification.new do |s|
|
|
163
189
|
"spec/dummy/config/initializers/cookies_serializer.rb",
|
164
190
|
"spec/dummy/config/initializers/devise.rb",
|
165
191
|
"spec/dummy/config/initializers/filter_parameter_logging.rb",
|
192
|
+
"spec/dummy/config/initializers/high_voltage.rb",
|
166
193
|
"spec/dummy/config/initializers/inflections.rb",
|
167
194
|
"spec/dummy/config/initializers/message_train.rb",
|
168
195
|
"spec/dummy/config/initializers/mime_types.rb",
|
@@ -174,22 +201,28 @@ Gem::Specification.new do |s|
|
|
174
201
|
"spec/dummy/config/locales/en.yml",
|
175
202
|
"spec/dummy/config/routes.rb",
|
176
203
|
"spec/dummy/config/secrets.yml",
|
204
|
+
"spec/dummy/config/settings.yml",
|
177
205
|
"spec/dummy/config/unused/temporary_i18n_debugging.rb",
|
178
206
|
"spec/dummy/db/migrate/20150721140013_devise_create_users.rb",
|
179
207
|
"spec/dummy/db/migrate/20150721141009_rolify_create_roles.rb",
|
180
208
|
"spec/dummy/db/migrate/20150721141128_create_groups.rb",
|
181
209
|
"spec/dummy/db/migrate/20150721150307_add_display_name_column_to_users.rb",
|
182
|
-
"spec/dummy/db/migrate/
|
183
|
-
"spec/dummy/db/migrate/
|
184
|
-
"spec/dummy/db/migrate/
|
185
|
-
"spec/dummy/db/migrate/
|
186
|
-
"spec/dummy/db/migrate/
|
210
|
+
"spec/dummy/db/migrate/20150901183629_create_message_train_conversations.message_train.rb",
|
211
|
+
"spec/dummy/db/migrate/20150901183630_create_message_train_messages.message_train.rb",
|
212
|
+
"spec/dummy/db/migrate/20150901183631_create_message_train_attachments.message_train.rb",
|
213
|
+
"spec/dummy/db/migrate/20150901183632_create_message_train_receipts.message_train.rb",
|
214
|
+
"spec/dummy/db/migrate/20150901183633_create_message_train_ignores.message_train.rb",
|
215
|
+
"spec/dummy/db/migrate/20150901183634_add_received_through_to_message_train_receipts.message_train.rb",
|
216
|
+
"spec/dummy/db/migrate/20151004184519_add_unique_index_to_receipts.message_train.rb",
|
217
|
+
"spec/dummy/db/migrate/20151124001417_create_message_train_unsubscribes.message_train.rb",
|
187
218
|
"spec/dummy/db/schema.rb",
|
188
219
|
"spec/dummy/db/seeds.rb",
|
189
220
|
"spec/dummy/db/seeds/conversations.seeds.rb",
|
190
221
|
"spec/dummy/db/seeds/development/conversations.seeds.rb",
|
191
222
|
"spec/dummy/db/seeds/groups.seeds.rb",
|
223
|
+
"spec/dummy/db/seeds/test/attachments.seeds.rb",
|
192
224
|
"spec/dummy/db/seeds/test/conversations.seeds.rb",
|
225
|
+
"spec/dummy/db/seeds/unsubscribes.seeds.rb",
|
193
226
|
"spec/dummy/db/seeds/users.seeds.rb",
|
194
227
|
"spec/dummy/db/test.sqlite3",
|
195
228
|
"spec/dummy/lib/assets/.keep",
|
@@ -197,7 +230,6 @@ Gem::Specification.new do |s|
|
|
197
230
|
"spec/dummy/public/404.html",
|
198
231
|
"spec/dummy/public/422.html",
|
199
232
|
"spec/dummy/public/500.html",
|
200
|
-
"spec/dummy/public/capybara.html",
|
201
233
|
"spec/dummy/public/favicon.ico",
|
202
234
|
"spec/factories/attachment.rb",
|
203
235
|
"spec/factories/group.rb",
|
@@ -206,7 +238,13 @@ Gem::Specification.new do |s|
|
|
206
238
|
"spec/features/boxes_spec.rb",
|
207
239
|
"spec/features/conversations_spec.rb",
|
208
240
|
"spec/features/messages_spec.rb",
|
241
|
+
"spec/features/unsubscribes_spec.rb",
|
242
|
+
"spec/helpers/message_train/application_helper_spec.rb",
|
243
|
+
"spec/helpers/message_train/attachment_helper_spec.rb",
|
209
244
|
"spec/helpers/message_train/boxes_helper_spec.rb",
|
245
|
+
"spec/helpers/message_train/collectives_helper_spec.rb",
|
246
|
+
"spec/helpers/message_train/conversations_helper_spec.rb",
|
247
|
+
"spec/helpers/message_train/messages_helper_spec.rb",
|
210
248
|
"spec/message_train_spec.rb",
|
211
249
|
"spec/models/group_spec.rb",
|
212
250
|
"spec/models/message_train/attachment_spec.rb",
|
@@ -215,9 +253,12 @@ Gem::Specification.new do |s|
|
|
215
253
|
"spec/models/message_train/ignore_spec.rb",
|
216
254
|
"spec/models/message_train/message_spec.rb",
|
217
255
|
"spec/models/message_train/receipt_spec.rb",
|
256
|
+
"spec/models/message_train/unsubscribe_spec.rb",
|
257
|
+
"spec/models/role_spec.rb",
|
218
258
|
"spec/models/user_spec.rb",
|
219
259
|
"spec/rails_helper.rb",
|
220
260
|
"spec/spec_helper.rb",
|
261
|
+
"spec/support/attachments.rb",
|
221
262
|
"spec/support/controller_behaviors.rb",
|
222
263
|
"spec/support/controller_macros.rb",
|
223
264
|
"spec/support/conversations.rb",
|
@@ -225,16 +266,19 @@ Gem::Specification.new do |s|
|
|
225
266
|
"spec/support/feature_behaviors.rb",
|
226
267
|
"spec/support/groups.rb",
|
227
268
|
"spec/support/loaded_site.rb",
|
269
|
+
"spec/support/messages.rb",
|
270
|
+
"spec/support/roles.rb",
|
228
271
|
"spec/support/shared_connection.rb",
|
229
272
|
"spec/support/users.rb",
|
230
273
|
"spec/support/utilities.rb",
|
274
|
+
"spec/support/wysihtml5_helper.rb",
|
231
275
|
"vendor/assets/javascripts/bootstrap-tags.js",
|
232
276
|
"vendor/assets/stylesheets/bootstrap-tags.css"
|
233
277
|
]
|
234
278
|
s.homepage = "http://www.gemvein.com/museum/cases/message_train"
|
235
279
|
s.licenses = ["MIT"]
|
236
280
|
s.rubygems_version = "2.4.5"
|
237
|
-
s.summary = "
|
281
|
+
s.summary = "Rails 4 Engine providing messaging for any object"
|
238
282
|
|
239
283
|
if s.respond_to? :specification_version then
|
240
284
|
s.specification_version = 4
|
@@ -252,6 +296,8 @@ Gem::Specification.new do |s|
|
|
252
296
|
s.add_runtime_dependency(%q<bootstrap_leather>, ["~> 0.8"])
|
253
297
|
s.add_runtime_dependency(%q<bootstrap_pager>, ["~> 0.10"])
|
254
298
|
s.add_runtime_dependency(%q<bootstrap_form>, ["~> 2.3"])
|
299
|
+
s.add_runtime_dependency(%q<bootstrap-wysihtml5-rails>, ["> 0.3"])
|
300
|
+
s.add_runtime_dependency(%q<cocoon>, ["~> 1.2"])
|
255
301
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
256
302
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
257
303
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
@@ -265,6 +311,7 @@ Gem::Specification.new do |s|
|
|
265
311
|
s.add_development_dependency(%q<seedbank>, ["~> 0.3"])
|
266
312
|
s.add_development_dependency(%q<friendly_id>, ["~> 5"])
|
267
313
|
s.add_development_dependency(%q<byebug>, ["~> 5"])
|
314
|
+
s.add_development_dependency(%q<high_voltage>, ["~> 2.4"])
|
268
315
|
else
|
269
316
|
s.add_dependency(%q<rails>, ["~> 4"])
|
270
317
|
s.add_dependency(%q<paperclip>, ["~> 4.3"])
|
@@ -278,6 +325,8 @@ Gem::Specification.new do |s|
|
|
278
325
|
s.add_dependency(%q<bootstrap_leather>, ["~> 0.8"])
|
279
326
|
s.add_dependency(%q<bootstrap_pager>, ["~> 0.10"])
|
280
327
|
s.add_dependency(%q<bootstrap_form>, ["~> 2.3"])
|
328
|
+
s.add_dependency(%q<bootstrap-wysihtml5-rails>, ["> 0.3"])
|
329
|
+
s.add_dependency(%q<cocoon>, ["~> 1.2"])
|
281
330
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
282
331
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
283
332
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
@@ -291,6 +340,7 @@ Gem::Specification.new do |s|
|
|
291
340
|
s.add_dependency(%q<seedbank>, ["~> 0.3"])
|
292
341
|
s.add_dependency(%q<friendly_id>, ["~> 5"])
|
293
342
|
s.add_dependency(%q<byebug>, ["~> 5"])
|
343
|
+
s.add_dependency(%q<high_voltage>, ["~> 2.4"])
|
294
344
|
end
|
295
345
|
else
|
296
346
|
s.add_dependency(%q<rails>, ["~> 4"])
|
@@ -305,6 +355,8 @@ Gem::Specification.new do |s|
|
|
305
355
|
s.add_dependency(%q<bootstrap_leather>, ["~> 0.8"])
|
306
356
|
s.add_dependency(%q<bootstrap_pager>, ["~> 0.10"])
|
307
357
|
s.add_dependency(%q<bootstrap_form>, ["~> 2.3"])
|
358
|
+
s.add_dependency(%q<bootstrap-wysihtml5-rails>, ["> 0.3"])
|
359
|
+
s.add_dependency(%q<cocoon>, ["~> 1.2"])
|
308
360
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
309
361
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
310
362
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
@@ -318,6 +370,7 @@ Gem::Specification.new do |s|
|
|
318
370
|
s.add_dependency(%q<seedbank>, ["~> 0.3"])
|
319
371
|
s.add_dependency(%q<friendly_id>, ["~> 5"])
|
320
372
|
s.add_dependency(%q<byebug>, ["~> 5"])
|
373
|
+
s.add_dependency(%q<high_voltage>, ["~> 2.4"])
|
321
374
|
end
|
322
375
|
end
|
323
376
|
|
@@ -7,7 +7,8 @@ describe MessageTrain::BoxesController do
|
|
7
7
|
|
8
8
|
let(:valid_params) { { 'conversations' => {unread_conversation.id.to_s => unread_conversation.id} } }
|
9
9
|
let(:invalid_params) { { 'conversations' => {'999' => 999} } }
|
10
|
-
|
10
|
+
let(:disallowed_params) { { 'conversations' => {someone_elses_conversation.id.to_s => someone_elses_conversation.id} } }
|
11
|
+
|
11
12
|
before do
|
12
13
|
login_user first_user
|
13
14
|
end
|
@@ -35,7 +36,13 @@ describe MessageTrain::BoxesController do
|
|
35
36
|
before do
|
36
37
|
put :update, division: 'in', mark_to_set: 'read', objects: invalid_params
|
37
38
|
end
|
38
|
-
it_should_behave_like 'a
|
39
|
+
it_should_behave_like 'a 404 Not Found error'
|
40
|
+
end
|
41
|
+
describe 'with disallowed params' do
|
42
|
+
before do
|
43
|
+
put :update, division: 'in', mark_to_set: 'read', objects: disallowed_params
|
44
|
+
end
|
45
|
+
it_should_behave_like 'a page with an error message matching', /Access to Conversation \d+ denied/
|
39
46
|
end
|
40
47
|
describe 'without params' do
|
41
48
|
before do
|
@@ -56,7 +63,7 @@ describe MessageTrain::BoxesController do
|
|
56
63
|
before do
|
57
64
|
delete :destroy, division: 'in', mark_to_set: 'ignore', objects: invalid_params
|
58
65
|
end
|
59
|
-
it_should_behave_like 'a
|
66
|
+
it_should_behave_like 'a 404 Not Found error'
|
60
67
|
end
|
61
68
|
describe 'without params' do
|
62
69
|
before do
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe MessageTrain::BoxesController do
|
4
|
+
include_context 'loaded site'
|
5
|
+
include ControllerMacros
|
6
|
+
routes { MessageTrain::Engine.routes }
|
7
|
+
|
8
|
+
describe "GET #show" do
|
9
|
+
describe 'when not logged in' do
|
10
|
+
before do
|
11
|
+
get :show, division: 'in'
|
12
|
+
end
|
13
|
+
it_should_behave_like 'a redirect with notice', '/users/sign_in', 'You must sign in or sign up to continue.'
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'when neither sending nor receiving is allowed' do
|
17
|
+
before do
|
18
|
+
login_user third_user
|
19
|
+
get :show, division: 'in', collective_id: 'groups:first-group'
|
20
|
+
end
|
21
|
+
it_should_behave_like 'a redirect with error', '/', 'Access to that box denied'
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'when only sending is allowed' do
|
25
|
+
before do
|
26
|
+
login_user first_user
|
27
|
+
get :show, division: 'in', collective_id: 'groups:first-group'
|
28
|
+
end
|
29
|
+
it_should_behave_like 'a redirect with error', '/collectives/groups:first-group/box/sent', 'Access to that box denied'
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'when only receiving is allowed' do
|
33
|
+
before do
|
34
|
+
login_user first_user
|
35
|
+
get :show, division: 'sent', collective_id: 'groups:membered-group'
|
36
|
+
end
|
37
|
+
it_should_behave_like 'a redirect with error', '/collectives/groups:membered-group/box/in', 'Access to that box denied'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -5,7 +5,7 @@ describe MessageTrain::ConversationsController do
|
|
5
5
|
include ControllerMacros
|
6
6
|
routes { MessageTrain::Engine.routes }
|
7
7
|
|
8
|
-
let(:valid_params) { { 'messages' => {
|
8
|
+
let(:valid_params) { { 'messages' => {unread_message.id.to_s => unread_message.id} } }
|
9
9
|
let(:invalid_params) { { 'messages' => {'999999' => 999999} } }
|
10
10
|
|
11
11
|
before do
|
@@ -30,7 +30,7 @@ describe MessageTrain::ConversationsController do
|
|
30
30
|
|
31
31
|
context 'loads messages into @messages' do
|
32
32
|
subject { assigns(:messages) }
|
33
|
-
it { should include
|
33
|
+
it { should include unread_message }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -39,7 +39,7 @@ describe MessageTrain::ConversationsController do
|
|
39
39
|
before do
|
40
40
|
put :update, box_division: 'in', id: unread_conversation.id, mark_to_set: 'read', objects: invalid_params
|
41
41
|
end
|
42
|
-
it_should_behave_like 'a
|
42
|
+
it_should_behave_like 'a 404 Not Found error'
|
43
43
|
end
|
44
44
|
describe 'without params' do
|
45
45
|
before do
|
@@ -20,15 +20,13 @@ describe MessageTrain::MessagesController do
|
|
20
20
|
{ subject: nil }
|
21
21
|
}
|
22
22
|
|
23
|
-
let(:draft_message) { draft_conversation.messages.first }
|
24
|
-
|
25
23
|
before do
|
26
24
|
login_user first_user
|
27
25
|
end
|
28
26
|
|
29
27
|
describe "GET #show" do
|
30
28
|
before do
|
31
|
-
get :show, box_division: 'in', id:
|
29
|
+
get :show, box_division: 'in', id: unread_message.id, format: :json
|
32
30
|
end
|
33
31
|
it_should_behave_like 'a successful page', which_renders: 'show'
|
34
32
|
|
@@ -39,13 +37,13 @@ describe MessageTrain::MessagesController do
|
|
39
37
|
|
40
38
|
context 'loads message into @message' do
|
41
39
|
subject { assigns(:message) }
|
42
|
-
it { should eq
|
40
|
+
it { should eq unread_message }
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
46
44
|
describe "GET #new" do
|
47
45
|
before do
|
48
|
-
get :new, box_division: 'in', conversation_id:
|
46
|
+
get :new, box_division: 'in', conversation_id: unread_message.conversation_id
|
49
47
|
end
|
50
48
|
it_should_behave_like 'a successful page', which_renders: 'new'
|
51
49
|
|
@@ -64,14 +62,14 @@ describe MessageTrain::MessagesController do
|
|
64
62
|
describe "GET #edit" do
|
65
63
|
describe 'as someone other than the owner' do
|
66
64
|
before do
|
67
|
-
get :edit, box_division: 'in', id:
|
65
|
+
get :edit, box_division: 'in', id: someone_elses_message.id
|
68
66
|
end
|
69
67
|
it_should_behave_like 'a 404 Not Found error'
|
70
68
|
end
|
71
69
|
describe 'as the owner' do
|
72
70
|
describe 'when message is a not a draft' do
|
73
71
|
before do
|
74
|
-
get :edit, box_division: 'in', id:
|
72
|
+
get :edit, box_division: 'in', id: unread_message.id
|
75
73
|
end
|
76
74
|
it_should_behave_like 'a 404 Not Found error'
|
77
75
|
end
|
@@ -117,9 +115,18 @@ describe MessageTrain::MessagesController do
|
|
117
115
|
end
|
118
116
|
end
|
119
117
|
describe 'with valid attributes, counting' do
|
118
|
+
it 'results in a new conversation' do
|
119
|
+
expect { post :create, box_division: 'in', message: valid_attributes }.to change { MessageTrain::Conversation.count }.by(1)
|
120
|
+
end
|
120
121
|
it 'results in a new message' do
|
121
122
|
expect { post :create, box_division: 'in', message: valid_attributes }.to change { MessageTrain::Message.count }.by(1)
|
122
123
|
end
|
124
|
+
it 'results in new receipts' do
|
125
|
+
expect { post :create, box_division: 'in', message: valid_attributes }.to change { MessageTrain::Receipt.count }.by(3)
|
126
|
+
end
|
127
|
+
it 'results in email notifications' do
|
128
|
+
expect { post :create, box_division: 'in', message: valid_attributes }.to change { ActionMailer::Base.deliveries.count }.by(2)
|
129
|
+
end
|
123
130
|
end
|
124
131
|
describe 'with invalid params' do
|
125
132
|
before do
|
@@ -148,7 +155,7 @@ describe MessageTrain::MessagesController do
|
|
148
155
|
describe "PUT #update" do
|
149
156
|
describe 'as someone other than the owner' do
|
150
157
|
before do
|
151
|
-
put :update, box_division: 'in', id:
|
158
|
+
put :update, box_division: 'in', id: someone_elses_message.id, message: valid_attributes
|
152
159
|
end
|
153
160
|
it_should_behave_like 'a 404 Not Found error'
|
154
161
|
end
|
@@ -177,30 +184,56 @@ describe MessageTrain::MessagesController do
|
|
177
184
|
describe 'with valid params' do
|
178
185
|
describe 'when not a draft' do
|
179
186
|
before do
|
180
|
-
put :update, box_division: 'in', id:
|
187
|
+
put :update, box_division: 'in', id: sent_message.id, message: valid_attributes
|
181
188
|
end
|
182
189
|
it_should_behave_like 'a 404 Not Found error'
|
183
190
|
end
|
184
191
|
describe 'when a draft' do
|
185
|
-
|
186
|
-
|
192
|
+
describe 'and updating to not draft' do
|
193
|
+
|
194
|
+
before do
|
195
|
+
put :update, box_division: 'in', id: draft_message.id, message: valid_attributes
|
196
|
+
end
|
197
|
+
it_should_behave_like 'a redirect to', '/box/sent'
|
198
|
+
it_should_behave_like 'a response without error'
|
199
|
+
|
200
|
+
context 'updates @message' do
|
201
|
+
subject { draft_message.reload }
|
202
|
+
its(:subject) { should eq 'Test Subject' }
|
203
|
+
end
|
204
|
+
|
205
|
+
context "sets no alert" do
|
206
|
+
subject { flash[:alert] }
|
207
|
+
it { should be nil }
|
208
|
+
end
|
209
|
+
|
210
|
+
context "sets the flash with a notice of the message's update" do
|
211
|
+
subject { flash[:notice] }
|
212
|
+
it { should eq 'Message sent.'}
|
213
|
+
end
|
187
214
|
end
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
215
|
+
describe 'and updating but keeping as a draft' do
|
216
|
+
let(:edited_draft_message) { { id: draft_message.id, subject: 'Still a draft', draft: 'Save As Draft' } }
|
217
|
+
before do
|
218
|
+
put :update, box_division: 'in', id: draft_message.id, message: edited_draft_message
|
219
|
+
end
|
220
|
+
it_should_behave_like 'a redirect matching', %r(/box/in/conversations/\d+)
|
221
|
+
it_should_behave_like 'a response without error'
|
222
|
+
|
223
|
+
context 'updates @message' do
|
224
|
+
subject { draft_message.reload }
|
225
|
+
its(:subject) { should eq 'Still a draft' }
|
226
|
+
end
|
227
|
+
|
228
|
+
context "sets no notice" do
|
229
|
+
subject { flash[:notice] }
|
230
|
+
it { should be nil }
|
231
|
+
end
|
232
|
+
|
233
|
+
context "sets the flash with a alert of the message's update" do
|
234
|
+
subject { flash[:alert] }
|
235
|
+
it { should eq 'Message saved as draft.'}
|
236
|
+
end
|
204
237
|
end
|
205
238
|
end
|
206
239
|
end
|
@@ -10,14 +10,49 @@ describe MessageTrain::ParticipantsController do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "GET #index" do
|
13
|
-
|
14
|
-
|
13
|
+
describe 'with model to users' do
|
14
|
+
before do
|
15
|
+
get :index, box_division: 'in', model: 'users', format: :json
|
16
|
+
end
|
17
|
+
it_should_behave_like 'a successful page', which_renders: 'index'
|
18
|
+
|
19
|
+
context 'loads participants into @participants' do
|
20
|
+
subject { assigns(:participants) }
|
21
|
+
its(:first) { should be_a User }
|
22
|
+
end
|
15
23
|
end
|
16
|
-
|
24
|
+
describe 'with model set to groups' do
|
25
|
+
describe 'given model responds to fallback method' do
|
26
|
+
before do
|
27
|
+
get :index, box_division: 'in', model: 'groups', format: :json
|
28
|
+
end
|
29
|
+
it_should_behave_like 'a successful page', which_renders: 'index'
|
17
30
|
|
18
|
-
|
19
|
-
|
20
|
-
|
31
|
+
context 'loads participants into @participants' do
|
32
|
+
subject { assigns(:participants) }
|
33
|
+
its(:first) { should be_a Group }
|
34
|
+
it { should have_exactly(2).items }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
describe 'given model does not fallback method' do
|
38
|
+
before do
|
39
|
+
MessageTrain.configuration.address_book_method = nil
|
40
|
+
get :index, box_division: 'in', model: 'groups', format: :json
|
41
|
+
end
|
42
|
+
it_should_behave_like 'a successful page', which_renders: 'index'
|
43
|
+
|
44
|
+
context 'loads participants into @participants' do
|
45
|
+
subject { assigns(:participants) }
|
46
|
+
its(:first) { should be_a Group }
|
47
|
+
it { should have_exactly(4).items }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
describe 'with no model set' do
|
52
|
+
before do
|
53
|
+
get :index, box_division: 'in', model: '', format: :json
|
54
|
+
end
|
55
|
+
it_should_behave_like 'a 404 Not Found error'
|
21
56
|
end
|
22
57
|
end
|
23
58
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe MessageTrain::UnsubscribesController do
|
4
|
+
include_context 'loaded site'
|
5
|
+
include ControllerMacros
|
6
|
+
routes { MessageTrain::Engine.routes }
|
7
|
+
|
8
|
+
let(:valid_attributes) {
|
9
|
+
{ from_type: 'Group', from_id: membered_group.id }
|
10
|
+
}
|
11
|
+
|
12
|
+
let(:invalid_attributes) {
|
13
|
+
{ from_type: 'Group', from_id: empty_group.id }
|
14
|
+
}
|
15
|
+
|
16
|
+
before do
|
17
|
+
login_user first_user
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "GET #index" do
|
21
|
+
before do
|
22
|
+
get :index
|
23
|
+
end
|
24
|
+
it_should_behave_like 'a successful page', which_renders: 'index'
|
25
|
+
|
26
|
+
context 'loads subscriptions into @subscriptions' do
|
27
|
+
subject { assigns(:subscriptions) }
|
28
|
+
it { should be_an Array }
|
29
|
+
it { should have_at_least(3).items }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "POST #create" do
|
34
|
+
describe 'with invalid attributes' do
|
35
|
+
before do
|
36
|
+
post :create, unsubscribe: invalid_attributes
|
37
|
+
end
|
38
|
+
it_should_behave_like 'a 404 Not Found error'
|
39
|
+
end
|
40
|
+
describe 'with valid attributes' do
|
41
|
+
before do
|
42
|
+
post :create, unsubscribe: valid_attributes
|
43
|
+
end
|
44
|
+
it_should_behave_like 'a redirect with a message', '/unsubscribes', notice: 'You are now unsubscribed from Membered Group, which means that you will not be notified by email of any messages received by that Group.'
|
45
|
+
it_should_behave_like 'a response without error'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "DELETE #destroy" do
|
50
|
+
before do
|
51
|
+
delete :destroy, id: first_user.unsubscribes.where(from_type: 'Group', from_id: unsubscribed_group.id).first.id
|
52
|
+
end
|
53
|
+
it_should_behave_like 'a redirect with a message', '/unsubscribes', notice: 'You are no longer unsubscribed from Unsubscribed Group, which means that you will now be notified by email of any messages received in that Group.'
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
File without changes
|