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
data/spec/dummy/db/schema.rb
CHANGED
@@ -13,126 +13,126 @@
|
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(version: 20160207190409) do
|
15
15
|
|
16
|
-
create_table
|
17
|
-
t.string
|
18
|
-
t.string
|
19
|
-
t.text
|
20
|
-
t.datetime
|
21
|
-
t.datetime
|
16
|
+
create_table 'groups', force: :cascade do |t|
|
17
|
+
t.string 'title'
|
18
|
+
t.string 'slug'
|
19
|
+
t.text 'description'
|
20
|
+
t.datetime 'created_at', null: false
|
21
|
+
t.datetime 'updated_at', null: false
|
22
22
|
end
|
23
23
|
|
24
|
-
create_table
|
25
|
-
t.integer
|
26
|
-
t.string
|
27
|
-
t.string
|
28
|
-
t.integer
|
29
|
-
t.datetime
|
30
|
-
t.datetime
|
31
|
-
t.datetime
|
24
|
+
create_table 'message_train_attachments', force: :cascade do |t|
|
25
|
+
t.integer 'message_train_message_id'
|
26
|
+
t.string 'attachment_file_name'
|
27
|
+
t.string 'attachment_content_type'
|
28
|
+
t.integer 'attachment_file_size'
|
29
|
+
t.datetime 'attachment_updated_at'
|
30
|
+
t.datetime 'created_at', null: false
|
31
|
+
t.datetime 'updated_at', null: false
|
32
32
|
end
|
33
33
|
|
34
|
-
add_index
|
34
|
+
add_index 'message_train_attachments', ['message_train_message_id'], name: 'index_message_train_attachments_on_message_train_message_id'
|
35
35
|
|
36
|
-
create_table
|
37
|
-
t.string
|
38
|
-
t.datetime
|
39
|
-
t.datetime
|
36
|
+
create_table 'message_train_conversations', force: :cascade do |t|
|
37
|
+
t.string 'subject'
|
38
|
+
t.datetime 'created_at', null: false
|
39
|
+
t.datetime 'updated_at', null: false
|
40
40
|
end
|
41
41
|
|
42
|
-
create_table
|
43
|
-
t.integer
|
44
|
-
t.string
|
45
|
-
t.integer
|
46
|
-
t.datetime
|
47
|
-
t.datetime
|
42
|
+
create_table 'message_train_ignores', force: :cascade do |t|
|
43
|
+
t.integer 'participant_id'
|
44
|
+
t.string 'participant_type'
|
45
|
+
t.integer 'message_train_conversation_id'
|
46
|
+
t.datetime 'created_at', null: false
|
47
|
+
t.datetime 'updated_at', null: false
|
48
48
|
end
|
49
49
|
|
50
|
-
add_index
|
51
|
-
add_index
|
52
|
-
|
53
|
-
create_table
|
54
|
-
t.integer
|
55
|
-
t.integer
|
56
|
-
t.string
|
57
|
-
t.text
|
58
|
-
t.string
|
59
|
-
t.text
|
60
|
-
t.boolean
|
61
|
-
t.datetime
|
62
|
-
t.datetime
|
50
|
+
add_index 'message_train_ignores', ['message_train_conversation_id'], name: 'index_message_train_ignores_on_message_train_conversation_id'
|
51
|
+
add_index 'message_train_ignores', ['participant_type', 'participant_id'], name: 'participant_index'
|
52
|
+
|
53
|
+
create_table 'message_train_messages', force: :cascade do |t|
|
54
|
+
t.integer 'message_train_conversation_id'
|
55
|
+
t.integer 'sender_id'
|
56
|
+
t.string 'sender_type'
|
57
|
+
t.text 'recipients_to_save'
|
58
|
+
t.string 'subject'
|
59
|
+
t.text 'body'
|
60
|
+
t.boolean 'draft', default: false
|
61
|
+
t.datetime 'created_at', null: false
|
62
|
+
t.datetime 'updated_at', null: false
|
63
63
|
end
|
64
64
|
|
65
|
-
add_index
|
66
|
-
add_index
|
67
|
-
|
68
|
-
create_table
|
69
|
-
t.integer
|
70
|
-
t.string
|
71
|
-
t.integer
|
72
|
-
t.boolean
|
73
|
-
t.boolean
|
74
|
-
t.boolean
|
75
|
-
t.boolean
|
76
|
-
t.datetime
|
77
|
-
t.datetime
|
78
|
-
t.integer
|
79
|
-
t.string
|
65
|
+
add_index 'message_train_messages', ['message_train_conversation_id'], name: 'index_message_train_messages_on_message_train_conversation_id'
|
66
|
+
add_index 'message_train_messages', ['sender_type', 'sender_id'], name: 'index_message_train_messages_on_sender_type_and_sender_id'
|
67
|
+
|
68
|
+
create_table 'message_train_receipts', force: :cascade do |t|
|
69
|
+
t.integer 'recipient_id'
|
70
|
+
t.string 'recipient_type'
|
71
|
+
t.integer 'message_train_message_id'
|
72
|
+
t.boolean 'marked_read', default: false
|
73
|
+
t.boolean 'marked_trash', default: false
|
74
|
+
t.boolean 'marked_deleted', default: false
|
75
|
+
t.boolean 'sender', default: false
|
76
|
+
t.datetime 'created_at', null: false
|
77
|
+
t.datetime 'updated_at', null: false
|
78
|
+
t.integer 'received_through_id'
|
79
|
+
t.string 'received_through_type'
|
80
80
|
end
|
81
81
|
|
82
|
-
add_index
|
83
|
-
add_index
|
84
|
-
add_index
|
85
|
-
add_index
|
86
|
-
|
87
|
-
create_table
|
88
|
-
t.integer
|
89
|
-
t.string
|
90
|
-
t.integer
|
91
|
-
t.string
|
92
|
-
t.datetime
|
93
|
-
t.datetime
|
82
|
+
add_index 'message_train_receipts', ['message_train_message_id', 'recipient_type', 'recipient_id'], name: 'message_recipient', unique: true
|
83
|
+
add_index 'message_train_receipts', ['message_train_message_id'], name: 'index_message_train_receipts_on_message_train_message_id'
|
84
|
+
add_index 'message_train_receipts', ['received_through_type', 'received_through_id'], name: 'index_message_train_receipts_on_received_through'
|
85
|
+
add_index 'message_train_receipts', ['recipient_type', 'recipient_id'], name: 'index_message_train_receipts_on_recipient'
|
86
|
+
|
87
|
+
create_table 'message_train_unsubscribes', force: :cascade do |t|
|
88
|
+
t.integer 'recipient_id'
|
89
|
+
t.string 'recipient_type'
|
90
|
+
t.integer 'from_id'
|
91
|
+
t.string 'from_type'
|
92
|
+
t.datetime 'created_at', null: false
|
93
|
+
t.datetime 'updated_at', null: false
|
94
94
|
end
|
95
95
|
|
96
|
-
add_index
|
97
|
-
add_index
|
98
|
-
add_index
|
96
|
+
add_index 'message_train_unsubscribes', ['from_type', 'from_id'], name: 'unsubscribe_from'
|
97
|
+
add_index 'message_train_unsubscribes', ['recipient_type', 'recipient_id', 'from_type', 'from_id'], name: 'unsubscribe', unique: true
|
98
|
+
add_index 'message_train_unsubscribes', ['recipient_type', 'recipient_id'], name: 'unsubscribe_recipient'
|
99
99
|
|
100
|
-
create_table
|
101
|
-
t.string
|
102
|
-
t.integer
|
103
|
-
t.string
|
104
|
-
t.datetime
|
105
|
-
t.datetime
|
100
|
+
create_table 'roles', force: :cascade do |t|
|
101
|
+
t.string 'name'
|
102
|
+
t.integer 'resource_id'
|
103
|
+
t.string 'resource_type'
|
104
|
+
t.datetime 'created_at'
|
105
|
+
t.datetime 'updated_at'
|
106
106
|
end
|
107
107
|
|
108
|
-
add_index
|
109
|
-
add_index
|
110
|
-
|
111
|
-
create_table
|
112
|
-
t.string
|
113
|
-
t.string
|
114
|
-
t.string
|
115
|
-
t.datetime
|
116
|
-
t.datetime
|
117
|
-
t.integer
|
118
|
-
t.datetime
|
119
|
-
t.datetime
|
120
|
-
t.string
|
121
|
-
t.string
|
122
|
-
t.datetime
|
123
|
-
t.datetime
|
124
|
-
t.string
|
125
|
-
t.string
|
108
|
+
add_index 'roles', ['name', 'resource_type', 'resource_id'], name: 'index_roles_on_name_and_resource_type_and_resource_id'
|
109
|
+
add_index 'roles', ['name'], name: 'index_roles_on_name'
|
110
|
+
|
111
|
+
create_table 'users', force: :cascade do |t|
|
112
|
+
t.string 'email', default: "", null: false
|
113
|
+
t.string 'encrypted_password', default: "", null: false
|
114
|
+
t.string 'reset_password_token'
|
115
|
+
t.datetime 'reset_password_sent_at'
|
116
|
+
t.datetime 'remember_created_at'
|
117
|
+
t.integer 'sign_in_count', default: 0, null: false
|
118
|
+
t.datetime 'current_sign_in_at'
|
119
|
+
t.datetime 'last_sign_in_at'
|
120
|
+
t.string 'current_sign_in_ip'
|
121
|
+
t.string 'last_sign_in_ip'
|
122
|
+
t.datetime 'created_at', null: false
|
123
|
+
t.datetime 'updated_at', null: false
|
124
|
+
t.string 'display_name'
|
125
|
+
t.string 'slug'
|
126
126
|
end
|
127
127
|
|
128
|
-
add_index
|
129
|
-
add_index
|
128
|
+
add_index 'users', ['email'], name: 'index_users_on_email', unique: true
|
129
|
+
add_index 'users', ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true
|
130
130
|
|
131
|
-
create_table
|
132
|
-
t.integer
|
133
|
-
t.integer
|
131
|
+
create_table 'users_roles', id: false, force: :cascade do |t|
|
132
|
+
t.integer 'user_id'
|
133
|
+
t.integer 'role_id'
|
134
134
|
end
|
135
135
|
|
136
|
-
add_index
|
136
|
+
add_index 'users_roles', ['user_id', 'role_id'], name: 'index_users_roles_on_user_id_and_role_id'
|
137
137
|
|
138
138
|
end
|
@@ -8,168 +8,168 @@ after :users, :groups do
|
|
8
8
|
first_group = Group.find_by_slug('first-group')
|
9
9
|
membered_group = Group.find_by_slug('membered-group')
|
10
10
|
|
11
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
subject: "Someone Else's Conversation",
|
160
|
-
sender: User.order(:id).last,
|
161
|
-
recipients_to_save: { 'users' => second_user.slug }
|
11
|
+
FactoryGirl.create(
|
12
|
+
:simple_message,
|
13
|
+
sender: first_user,
|
14
|
+
recipients_to_save: { 'users' => second_user.slug },
|
15
|
+
subject: 'Sent Conversation'
|
16
|
+
)
|
17
|
+
|
18
|
+
FactoryGirl.create(
|
19
|
+
:simple_message,
|
20
|
+
sender: second_user,
|
21
|
+
recipients_to_save: { 'users' => first_user.slug },
|
22
|
+
subject: 'Unread Conversation'
|
23
|
+
)
|
24
|
+
|
25
|
+
FactoryGirl.create(
|
26
|
+
:simple_message,
|
27
|
+
sender: first_user,
|
28
|
+
recipients_to_save: {
|
29
|
+
'users' => [
|
30
|
+
second_user.slug,
|
31
|
+
third_user.slug,
|
32
|
+
fourth_user.slug
|
33
|
+
].join(', ')
|
34
|
+
},
|
35
|
+
subject: 'To Many Conversation'
|
36
|
+
)
|
37
|
+
|
38
|
+
FactoryGirl.create(
|
39
|
+
:simple_message,
|
40
|
+
sender: second_user,
|
41
|
+
recipients_to_save: { 'users' => first_user.slug },
|
42
|
+
subject: 'Ignored Conversation'
|
43
|
+
).conversation.participant_ignore(first_user)
|
44
|
+
|
45
|
+
FactoryGirl.create(
|
46
|
+
:simple_message,
|
47
|
+
sender: second_user,
|
48
|
+
recipients_to_save: { 'users' => first_user.slug },
|
49
|
+
subject: 'Trashed Conversation'
|
50
|
+
).mark_trash_for(first_user)
|
51
|
+
|
52
|
+
FactoryGirl.create(
|
53
|
+
:simple_message,
|
54
|
+
sender: second_user,
|
55
|
+
recipients_to_save: { 'users' => first_user.slug },
|
56
|
+
subject: 'Read Conversation'
|
57
|
+
).mark_read_for(first_user)
|
58
|
+
|
59
|
+
FactoryGirl.create(
|
60
|
+
:simple_message,
|
61
|
+
sender: second_user,
|
62
|
+
recipients_to_save: { 'users' => first_user.slug },
|
63
|
+
subject: 'Attachment Conversation',
|
64
|
+
generate_attachment?: true
|
65
|
+
)
|
66
|
+
|
67
|
+
FactoryGirl.create(
|
68
|
+
:simple_message,
|
69
|
+
sender: second_user,
|
70
|
+
recipients_to_save: { 'users' => first_user.slug },
|
71
|
+
subject: 'Deleted Conversation'
|
72
|
+
).mark_deleted_for(first_user)
|
73
|
+
|
74
|
+
FactoryGirl.create(
|
75
|
+
:simple_message,
|
76
|
+
sender: first_user,
|
77
|
+
recipients_to_save: { 'groups' => first_group.slug },
|
78
|
+
subject: 'Group Announcement'
|
79
|
+
)
|
80
|
+
|
81
|
+
FactoryGirl.create(
|
82
|
+
:simple_message,
|
83
|
+
sender: second_user,
|
84
|
+
recipients_to_save: { 'groups' => membered_group.slug },
|
85
|
+
subject: 'Membered Group Announcement'
|
86
|
+
)
|
87
|
+
|
88
|
+
FactoryGirl.create(
|
89
|
+
:simple_message,
|
90
|
+
sender: second_user,
|
91
|
+
recipients_to_save: { 'groups' => membered_group.slug },
|
92
|
+
subject: 'Membered Group Trashed Conversation'
|
93
|
+
).mark(:trash, first_user)
|
94
|
+
|
95
|
+
FactoryGirl.create(
|
96
|
+
:simple_message,
|
97
|
+
sender: second_user,
|
98
|
+
recipients_to_save: { 'groups' => membered_group.slug },
|
99
|
+
subject: 'Membered Group Read Conversation'
|
100
|
+
).mark(:read, first_user)
|
101
|
+
|
102
|
+
FactoryGirl.create(
|
103
|
+
:simple_message,
|
104
|
+
sender: second_user,
|
105
|
+
recipients_to_save: { 'groups' => membered_group.slug },
|
106
|
+
subject: 'Membered Group Ignored Conversation'
|
107
|
+
).conversation.participant_ignore(first_user)
|
108
|
+
|
109
|
+
FactoryGirl.create(
|
110
|
+
:simple_message,
|
111
|
+
sender: second_user,
|
112
|
+
recipients_to_save: { 'groups' => membered_group.slug },
|
113
|
+
subject: 'Membered Group Deleted Conversation'
|
114
|
+
).mark(:deleted, first_user)
|
115
|
+
|
116
|
+
FactoryGirl.create(
|
117
|
+
:simple_message,
|
118
|
+
sender: second_user,
|
119
|
+
recipients_to_save: { 'groups' => membered_group.slug },
|
120
|
+
subject: 'Membered Group Draft',
|
121
|
+
draft: true
|
122
|
+
)
|
123
|
+
|
124
|
+
FactoryGirl.create(
|
125
|
+
:simple_message,
|
126
|
+
sender: first_user,
|
127
|
+
recipients_to_save: { 'groups' => first_group.slug },
|
128
|
+
subject: 'Owned Group Draft',
|
129
|
+
draft: true
|
130
|
+
)
|
131
|
+
|
132
|
+
FactoryGirl.create(
|
133
|
+
:simple_message,
|
134
|
+
sender: superadmin_user,
|
135
|
+
recipients_to_save: { 'roles' => 'admin' },
|
136
|
+
subject: 'Role Conversation'
|
137
|
+
)
|
138
|
+
|
139
|
+
FactoryGirl.create(
|
140
|
+
:simple_message,
|
141
|
+
sender: superadmin_user,
|
142
|
+
recipients_to_save: { 'roles' => 'admin' },
|
143
|
+
subject: 'Role Draft',
|
144
|
+
draft: true
|
145
|
+
)
|
146
|
+
|
147
|
+
FactoryGirl.create(
|
148
|
+
:simple_message,
|
149
|
+
subject: 'This should turn into a draft',
|
150
|
+
sender: first_user,
|
151
|
+
recipients_to_save: {}
|
152
|
+
)
|
153
|
+
|
154
|
+
FactoryGirl.create(
|
155
|
+
:simple_message,
|
156
|
+
subject: "Someone Else's Conversation",
|
157
|
+
sender: User.order(:id).last,
|
158
|
+
recipients_to_save: { 'users' => second_user.slug }
|
162
159
|
)
|
163
160
|
|
164
161
|
long_message = FactoryGirl.create(
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
162
|
+
:simple_message,
|
163
|
+
subject: 'Long Conversation',
|
164
|
+
sender: second_user,
|
165
|
+
recipients_to_save: { 'users' => first_user.slug }
|
169
166
|
)
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
167
|
+
|
168
|
+
FactoryGirl.create_list(
|
169
|
+
:simple_message,
|
170
|
+
11,
|
171
|
+
conversation: long_message.conversation,
|
172
|
+
sender: first_user,
|
173
|
+
recipients_to_save: { 'users' => second_user.slug }
|
174
174
|
)
|
175
|
-
end
|
175
|
+
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
after :users, :groups do
|
2
2
|
User.find_each do |user|
|
3
3
|
# Create some conversations that this user has received
|
4
|
-
FactoryGirl.create_list(
|
4
|
+
FactoryGirl.create_list(
|
5
|
+
:message_from_random_sender,
|
6
|
+
[*5..10].sample,
|
7
|
+
recipients_to_save: { 'users' => user.slug }
|
8
|
+
)
|
5
9
|
|
6
10
|
# Create some conversations that this user has sent
|
7
11
|
FactoryGirl.create_list(:message, [*5..10].sample, sender: user)
|
8
12
|
end
|
9
|
-
end
|
13
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
after :users do
|
2
2
|
first_user = User.friendly.find('first-user')
|
3
3
|
second_user = User.friendly.find('second-user')
|
4
|
-
third_user = User.friendly.find('third-user')
|
5
4
|
fourth_user = User.friendly.find('fourth-user')
|
6
5
|
unsubscribed_user = User.friendly.find('unsubscribed-user')
|
7
6
|
|
@@ -14,23 +13,23 @@ after :users do
|
|
14
13
|
unsubscribed_user.add_role(:member, first_group)
|
15
14
|
|
16
15
|
membered_group = FactoryGirl.create(
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
:group,
|
17
|
+
title: 'Membered Group',
|
18
|
+
owner: second_user
|
20
19
|
)
|
21
20
|
first_user.add_role(:member, membered_group)
|
22
21
|
unsubscribed_user.add_role(:member, membered_group)
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
FactoryGirl.create(
|
24
|
+
:group,
|
25
|
+
title: 'Empty Group',
|
26
|
+
owner: first_user
|
28
27
|
)
|
29
28
|
|
30
29
|
unsubscribed_group = FactoryGirl.create(
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
:group,
|
31
|
+
title: 'Unsubscribed Group',
|
32
|
+
owner: second_user
|
34
33
|
)
|
35
34
|
first_user.add_role(:member, unsubscribed_group)
|
36
|
-
end
|
35
|
+
end
|
@@ -1,4 +1,14 @@
|
|
1
1
|
after 'test:conversations' do
|
2
|
-
FactoryGirl.create(
|
3
|
-
|
4
|
-
|
2
|
+
FactoryGirl.create(
|
3
|
+
:attachment,
|
4
|
+
attachment: File.open(
|
5
|
+
'spec/dummy/app/assets/files/message_train/attachments/image-sample.jpg'
|
6
|
+
)
|
7
|
+
)
|
8
|
+
FactoryGirl.create(
|
9
|
+
:attachment,
|
10
|
+
attachment: File.open(
|
11
|
+
'spec/dummy/app/assets/files/message_train/attachments/pdf-sample.pdf'
|
12
|
+
)
|
13
|
+
)
|
14
|
+
end
|