message_train 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -2,8 +2,12 @@ after :users, :groups do
|
|
2
2
|
first_user = User.friendly.find('first-user')
|
3
3
|
|
4
4
|
# Create some conversations that first user has received
|
5
|
-
FactoryGirl.create_list(
|
5
|
+
FactoryGirl.create_list(
|
6
|
+
:message_from_random_sender,
|
7
|
+
10,
|
8
|
+
recipients_to_save: { 'users' => first_user.slug }
|
9
|
+
)
|
6
10
|
|
7
11
|
# Create some conversations that first user has sent
|
8
12
|
FactoryGirl.create_list(:message, 10, sender: first_user)
|
9
|
-
end
|
13
|
+
end
|
@@ -1,42 +1,47 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
1
|
+
FactoryGirl.create(
|
2
|
+
:user,
|
3
|
+
display_name: 'First User',
|
4
|
+
email: 'first.user@example.com'
|
5
|
+
)
|
6
|
+
|
7
|
+
FactoryGirl.create(
|
8
|
+
:user,
|
9
|
+
display_name: 'Second User',
|
10
|
+
email: 'second.user@example.com'
|
11
|
+
)
|
12
|
+
|
13
|
+
FactoryGirl.create(
|
14
|
+
:user,
|
15
|
+
display_name: 'Third User',
|
16
|
+
email: 'third.user@example.com'
|
17
|
+
)
|
18
|
+
|
19
|
+
FactoryGirl.create(
|
20
|
+
:user,
|
21
|
+
display_name: 'Fourth User',
|
22
|
+
email: 'fourth.user@example.com'
|
23
|
+
)
|
24
|
+
|
25
|
+
FactoryGirl.create(
|
26
|
+
:user,
|
27
|
+
display_name: 'Unsubscribed User',
|
28
|
+
email: 'unsubscribed.user@example.com'
|
29
|
+
)
|
30
|
+
|
31
|
+
FactoryGirl.create(
|
32
|
+
:user,
|
33
|
+
display_name: 'Silent User',
|
34
|
+
email: 'silent.user@example.com'
|
35
|
+
)
|
36
|
+
|
37
|
+
FactoryGirl.create(
|
38
|
+
:user,
|
39
|
+
display_name: 'Superadmin User',
|
40
|
+
email: 'superadmin.user@example.com'
|
41
|
+
).add_role(:superadmin)
|
42
|
+
|
43
|
+
FactoryGirl.create(
|
44
|
+
:user,
|
45
|
+
display_name: 'Admin User',
|
46
|
+
email: 'admin.user@example.com'
|
47
|
+
).add_role(:admin)
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -1,6 +1,10 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :attachment, class: 'MessageTrain::Attachment' do
|
3
3
|
message { MessageTrain::Message.order('RANDOM()').first }
|
4
|
-
attachment
|
4
|
+
attachment do
|
5
|
+
File.open(
|
6
|
+
Dir['spec/dummy/app/assets/files/message_train/attachments/*'].sample
|
7
|
+
)
|
8
|
+
end
|
5
9
|
end
|
6
|
-
end
|
10
|
+
end
|
data/spec/factories/group.rb
CHANGED
@@ -3,7 +3,7 @@ FactoryGirl.define do
|
|
3
3
|
title { Faker::Lorem.sentence }
|
4
4
|
description { Faker::Lorem.paragraphs([*1..5].sample).join("\n\n") }
|
5
5
|
transient do
|
6
|
-
owner { User.order(
|
6
|
+
owner { User.order('RANDOM()').first }
|
7
7
|
# member_count 5
|
8
8
|
end
|
9
9
|
# the after(:create) yields two values; the user instance itself and the
|
@@ -12,9 +12,6 @@ FactoryGirl.define do
|
|
12
12
|
# to create and we make sure the user is associated properly to the post
|
13
13
|
after(:create) do |group, evaluator|
|
14
14
|
evaluator.owner.add_role(:owner, group)
|
15
|
-
# User.where('id != ?', evaluator.owner.id).order("RANDOM()").limit(evaluator.member_count).find_each do |user|
|
16
|
-
# user.add_role(:member, group)
|
17
|
-
# end
|
18
15
|
end
|
19
16
|
end
|
20
17
|
end
|
data/spec/factories/message.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :message, class: 'MessageTrain::Message' do
|
3
|
-
sender
|
3
|
+
sender do
|
4
4
|
User
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
recipients_to_save
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
.order('RANDOM()')
|
6
|
+
.first
|
7
|
+
end
|
8
|
+
recipients_to_save do
|
9
|
+
{
|
10
|
+
'users' => User.where
|
11
|
+
.not(id: sender.id)
|
12
|
+
.where
|
13
|
+
.not(slug: 'silent-user')
|
14
|
+
.order('RANDOM()')
|
15
|
+
.limit([*1..5].sample)
|
16
|
+
.collect(&:slug)
|
17
|
+
.join(', ')
|
18
|
+
}
|
19
|
+
end
|
19
20
|
subject { Faker::Lorem.sentence }
|
20
21
|
body { "<p>#{Faker::Lorem.paragraphs([*1..5].sample).join('</p><p>')}</p>" }
|
21
22
|
|
@@ -34,11 +35,13 @@ FactoryGirl.define do
|
|
34
35
|
FactoryGirl.create(:attachment, message: message)
|
35
36
|
end
|
36
37
|
if message.recipients_to_save['users'].present?
|
37
|
-
participants = (
|
38
|
+
participants = (
|
39
|
+
message.recipients_to_save['users'].split(',') + [message.sender.slug]
|
40
|
+
).collect(&:strip)
|
38
41
|
if evaluator.generate_ignore?
|
39
42
|
ignorer = User.friendly.find(participants.sample)
|
40
|
-
participants
|
41
|
-
message.conversation.
|
43
|
+
participants -= [ignorer.slug]
|
44
|
+
message.conversation.participant_ignore(ignorer)
|
42
45
|
end
|
43
46
|
if evaluator.generate_response? && participants.count > 1
|
44
47
|
response_sender = User.friendly.find(participants.sample)
|
@@ -54,16 +57,19 @@ FactoryGirl.define do
|
|
54
57
|
end
|
55
58
|
|
56
59
|
factory :message_from_random_sender do
|
57
|
-
sender
|
58
|
-
recipient_user_ids =
|
60
|
+
sender do
|
61
|
+
recipient_user_ids = (
|
62
|
+
recipients_to_save['users'].split(',')
|
63
|
+
.collect { |x| User.friendly.find(x.strip).id }
|
64
|
+
)
|
59
65
|
User
|
60
66
|
.where
|
61
|
-
.not(id: recipient_user_ids
|
67
|
+
.not(id: recipient_user_ids)
|
62
68
|
.where
|
63
69
|
.not(slug: 'silent-user')
|
64
70
|
.order('RANDOM()')
|
65
71
|
.first
|
66
|
-
|
72
|
+
end
|
67
73
|
end
|
68
74
|
|
69
75
|
factory :simple_message do
|
@@ -72,4 +78,4 @@ FactoryGirl.define do
|
|
72
78
|
generate_attachment? false
|
73
79
|
end
|
74
80
|
end
|
75
|
-
end
|
81
|
+
end
|
data/spec/factories/user.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :user do
|
3
3
|
display_name { Faker::Name.name }
|
4
|
-
email
|
5
|
-
|
6
|
-
|
4
|
+
sequence :email do |n|
|
5
|
+
"#{display_name.tr(' ', '.').downcase}#{n}@example.com"
|
6
|
+
end
|
7
|
+
password 'password'
|
8
|
+
password_confirmation 'password'
|
7
9
|
end
|
8
|
-
end
|
10
|
+
end
|
data/spec/features/boxes_spec.rb
CHANGED
@@ -3,40 +3,59 @@ RSpec.feature 'Boxes' do
|
|
3
3
|
include_context 'loaded site'
|
4
4
|
|
5
5
|
it_behaves_like 'an authenticated section', '/box'
|
6
|
-
it_behaves_like
|
6
|
+
it_behaves_like(
|
7
|
+
'an authenticated section',
|
8
|
+
'/collectives/groups:membered-group'
|
9
|
+
)
|
7
10
|
|
8
11
|
describe 'When logged in as first-user' do
|
9
12
|
before do
|
10
13
|
login_as first_user
|
11
14
|
end
|
12
15
|
describe 'Without a collective' do
|
13
|
-
|
14
16
|
describe 'Showing' do
|
15
17
|
describe 'at /box/in' do
|
16
18
|
before do
|
17
19
|
visit '/box/in'
|
18
20
|
click_link 'Last'
|
19
21
|
end
|
20
|
-
it_behaves_like
|
22
|
+
it_behaves_like(
|
23
|
+
'a bootstrap page listing a collection of items',
|
24
|
+
MessageTrain::Conversation,
|
25
|
+
plural_title: 'Inbox',
|
26
|
+
minimum: 1
|
27
|
+
)
|
21
28
|
|
22
29
|
describe 'does not list Roles dropdown' do
|
23
30
|
subject { page }
|
24
|
-
it
|
31
|
+
it do
|
32
|
+
should_not have_css(
|
33
|
+
'li.dropdown a.dropdown-toggle',
|
34
|
+
text: 'Roles'
|
35
|
+
)
|
36
|
+
end
|
25
37
|
end
|
26
38
|
|
27
39
|
describe 'shows the attachment icon on the correct conversation' do
|
28
40
|
before do
|
29
|
-
if page.has_no_css?(
|
41
|
+
if page.has_no_css?(
|
42
|
+
"#message_train_conversation_#{attachment_conversation.id}"
|
43
|
+
)
|
30
44
|
click_link 'Prev'
|
31
45
|
end
|
32
46
|
end
|
33
47
|
subject { page }
|
34
|
-
it
|
48
|
+
it do
|
49
|
+
should have_css(
|
50
|
+
"#message_train_conversation_#{attachment_conversation.id} "\
|
51
|
+
'.glyphicon-paperclip'
|
52
|
+
)
|
53
|
+
end
|
35
54
|
end
|
36
55
|
|
37
56
|
describe 'shows a link to compose' do
|
38
57
|
before do
|
39
|
-
within
|
58
|
+
within '.content' do
|
40
59
|
find('.compose').click
|
41
60
|
end
|
42
61
|
end
|
@@ -51,14 +70,20 @@ RSpec.feature 'Boxes' do
|
|
51
70
|
before do
|
52
71
|
visit '/box/in'
|
53
72
|
click_link 'Last'
|
54
|
-
find(
|
55
|
-
|
73
|
+
find(
|
74
|
+
"#message_train_conversation_#{unread_conversation.id}"
|
75
|
+
).hover
|
76
|
+
within "#message_train_conversation_#{unread_conversation.id}" do
|
56
77
|
accept_confirm do
|
57
78
|
find('.trash-toggle').click
|
58
79
|
end
|
59
80
|
end
|
60
81
|
end
|
61
|
-
it_behaves_like
|
82
|
+
it_behaves_like(
|
83
|
+
'a bootstrap page with an alert',
|
84
|
+
'info',
|
85
|
+
'Update successful'
|
86
|
+
)
|
62
87
|
end
|
63
88
|
describe 'without checking anything' do
|
64
89
|
before do
|
@@ -66,43 +91,58 @@ RSpec.feature 'Boxes' do
|
|
66
91
|
click_button 'Mark'
|
67
92
|
click_link 'mark-read'
|
68
93
|
end
|
69
|
-
it_behaves_like
|
94
|
+
it_behaves_like(
|
95
|
+
'a bootstrap page with an alert',
|
96
|
+
'warning',
|
97
|
+
'Nothing to do'
|
98
|
+
)
|
70
99
|
end
|
71
100
|
describe 'after checking a box' do
|
72
101
|
describe 'Marking Read' do
|
73
102
|
before do
|
74
103
|
visit '/box/in'
|
75
104
|
click_link 'Last'
|
76
|
-
check "objects_conversations_#{unread_conversation.id
|
105
|
+
check "objects_conversations_#{unread_conversation.id}"
|
77
106
|
click_button 'Mark'
|
78
107
|
click_link 'mark-read'
|
79
108
|
end
|
80
|
-
it_behaves_like
|
109
|
+
it_behaves_like(
|
110
|
+
'a bootstrap page with an alert',
|
111
|
+
'info',
|
112
|
+
'Update successful'
|
113
|
+
)
|
81
114
|
end
|
82
115
|
describe 'Marking Ignored' do
|
83
116
|
before do
|
84
117
|
visit '/box/in'
|
85
118
|
click_link 'Last'
|
86
|
-
check "objects_conversations_#{unread_conversation.id
|
119
|
+
check "objects_conversations_#{unread_conversation.id}"
|
87
120
|
click_button 'Mark'
|
88
121
|
click_link 'mark-ignored'
|
89
122
|
end
|
90
|
-
it_behaves_like
|
123
|
+
it_behaves_like(
|
124
|
+
'a bootstrap page with an alert',
|
125
|
+
'info',
|
126
|
+
'Update successful'
|
127
|
+
)
|
91
128
|
end
|
92
129
|
end
|
93
130
|
end
|
94
|
-
|
95
131
|
end
|
96
132
|
end
|
97
133
|
|
98
134
|
describe 'Within a collective' do
|
99
|
-
|
100
135
|
describe 'Showing' do
|
101
136
|
describe 'at /collectives/groups:membered-group/box/in' do
|
102
137
|
before do
|
103
138
|
visit '/collectives/groups:membered-group/box/in'
|
104
139
|
end
|
105
|
-
it_behaves_like
|
140
|
+
it_behaves_like(
|
141
|
+
'a bootstrap page listing a collection of items',
|
142
|
+
MessageTrain::Conversation,
|
143
|
+
plural_title: 'Inbox',
|
144
|
+
minimum: 1
|
145
|
+
)
|
106
146
|
end
|
107
147
|
end
|
108
148
|
|
@@ -114,33 +154,45 @@ RSpec.feature 'Boxes' do
|
|
114
154
|
click_button 'Mark'
|
115
155
|
click_link 'mark-read'
|
116
156
|
end
|
117
|
-
it_behaves_like
|
157
|
+
it_behaves_like(
|
158
|
+
'a bootstrap page with an alert',
|
159
|
+
'warning',
|
160
|
+
'Nothing to do'
|
161
|
+
)
|
118
162
|
end
|
119
163
|
describe 'after checking a box' do
|
120
164
|
describe 'Marking Read' do
|
121
165
|
before do
|
122
166
|
visit '/collectives/groups:membered-group/box/in'
|
123
|
-
check "objects_conversations_#{membered_group_conversation.id
|
167
|
+
check "objects_conversations_#{membered_group_conversation.id}"
|
124
168
|
click_button 'Mark'
|
125
169
|
click_link 'mark-read'
|
126
170
|
end
|
127
|
-
it_behaves_like
|
171
|
+
it_behaves_like(
|
172
|
+
'a bootstrap page with an alert',
|
173
|
+
'info',
|
174
|
+
'Update successful'
|
175
|
+
)
|
128
176
|
end
|
129
177
|
describe 'Marking Ignored' do
|
130
178
|
before do
|
131
179
|
visit '/collectives/groups:membered-group/box/in'
|
132
|
-
check "objects_conversations_#{membered_group_conversation.id
|
180
|
+
check "objects_conversations_#{membered_group_conversation.id}"
|
133
181
|
click_button 'Mark'
|
134
182
|
click_link 'mark-ignored'
|
135
183
|
end
|
136
|
-
it_behaves_like
|
184
|
+
it_behaves_like(
|
185
|
+
'a bootstrap page with an alert',
|
186
|
+
'info',
|
187
|
+
'Update successful'
|
188
|
+
)
|
137
189
|
end
|
138
190
|
end
|
139
191
|
end
|
140
|
-
|
141
192
|
end
|
142
193
|
end
|
143
194
|
end
|
195
|
+
|
144
196
|
describe 'When logged in as admin-user' do
|
145
197
|
before do
|
146
198
|
login_as admin_user
|
@@ -11,9 +11,13 @@ RSpec.feature 'Conversations' do
|
|
11
11
|
describe 'Showing' do
|
12
12
|
describe 'at /box/in/conversations/:id' do
|
13
13
|
before do
|
14
|
-
visit
|
14
|
+
visit "/box/in/conversations/#{unread_conversation.id}"
|
15
15
|
end
|
16
|
-
it_behaves_like
|
16
|
+
it_behaves_like(
|
17
|
+
'a bootstrap page showing an item',
|
18
|
+
MessageTrain::Conversation,
|
19
|
+
'Unread Conversation'
|
20
|
+
)
|
17
21
|
|
18
22
|
describe 'shows a reply link' do
|
19
23
|
before do
|
@@ -27,19 +31,27 @@ RSpec.feature 'Conversations' do
|
|
27
31
|
describe 'at /box/in/conversations/:id' do
|
28
32
|
describe 'Marking Read' do
|
29
33
|
before do
|
30
|
-
visit
|
31
|
-
click_link "mark_read_#{unread_message.id
|
34
|
+
visit "/box/in/conversations/#{unread_conversation.id}"
|
35
|
+
click_link "mark_read_#{unread_message.id}"
|
32
36
|
end
|
33
|
-
it_behaves_like
|
37
|
+
it_behaves_like(
|
38
|
+
'a bootstrap page with an alert',
|
39
|
+
'info',
|
40
|
+
'Update successful'
|
41
|
+
)
|
34
42
|
end
|
35
43
|
describe 'Marking Ignored' do
|
36
44
|
before do
|
37
|
-
visit
|
45
|
+
visit "/box/in/conversations/#{unread_conversation.id}"
|
38
46
|
accept_confirm do
|
39
47
|
click_link 'Mark as Ignored'
|
40
48
|
end
|
41
49
|
end
|
42
|
-
it_behaves_like
|
50
|
+
it_behaves_like(
|
51
|
+
'a bootstrap page with an alert',
|
52
|
+
'info',
|
53
|
+
'Update successful'
|
54
|
+
)
|
43
55
|
end
|
44
56
|
end
|
45
57
|
end
|
@@ -17,7 +17,11 @@ RSpec.feature 'Messages' do
|
|
17
17
|
fill_in_ckeditor 'Body', with: 'This is the body.'
|
18
18
|
submit_via_button 'Send'
|
19
19
|
end
|
20
|
-
it_behaves_like
|
20
|
+
it_behaves_like(
|
21
|
+
'a bootstrap page with an alert',
|
22
|
+
'warning',
|
23
|
+
'Message saved as draft.'
|
24
|
+
)
|
21
25
|
end
|
22
26
|
end
|
23
27
|
describe 'Composing', js: true do
|
@@ -31,10 +35,16 @@ RSpec.feature 'Messages' do
|
|
31
35
|
click_link 'add-attachment'
|
32
36
|
click_link 'add-attachment'
|
33
37
|
within '#attachments .nested-fields:nth-child(1)' do
|
34
|
-
attach_file 'Attachment', File.absolute_path(
|
38
|
+
attach_file 'Attachment', File.absolute_path(
|
39
|
+
'./spec/dummy/app/assets/files/message_train/attachments/'\
|
40
|
+
'example.pdf'
|
41
|
+
)
|
35
42
|
end
|
36
43
|
within '#attachments .nested-fields:nth-child(2)' do
|
37
|
-
attach_file 'Attachment', File.absolute_path(
|
44
|
+
attach_file 'Attachment', File.absolute_path(
|
45
|
+
'./spec/dummy/app/assets/files/message_train/attachments/'\
|
46
|
+
'Bambisj.jpg'
|
47
|
+
)
|
38
48
|
end
|
39
49
|
within '#attachments .nested-fields:nth-child(3)' do
|
40
50
|
accept_confirm do
|
@@ -43,7 +53,11 @@ RSpec.feature 'Messages' do
|
|
43
53
|
end
|
44
54
|
submit_via_button 'Send'
|
45
55
|
end
|
46
|
-
it_behaves_like
|
56
|
+
it_behaves_like(
|
57
|
+
'a bootstrap page with an alert',
|
58
|
+
'info',
|
59
|
+
'Message sent.'
|
60
|
+
)
|
47
61
|
end
|
48
62
|
end
|
49
63
|
describe 'Editing a Draft', js: true do
|
@@ -54,8 +68,13 @@ RSpec.feature 'Messages' do
|
|
54
68
|
fill_in 'Subject', with: 'This is the subject.'
|
55
69
|
fill_in_ckeditor 'Body', with: 'This is the body.'
|
56
70
|
submit_via_button 'Send'
|
71
|
+
wait_until { page.has_css?('.alert') }
|
57
72
|
end
|
58
|
-
it_behaves_like
|
73
|
+
it_behaves_like(
|
74
|
+
'a bootstrap page with an alert',
|
75
|
+
'info',
|
76
|
+
'Message sent.'
|
77
|
+
)
|
59
78
|
it_behaves_like 'a bootstrap page without an alert', 'warning'
|
60
79
|
end
|
61
80
|
end
|
@@ -13,10 +13,13 @@ RSpec.feature 'Unsubscribes' do
|
|
13
13
|
before do
|
14
14
|
visit '/unsubscribes'
|
15
15
|
end
|
16
|
-
it_behaves_like
|
17
|
-
|
16
|
+
it_behaves_like(
|
17
|
+
'a bootstrap page',
|
18
|
+
title: 'Manage Your Email Notifications'
|
19
|
+
)
|
20
|
+
context 'displays a list of #subscriptions in .subscription' do
|
18
21
|
subject { page }
|
19
|
-
it { should have_css(
|
22
|
+
it { should have_css('#subscriptions .subscription', minimum: 3) }
|
20
23
|
end
|
21
24
|
end
|
22
25
|
end
|
@@ -25,16 +28,28 @@ RSpec.feature 'Unsubscribes' do
|
|
25
28
|
describe 'with a specific item' do
|
26
29
|
before do
|
27
30
|
visit '/unsubscribes'
|
28
|
-
find("#unsubscribe-group-#{membered_group.id
|
31
|
+
find("#unsubscribe-group-#{membered_group.id}").click
|
29
32
|
end
|
30
|
-
it_behaves_like
|
33
|
+
it_behaves_like(
|
34
|
+
'a bootstrap page with an alert',
|
35
|
+
'info',
|
36
|
+
'You are now unsubscribed from Membered Group, which means that '\
|
37
|
+
'you will not be notified by email of any messages received by '\
|
38
|
+
'that Group.'
|
39
|
+
)
|
31
40
|
end
|
32
41
|
describe 'with all button' do
|
33
42
|
before do
|
34
43
|
visit '/unsubscribes'
|
35
44
|
click_link 'Disable All Notifications'
|
36
45
|
end
|
37
|
-
it_behaves_like
|
46
|
+
it_behaves_like(
|
47
|
+
'a bootstrap page with an alert',
|
48
|
+
'info',
|
49
|
+
'You have unsubscribed from all messages, which means that you '\
|
50
|
+
'will not be notified by email of any messages received in any '\
|
51
|
+
'of your boxes.'
|
52
|
+
)
|
38
53
|
end
|
39
54
|
end
|
40
55
|
end
|
@@ -42,9 +57,15 @@ RSpec.feature 'Unsubscribes' do
|
|
42
57
|
describe 'at /unsubscribes' do
|
43
58
|
before do
|
44
59
|
visit '/unsubscribes'
|
45
|
-
find("#remove-unsubscribe-#{unsubscribed_group.id
|
60
|
+
find("#remove-unsubscribe-#{unsubscribed_group.id}").click
|
46
61
|
end
|
47
|
-
it_behaves_like
|
62
|
+
it_behaves_like(
|
63
|
+
'a bootstrap page with an alert',
|
64
|
+
'info',
|
65
|
+
'You are no longer unsubscribed from Unsubscribed Group, which '\
|
66
|
+
'means that you will now be notified by email of any messages '\
|
67
|
+
'received in that Group.'
|
68
|
+
)
|
48
69
|
end
|
49
70
|
describe 'with all button' do
|
50
71
|
before do
|
@@ -52,7 +73,13 @@ RSpec.feature 'Unsubscribes' do
|
|
52
73
|
click_link 'Disable All Notifications'
|
53
74
|
click_link 'Enable Some Notifications'
|
54
75
|
end
|
55
|
-
it_behaves_like
|
76
|
+
it_behaves_like(
|
77
|
+
'a bootstrap page with an alert',
|
78
|
+
'info',
|
79
|
+
'You are no longer unsubscribed from all messages, which means that '\
|
80
|
+
'you will now be notified by email of any messages received in '\
|
81
|
+
'boxes you are subscribed to.'
|
82
|
+
)
|
56
83
|
end
|
57
84
|
end
|
58
85
|
end
|