message_train 0.7.5 → 1.0.0
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 +5 -5
- data/.gitattributes +1 -0
- data/.github/workflows/ci.yml +86 -0
- data/.gitignore +64 -0
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +854 -2
- data/.ruby-version +1 -1
- data/.simplecov +2 -4
- data/CHANGELOG.md +128 -0
- data/CLAUDE.md +5 -0
- data/Gemfile +30 -32
- data/LICENSE.txt +1 -1
- data/README.md +106 -35
- data/Rakefile +4 -18
- data/app/assets/stylesheets/message_train.scss +405 -67
- data/app/controllers/concerns/message_train_support.rb +2 -2
- data/app/controllers/message_train/boxes_controller.rb +4 -2
- data/app/controllers/message_train/conversations_controller.rb +1 -0
- data/app/helpers/message_train/application_helper.rb +68 -0
- data/app/helpers/message_train/attachments_helper.rb +7 -4
- data/app/helpers/message_train/conversations_helper.rb +16 -16
- data/app/helpers/message_train/messages_helper.rb +23 -10
- data/app/javascript/controllers/message_train/bulk_actions_controller.js +36 -0
- data/app/javascript/controllers/message_train/lightbox_controller.js +25 -0
- data/app/javascript/controllers/message_train/nested_form_controller.js +36 -0
- data/app/javascript/controllers/message_train/recipient_autocomplete_controller.js +31 -0
- data/app/mailers/message_train/previews/receipt_mailer_preview.rb +7 -5
- data/app/models/message_train/attachment.rb +54 -42
- data/app/models/message_train/box.rb +2 -2
- data/app/models/message_train/conversation.rb +28 -2
- data/app/models/message_train/ignore.rb +2 -2
- data/app/models/message_train/message.rb +10 -4
- data/app/models/message_train/receipt.rb +27 -4
- data/app/models/message_train/unsubscribe.rb +1 -1
- data/app/views/application/404.html.haml +1 -3
- data/app/views/kaminari/_first_page.html.haml +1 -1
- data/app/views/kaminari/_last_page.html.haml +1 -1
- data/app/views/kaminari/_next_page.html.haml +1 -1
- data/app/views/kaminari/_page.html.haml +3 -3
- data/app/views/kaminari/_paginator.html.haml +12 -11
- data/app/views/kaminari/_prev_page.html.haml +1 -1
- data/app/views/message_train/application/_attachment_fields.html.haml +10 -7
- data/app/views/message_train/application/_attachment_link.html.haml +2 -2
- data/app/views/message_train/application/_widget.html.haml +2 -4
- data/app/views/message_train/boxes/_widget.html.haml +5 -5
- data/app/views/message_train/boxes/show.html.haml +28 -45
- data/app/views/message_train/collectives/_widget.html.haml +4 -4
- data/app/views/message_train/conversations/_conversation.html.haml +11 -11
- 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 +2 -2
- data/app/views/message_train/conversations/_toggle.html.haml +6 -4
- data/app/views/message_train/conversations/_trashed_toggle.html.haml +2 -2
- data/app/views/message_train/conversations/show.html.haml +8 -6
- data/app/views/message_train/messages/_deleted_toggle.html.haml +1 -1
- data/app/views/message_train/messages/_form.html.haml +22 -30
- data/app/views/message_train/messages/_message.html.haml +27 -45
- data/app/views/message_train/messages/_read_toggle.html.haml +2 -2
- data/app/views/message_train/messages/_toggle.html.haml +5 -1
- data/app/views/message_train/messages/_trashed_toggle.html.haml +2 -2
- data/app/views/message_train/unsubscribes/index.html.haml +12 -15
- data/badges/coverage.json +1 -0
- data/config/importmap.rb +2 -0
- data/config/locales/en.yml +6 -3
- data/db/migrate/20150721145319_create_message_train_conversations.rb +1 -1
- data/db/migrate/20150721160322_create_message_train_messages.rb +1 -1
- data/db/migrate/20150721161144_create_message_train_attachments.rb +5 -2
- data/db/migrate/20150721161940_create_message_train_receipts.rb +1 -1
- data/db/migrate/20150721163838_create_message_train_ignores.rb +1 -1
- data/db/migrate/20150901183458_add_received_through_to_message_train_receipts.rb +1 -1
- data/db/migrate/20151004184347_add_unique_index_to_receipts.rb +1 -1
- data/db/migrate/20151124000820_create_message_train_unsubscribes.rb +1 -1
- data/db/migrate/20260827095938_remove_paperclip_columns_from_message_train_attachments.rb +8 -0
- data/db/migrate/20260827171549_remove_body_from_message_train_messages.rb +5 -0
- data/db/migrate/20260827180000_add_marking_indexes.rb +9 -0
- data/db/migrate/20260827200000_add_body_back_to_message_train_messages.rb +5 -0
- data/docs/screenshots/inbox-desktop.png +0 -0
- data/docs/screenshots/inbox-mobile.png +0 -0
- data/lib/generators/message_train/install/install_generator.rb +1 -1
- data/lib/message_train/engine.rb +11 -0
- data/lib/message_train/instance_methods.rb +13 -7
- data/lib/message_train/localization.rb +4 -3
- data/lib/message_train/version.rb +1 -1
- data/lib/message_train.rb +0 -2
- data/message_train.gemspec +57 -389
- data/spec/controllers/message_train/boxes_controller_spec.rb +13 -8
- data/spec/controllers/message_train/concerns_spec.rb +2 -2
- data/spec/controllers/message_train/conversations_controller_spec.rb +36 -7
- data/spec/controllers/message_train/messages_controller_spec.rb +4 -4
- data/spec/dummy/app/assets/stylesheets/application.scss +141 -12
- data/spec/dummy/app/controllers/application_controller.rb +1 -1
- data/spec/dummy/app/javascript/application.js +4 -0
- data/spec/dummy/app/javascript/controllers/application.js +9 -0
- data/spec/dummy/app/javascript/controllers/index.js +4 -0
- data/spec/dummy/app/models/role.rb +1 -1
- data/spec/dummy/app/views/active_storage/blobs/_blob.html.erb +14 -0
- data/spec/dummy/app/views/layouts/_top_navigation.html.haml +18 -7
- data/spec/dummy/app/views/layouts/application.html.haml +22 -26
- data/spec/dummy/bin/importmap +4 -0
- data/spec/dummy/config/application.rb +7 -20
- data/spec/dummy/config/environments/development.rb +17 -21
- data/spec/dummy/config/environments/production.rb +11 -63
- data/spec/dummy/config/environments/test.rb +21 -16
- data/spec/dummy/config/importmap.rb +7 -0
- data/spec/dummy/config/initializers/assets.rb +1 -6
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/config/storage.yml +7 -0
- data/spec/dummy/db/migrate/20150721140013_devise_create_users.rb +1 -1
- data/spec/dummy/db/migrate/20150721141009_rolify_create_roles.rb +1 -1
- data/spec/dummy/db/migrate/20150721141128_create_groups.rb +1 -1
- data/spec/dummy/db/migrate/20150721150307_add_display_name_column_to_users.rb +1 -1
- data/spec/dummy/db/migrate/20160207190402_create_message_train_conversations.message_train.rb +1 -1
- data/spec/dummy/db/migrate/20160207190403_create_message_train_messages.message_train.rb +1 -1
- data/spec/dummy/db/migrate/20160207190404_create_message_train_attachments.message_train.rb +5 -2
- data/spec/dummy/db/migrate/20160207190405_create_message_train_receipts.message_train.rb +1 -1
- data/spec/dummy/db/migrate/20160207190406_create_message_train_ignores.message_train.rb +1 -1
- data/spec/dummy/db/migrate/20160207190407_add_received_through_to_message_train_receipts.message_train.rb +1 -1
- data/spec/dummy/db/migrate/20160207190408_add_unique_index_to_receipts.message_train.rb +1 -1
- data/spec/dummy/db/migrate/20160207190409_create_message_train_unsubscribes.message_train.rb +1 -1
- data/spec/dummy/db/migrate/20260827095939_remove_paperclip_columns_from_message_train_attachments.message_train.rb +9 -0
- data/spec/dummy/db/migrate/20260827161141_create_active_storage_tables.active_storage.rb +57 -0
- data/spec/dummy/db/migrate/20260827171550_remove_body_from_message_train_messages.message_train.rb +6 -0
- data/spec/dummy/db/migrate/20260827225116_add_marking_indexes.message_train.rb +10 -0
- data/spec/dummy/db/migrate/20260828034830_add_body_back_to_message_train_messages.message_train.rb +6 -0
- data/spec/dummy/db/migrate/20260828040000_drop_action_text_tables.rb +5 -0
- data/spec/dummy/db/schema.rb +106 -72
- data/spec/dummy/db/seeds/conversations.seeds.rb +22 -22
- data/spec/dummy/db/seeds/development/conversations.seeds.rb +2 -2
- data/spec/dummy/db/seeds/groups.seeds.rb +4 -4
- data/spec/dummy/db/seeds/test/attachments.seeds.rb +4 -4
- data/spec/dummy/db/seeds/test/conversations.seeds.rb +2 -2
- data/spec/dummy/db/seeds/users.seeds.rb +8 -8
- data/spec/dummy/vendor/javascript/.keep +0 -0
- data/spec/factories/attachment.rb +5 -6
- data/spec/factories/group.rb +2 -2
- data/spec/factories/message.rb +7 -7
- data/spec/factories/user.rb +3 -3
- data/spec/features/boxes_spec.rb +38 -34
- data/spec/features/conversations_spec.rb +13 -6
- data/spec/features/messages_spec.rb +20 -20
- data/spec/features/unsubscribes_spec.rb +9 -9
- data/spec/helpers/message_train/application_helper_spec.rb +16 -18
- data/spec/helpers/message_train/attachment_helper_spec.rb +8 -18
- data/spec/helpers/message_train/boxes_helper_spec.rb +6 -6
- data/spec/helpers/message_train/collectives_helper_spec.rb +10 -10
- data/spec/helpers/message_train/conversations_helper_spec.rb +43 -85
- data/spec/helpers/message_train/messages_helper_spec.rb +41 -61
- data/spec/models/message_train/attachment_spec.rb +26 -36
- data/spec/models/message_train/box_spec.rb +2 -2
- data/spec/models/message_train/conversation_spec.rb +15 -0
- data/spec/models/message_train/message_spec.rb +5 -1
- data/spec/models/message_train/receipt_spec.rb +1 -1
- data/spec/models/message_train/unsubscribe_spec.rb +1 -1
- data/spec/rails_helper.rb +14 -13
- data/spec/support/controller_behaviors.rb +13 -13
- data/spec/support/factory_bot.rb +3 -0
- data/spec/support/feature_behaviors.rb +14 -14
- data/spec/support/loaded_site/attachments.rb +6 -2
- data/spec/support/utilities.rb +49 -20
- metadata +260 -189
- data/.travis.yml +0 -12
- data/VERSION +0 -1
- data/app/assets/javascripts/ckeditor/config.js +0 -49
- data/app/assets/javascripts/message_train.js +0 -149
- data/spec/dummy/app/assets/javascripts/application.js +0 -17
- data/spec/dummy/app/assets/stylesheets/bootstrap-everything.scss +0 -54
- data/spec/dummy/config/initializers/bootstrap_leather.rb +0 -7
- data/spec/dummy/config/initializers/paperclip.rb +0 -5
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/support/factory_girl.rb +0 -3
|
@@ -2,7 +2,7 @@ require 'rails_helper'
|
|
|
2
2
|
RSpec.feature 'Messages' do
|
|
3
3
|
include_context 'loaded site'
|
|
4
4
|
|
|
5
|
-
it_behaves_like 'an authenticated section', '/box/in/messages/new'
|
|
5
|
+
it_behaves_like 'an authenticated section', '/messages/box/in/messages/new'
|
|
6
6
|
|
|
7
7
|
describe 'When logged in' do
|
|
8
8
|
before do
|
|
@@ -11,10 +11,10 @@ RSpec.feature 'Messages' do
|
|
|
11
11
|
describe 'Drafting', js: true do
|
|
12
12
|
describe 'at /box/in/messages' do
|
|
13
13
|
before do
|
|
14
|
-
visit '/box/in/messages/new/'
|
|
14
|
+
visit '/messages/box/in/messages/new/'
|
|
15
15
|
fill_in_autocomplete 'Recipients', with: 'x'
|
|
16
16
|
fill_in 'Subject', with: 'This is a draft.'
|
|
17
|
-
|
|
17
|
+
fill_in 'Body', with: 'This is the body.'
|
|
18
18
|
submit_via_button 'Send'
|
|
19
19
|
wait_until { page.has_css? '.alert' }
|
|
20
20
|
end
|
|
@@ -28,28 +28,28 @@ RSpec.feature 'Messages' do
|
|
|
28
28
|
describe 'Composing', js: true do
|
|
29
29
|
describe 'at /box/in/messages' do
|
|
30
30
|
before do
|
|
31
|
-
visit '/box/in/messages/new/'
|
|
31
|
+
visit '/messages/box/in/messages/new/'
|
|
32
32
|
fill_in_autocomplete 'Recipients', with: 'sec'
|
|
33
33
|
fill_in 'Subject', with: 'This is the subject.'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
within '#attachments .
|
|
34
|
+
fill_in 'Body', with: 'This is the body.'
|
|
35
|
+
click_button 'add-attachment'
|
|
36
|
+
click_button 'add-attachment'
|
|
37
|
+
click_button 'add-attachment'
|
|
38
|
+
within '#attachments .message-train-attachment-fields:nth-child(1)' do
|
|
39
39
|
attach_file 'Attachment', File.absolute_path(
|
|
40
40
|
'./spec/dummy/app/assets/files/message_train/attachments/'\
|
|
41
41
|
'example.pdf'
|
|
42
42
|
)
|
|
43
43
|
end
|
|
44
|
-
within '#attachments .
|
|
44
|
+
within '#attachments .message-train-attachment-fields:nth-child(2)' do
|
|
45
45
|
attach_file 'Attachment', File.absolute_path(
|
|
46
46
|
'./spec/dummy/app/assets/files/message_train/attachments/'\
|
|
47
47
|
'Bambisj.jpg'
|
|
48
48
|
)
|
|
49
49
|
end
|
|
50
|
-
within '#attachments .
|
|
50
|
+
within '#attachments .message-train-attachment-fields:nth-child(3)' do
|
|
51
51
|
accept_confirm do
|
|
52
|
-
find('
|
|
52
|
+
find('button').click
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
submit_via_button 'Send'
|
|
@@ -65,19 +65,19 @@ RSpec.feature 'Messages' do
|
|
|
65
65
|
describe 'Editing a Draft', js: true do
|
|
66
66
|
describe 'at /box/in/messages' do
|
|
67
67
|
before do
|
|
68
|
-
visit "/box/in/conversations/#{draft_conversation.id}"
|
|
68
|
+
visit "/messages/box/in/conversations/#{draft_conversation.id}"
|
|
69
69
|
fill_in_autocomplete 'Recipients', with: 'sec'
|
|
70
70
|
fill_in 'Subject', with: 'This is the subject.'
|
|
71
|
-
|
|
71
|
+
fill_in 'Body', with: 'This is the body.'
|
|
72
72
|
submit_via_button 'Send'
|
|
73
73
|
wait_until { page.has_css?('.alert') }
|
|
74
74
|
end
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
it 'shows a sent alert and no draft-saved alert' do
|
|
76
|
+
expect(page).to have_selector(
|
|
77
|
+
'#alert_area .alert.info', text: 'Message sent.'
|
|
78
|
+
)
|
|
79
|
+
expect(page).not_to have_selector('#alert_area .alert.warning')
|
|
80
|
+
end
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
end
|
|
@@ -2,7 +2,7 @@ require 'rails_helper'
|
|
|
2
2
|
RSpec.feature 'Unsubscribes' do
|
|
3
3
|
include_context 'loaded site'
|
|
4
4
|
|
|
5
|
-
it_behaves_like 'an authenticated section', '/unsubscribes'
|
|
5
|
+
it_behaves_like 'an authenticated section', '/messages/unsubscribes'
|
|
6
6
|
|
|
7
7
|
describe 'When logged in' do
|
|
8
8
|
before do
|
|
@@ -11,7 +11,7 @@ RSpec.feature 'Unsubscribes' do
|
|
|
11
11
|
describe 'Index' do
|
|
12
12
|
describe 'at /unsubscribes' do
|
|
13
13
|
before do
|
|
14
|
-
visit '/unsubscribes'
|
|
14
|
+
visit '/messages/unsubscribes'
|
|
15
15
|
end
|
|
16
16
|
it_behaves_like(
|
|
17
17
|
'a bootstrap page',
|
|
@@ -27,7 +27,7 @@ RSpec.feature 'Unsubscribes' do
|
|
|
27
27
|
describe 'at /unsubscribes' do
|
|
28
28
|
describe 'with a specific item' do
|
|
29
29
|
before do
|
|
30
|
-
visit '/unsubscribes'
|
|
30
|
+
visit '/messages/unsubscribes'
|
|
31
31
|
find("#unsubscribe-group-#{membered_group.id}").click
|
|
32
32
|
end
|
|
33
33
|
it_behaves_like(
|
|
@@ -40,8 +40,8 @@ RSpec.feature 'Unsubscribes' do
|
|
|
40
40
|
end
|
|
41
41
|
describe 'with all button' do
|
|
42
42
|
before do
|
|
43
|
-
visit '/unsubscribes'
|
|
44
|
-
|
|
43
|
+
visit '/messages/unsubscribes'
|
|
44
|
+
click_button 'Disable All Notifications'
|
|
45
45
|
end
|
|
46
46
|
it_behaves_like(
|
|
47
47
|
'a bootstrap page with an alert',
|
|
@@ -56,7 +56,7 @@ RSpec.feature 'Unsubscribes' do
|
|
|
56
56
|
describe 'Removing an Unsubscribe' do
|
|
57
57
|
describe 'at /unsubscribes' do
|
|
58
58
|
before do
|
|
59
|
-
visit '/unsubscribes'
|
|
59
|
+
visit '/messages/unsubscribes'
|
|
60
60
|
find("#remove-unsubscribe-#{unsubscribed_group.id}").click
|
|
61
61
|
end
|
|
62
62
|
it_behaves_like(
|
|
@@ -69,9 +69,9 @@ RSpec.feature 'Unsubscribes' do
|
|
|
69
69
|
end
|
|
70
70
|
describe 'with all button' do
|
|
71
71
|
before do
|
|
72
|
-
visit '/unsubscribes'
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
visit '/messages/unsubscribes'
|
|
73
|
+
click_button 'Disable All Notifications'
|
|
74
|
+
click_button 'Enable Some Notifications'
|
|
75
75
|
end
|
|
76
76
|
it_behaves_like(
|
|
77
77
|
'a bootstrap page with an alert',
|
|
@@ -7,57 +7,55 @@ describe MessageTrain::ApplicationHelper do
|
|
|
7
7
|
before do
|
|
8
8
|
view.extend MessageTrain::BoxesHelper
|
|
9
9
|
view.extend MessageTrain::CollectivesHelper
|
|
10
|
-
view.extend
|
|
10
|
+
view.extend MessageTrain::ApplicationHelper
|
|
11
11
|
login_user first_user
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
describe '#message_train_widget' do
|
|
15
15
|
context 'when @collective is nil' do
|
|
16
16
|
before do
|
|
17
|
-
helper.
|
|
17
|
+
allow(helper).to receive(:controller_name) { 'boxes' }
|
|
18
18
|
assign(:collective, nil)
|
|
19
19
|
assign(:box_user, first_user)
|
|
20
|
-
helper.message_train_widget
|
|
21
20
|
end
|
|
22
|
-
subject { helper.
|
|
23
|
-
it {
|
|
24
|
-
it {
|
|
25
|
-
it {
|
|
21
|
+
subject { helper.message_train_widget }
|
|
22
|
+
it { is_expected.to have_tag 'h3', text: /Messages/ }
|
|
23
|
+
it { is_expected.to have_tag 'ul', with: { class: 'message-train-list-group' } }
|
|
24
|
+
it { is_expected.to have_tag 'li', with: { class: 'message-train-list-group-item' }, count: 6 }
|
|
26
25
|
end
|
|
27
26
|
context 'when @collective is set' do
|
|
28
27
|
before do
|
|
29
|
-
helper.
|
|
28
|
+
allow(helper).to receive(:controller_name) { 'boxes' }
|
|
30
29
|
assign(:collective, membered_group)
|
|
31
30
|
assign(:box_user, first_user)
|
|
32
|
-
helper.message_train_widget
|
|
33
31
|
end
|
|
34
|
-
subject { helper.
|
|
35
|
-
it {
|
|
36
|
-
it {
|
|
37
|
-
it {
|
|
32
|
+
subject { helper.message_train_widget }
|
|
33
|
+
it { is_expected.to have_tag 'h3', text: /Membered Group Messages/ }
|
|
34
|
+
it { is_expected.to have_tag 'ul', with: { class: 'message-train-list-group' } }
|
|
35
|
+
it { is_expected.to have_tag 'li', with: { class: 'message-train-list-group-item' }, count: 4 }
|
|
38
36
|
end
|
|
39
37
|
end
|
|
40
38
|
|
|
41
39
|
describe '#fuzzy_date' do
|
|
42
40
|
context 'when less than a minute ago' do
|
|
43
41
|
subject { helper.fuzzy_date(30.seconds.ago) }
|
|
44
|
-
it {
|
|
42
|
+
it { is_expected.to eq 'Just Now' }
|
|
45
43
|
end
|
|
46
44
|
context 'when less than an day ago' do
|
|
47
45
|
subject { helper.fuzzy_date(2.hours.ago) }
|
|
48
|
-
it {
|
|
46
|
+
it { is_expected.to eq 2.hours.ago.strftime('%l:%M %p') }
|
|
49
47
|
end
|
|
50
48
|
context 'when less than a week ago' do
|
|
51
49
|
subject { helper.fuzzy_date(2.days.ago) }
|
|
52
|
-
it {
|
|
50
|
+
it { is_expected.to eq 2.days.ago.strftime('%a %l:%M %p') }
|
|
53
51
|
end
|
|
54
52
|
context 'when less than a year ago' do
|
|
55
53
|
subject { helper.fuzzy_date(2.months.ago) }
|
|
56
|
-
it {
|
|
54
|
+
it { is_expected.to eq 2.months.ago.strftime('%b %-d') }
|
|
57
55
|
end
|
|
58
56
|
context 'when more than a year ago' do
|
|
59
57
|
subject { helper.fuzzy_date(2.years.ago) }
|
|
60
|
-
it {
|
|
58
|
+
it { is_expected.to eq 2.years.ago.strftime('%b %-d, %Y') }
|
|
61
59
|
end
|
|
62
60
|
end
|
|
63
61
|
end
|
|
@@ -4,22 +4,18 @@ describe MessageTrain::AttachmentsHelper do
|
|
|
4
4
|
include_context 'loaded site'
|
|
5
5
|
|
|
6
6
|
before do
|
|
7
|
-
view.extend
|
|
7
|
+
view.extend MessageTrain::ApplicationHelper
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#attachment_icon' do
|
|
11
11
|
context 'when attachment is an image' do
|
|
12
12
|
subject { helper.attachment_icon(image_attachment) }
|
|
13
|
-
it
|
|
14
|
-
should have_tag(
|
|
15
|
-
:img,
|
|
16
|
-
with: { src: image_attachment.attachment.url(:thumb) }
|
|
17
|
-
)
|
|
18
|
-
end
|
|
13
|
+
it { is_expected.to have_tag(:img) }
|
|
19
14
|
end
|
|
20
15
|
context 'when attachment is a file' do
|
|
21
16
|
subject { helper.attachment_icon(pdf_attachment) }
|
|
22
|
-
it {
|
|
17
|
+
it { is_expected.to have_tag :span, with: { class: 'message-train-icon' } }
|
|
18
|
+
it { is_expected.to match(pdf_attachment.attachment.filename.to_s) }
|
|
23
19
|
end
|
|
24
20
|
end
|
|
25
21
|
|
|
@@ -27,16 +23,13 @@ describe MessageTrain::AttachmentsHelper do
|
|
|
27
23
|
context 'when attachment is an image' do
|
|
28
24
|
subject { helper.attachment_link(image_attachment) }
|
|
29
25
|
it do
|
|
30
|
-
|
|
26
|
+
is_expected.to have_tag(
|
|
31
27
|
:a,
|
|
32
28
|
with: {
|
|
33
29
|
href: '#',
|
|
34
30
|
class: 'thumbnail',
|
|
35
|
-
'data-
|
|
36
|
-
'data-
|
|
37
|
-
'data-src' => image_attachment.attachment.url(:large),
|
|
38
|
-
'data-original' => image_attachment.attachment.url(:original),
|
|
39
|
-
'data-text' => 'Click for Original'
|
|
31
|
+
'data-controller' => 'message-train--lightbox',
|
|
32
|
+
'data-lightbox-dialog-id' => 'attachment_preview'
|
|
40
33
|
}
|
|
41
34
|
)
|
|
42
35
|
end
|
|
@@ -44,10 +37,7 @@ describe MessageTrain::AttachmentsHelper do
|
|
|
44
37
|
context 'when attachment is a file' do
|
|
45
38
|
subject { helper.attachment_link(pdf_attachment) }
|
|
46
39
|
it do
|
|
47
|
-
|
|
48
|
-
:a,
|
|
49
|
-
with: { href: pdf_attachment.attachment.url, class: 'thumbnail' }
|
|
50
|
-
)
|
|
40
|
+
is_expected.to have_tag(:a, with: { class: 'thumbnail' })
|
|
51
41
|
end
|
|
52
42
|
end
|
|
53
43
|
end
|
|
@@ -5,32 +5,32 @@ describe MessageTrain::BoxesHelper do
|
|
|
5
5
|
include ControllerMacros
|
|
6
6
|
|
|
7
7
|
before do
|
|
8
|
-
view.extend
|
|
8
|
+
view.extend MessageTrain::ApplicationHelper
|
|
9
9
|
login_user first_user
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
context '#box_nav_item' do
|
|
13
13
|
subject { helper.box_nav_item(first_user.box(:in)) }
|
|
14
14
|
it { should have_tag 'li', text: /Inbox/ }
|
|
15
|
-
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
|
15
|
+
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'message-train-badge' } }
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
context '#box_list_item' do
|
|
19
19
|
subject { helper.box_list_item(first_user.box(:in), class: 'foo') }
|
|
20
20
|
it { should have_tag 'li', text: /Inbox/, with: { class: 'foo' } }
|
|
21
|
-
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
|
21
|
+
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'message-train-badge' } }
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
context '#boxes_widget' do
|
|
25
25
|
subject { helper.boxes_widget(first_user) }
|
|
26
26
|
it { should have_tag 'h3', text: /Messages/ }
|
|
27
|
-
it { should have_tag 'ul', with: { class: 'list-group' } }
|
|
28
|
-
it { should have_tag 'li', with: { class: 'list-group-item' }, count: 6 }
|
|
27
|
+
it { should have_tag 'ul', with: { class: 'message-train-list-group' } }
|
|
28
|
+
it { should have_tag 'li', with: { class: 'message-train-list-group-item' }, count: 6 }
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
describe '#boxes_dropdown_list' do
|
|
32
32
|
subject { helper.boxes_dropdown_list(first_user) }
|
|
33
|
-
it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 }
|
|
33
|
+
it { should have_tag 'ul', with: { class: 'message-train-dropdown-menu' }, count: 1 }
|
|
34
34
|
it { should have_tag 'li', text: /^Inbox/ }
|
|
35
35
|
it { should have_tag 'li', text: /^Sent/ }
|
|
36
36
|
it { should have_tag 'li', text: /^All/ }
|
|
@@ -5,15 +5,15 @@ describe MessageTrain::CollectivesHelper do
|
|
|
5
5
|
include ControllerMacros
|
|
6
6
|
|
|
7
7
|
before do
|
|
8
|
-
view.extend
|
|
8
|
+
view.extend MessageTrain::ApplicationHelper
|
|
9
9
|
login_user first_user
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe '#collective_boxes_widget' do
|
|
13
13
|
subject { helper.collective_boxes_widget(membered_group, first_user) }
|
|
14
14
|
it { should have_tag 'h3', text: /Membered Group Messages/ }
|
|
15
|
-
it { should have_tag 'ul', with: { class: 'list-group' } }
|
|
16
|
-
it { should have_tag 'li', with: { class: 'list-group-item' }, count: 4 }
|
|
15
|
+
it { should have_tag 'ul', with: { class: 'message-train-list-group' } }
|
|
16
|
+
it { should have_tag 'li', with: { class: 'message-train-list-group-item' }, count: 4 }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
describe '#collective_nav_item' do
|
|
@@ -28,7 +28,7 @@ describe MessageTrain::CollectivesHelper do
|
|
|
28
28
|
helper.collective_nav_item(first_group.box(:in, first_user), first_user)
|
|
29
29
|
end
|
|
30
30
|
it { should have_tag 'li', text: /^First Group/ }
|
|
31
|
-
it { should_not have_tag 'span', with: { class: 'badge' } }
|
|
31
|
+
it { should_not have_tag 'span', with: { class: 'message-train-badge' } }
|
|
32
32
|
end
|
|
33
33
|
context 'when there are unread messages' do
|
|
34
34
|
subject do
|
|
@@ -38,7 +38,7 @@ describe MessageTrain::CollectivesHelper do
|
|
|
38
38
|
)
|
|
39
39
|
end
|
|
40
40
|
it { should have_tag 'li', text: /^Membered Group/ }
|
|
41
|
-
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
|
41
|
+
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'message-train-badge' } }
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -48,14 +48,14 @@ describe MessageTrain::CollectivesHelper do
|
|
|
48
48
|
helper.collective_list_item(first_group.box(:sent, first_user))
|
|
49
49
|
end
|
|
50
50
|
it { should have_tag 'li', text: /^Sent/ }
|
|
51
|
-
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
|
51
|
+
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'message-train-badge' } }
|
|
52
52
|
end
|
|
53
53
|
context 'when user is a valid recipient and box is in' do
|
|
54
54
|
subject do
|
|
55
55
|
helper.collective_list_item(membered_group.box(:in, first_user))
|
|
56
56
|
end
|
|
57
57
|
it { should have_tag 'li', text: /^Inbox/ }
|
|
58
|
-
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
|
58
|
+
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'message-train-badge' } }
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -63,20 +63,20 @@ describe MessageTrain::CollectivesHelper do
|
|
|
63
63
|
describe 'passed a regular user' do
|
|
64
64
|
subject { helper.collective_boxes_dropdown_list(first_user) }
|
|
65
65
|
# Groups and Roles
|
|
66
|
-
it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 }
|
|
66
|
+
it { should have_tag 'ul', with: { class: 'message-train-dropdown-menu' }, count: 1 }
|
|
67
67
|
it { should have_tag 'li', text: /^First Group/ }
|
|
68
68
|
it { should have_tag 'li', text: /^Membered Group/ }
|
|
69
69
|
end
|
|
70
70
|
describe 'passed an admin user' do
|
|
71
71
|
subject { helper.collective_boxes_dropdown_list(admin_user) }
|
|
72
72
|
# Groups and Roles
|
|
73
|
-
it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 }
|
|
73
|
+
it { should have_tag 'ul', with: { class: 'message-train-dropdown-menu' }, count: 1 }
|
|
74
74
|
it { should have_tag 'li', text: /^Admin/ }
|
|
75
75
|
end
|
|
76
76
|
describe 'passed a superadmin user' do
|
|
77
77
|
subject { helper.collective_boxes_dropdown_list(superadmin_user) }
|
|
78
78
|
# Groups and Roles
|
|
79
|
-
it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 }
|
|
79
|
+
it { should have_tag 'ul', with: { class: 'message-train-dropdown-menu' }, count: 1 }
|
|
80
80
|
it { should have_tag 'li', text: /^Admin/ }
|
|
81
81
|
end
|
|
82
82
|
end
|