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
@@ -6,7 +6,12 @@ describe MessageTrain::AttachmentsHelper do
|
|
6
6
|
describe '#attachment_icon' do
|
7
7
|
context 'when attachment is an image' do
|
8
8
|
subject { helper.attachment_icon(image_attachment) }
|
9
|
-
it
|
9
|
+
it do
|
10
|
+
should have_tag(
|
11
|
+
:img,
|
12
|
+
with: { src: image_attachment.attachment.url(:thumb) }
|
13
|
+
)
|
14
|
+
end
|
10
15
|
end
|
11
16
|
context 'when attachment is a file' do
|
12
17
|
subject { helper.attachment_icon(pdf_attachment) }
|
@@ -17,19 +22,29 @@ describe MessageTrain::AttachmentsHelper do
|
|
17
22
|
describe '#attachment_link' do
|
18
23
|
context 'when attachment is an image' do
|
19
24
|
subject { helper.attachment_link(image_attachment) }
|
20
|
-
it
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
it do
|
26
|
+
should have_tag(
|
27
|
+
:a,
|
28
|
+
with: {
|
29
|
+
href: '#',
|
30
|
+
class: 'thumbnail',
|
31
|
+
'data-toggle' => 'modal',
|
32
|
+
'data-target' => '#attachment_preview',
|
33
|
+
'data-src' => image_attachment.attachment.url(:large),
|
34
|
+
'data-original' => image_attachment.attachment.url(:original),
|
35
|
+
'data-text' => 'Click for Original'
|
36
|
+
}
|
37
|
+
)
|
38
|
+
end
|
29
39
|
end
|
30
40
|
context 'when attachment is a file' do
|
31
41
|
subject { helper.attachment_link(pdf_attachment) }
|
32
|
-
it
|
42
|
+
it do
|
43
|
+
should have_tag(
|
44
|
+
:a,
|
45
|
+
with: { href: pdf_attachment.attachment.url, class: 'thumbnail' }
|
46
|
+
)
|
47
|
+
end
|
33
48
|
end
|
34
49
|
end
|
35
|
-
end
|
50
|
+
end
|
@@ -17,16 +17,25 @@ describe MessageTrain::CollectivesHelper do
|
|
17
17
|
|
18
18
|
describe '#collective_nav_item' do
|
19
19
|
context 'when user is not allowed' do
|
20
|
-
subject
|
20
|
+
subject do
|
21
|
+
helper.collective_nav_item(first_group.box(:in, third_user), third_user)
|
22
|
+
end
|
21
23
|
it { should be nil }
|
22
24
|
end
|
23
25
|
context 'when no messages are unread' do
|
24
|
-
subject
|
26
|
+
subject do
|
27
|
+
helper.collective_nav_item(first_group.box(:in, first_user), first_user)
|
28
|
+
end
|
25
29
|
it { should have_tag 'li', text: /^First Group/ }
|
26
30
|
it { should_not have_tag 'span', with: { class: 'badge' } }
|
27
31
|
end
|
28
32
|
context 'when there are unread messages' do
|
29
|
-
subject
|
33
|
+
subject do
|
34
|
+
helper.collective_nav_item(
|
35
|
+
membered_group.box(:in, first_user),
|
36
|
+
first_user
|
37
|
+
)
|
38
|
+
end
|
30
39
|
it { should have_tag 'li', text: /^Membered Group/ }
|
31
40
|
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
32
41
|
end
|
@@ -34,12 +43,16 @@ describe MessageTrain::CollectivesHelper do
|
|
34
43
|
|
35
44
|
describe '#collective_list_item' do
|
36
45
|
context 'when user is a valid sender and box is sent' do
|
37
|
-
subject
|
46
|
+
subject do
|
47
|
+
helper.collective_list_item(first_group.box(:sent, first_user))
|
48
|
+
end
|
38
49
|
it { should have_tag 'li', text: /^Sent/ }
|
39
50
|
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
40
51
|
end
|
41
52
|
context 'when user is a valid recipient and box is in' do
|
42
|
-
subject
|
53
|
+
subject do
|
54
|
+
helper.collective_list_item(membered_group.box(:in, first_user))
|
55
|
+
end
|
43
56
|
it { should have_tag 'li', text: /^Inbox/ }
|
44
57
|
it { should have_tag 'span', text: /[0-9]+/, with: { class: 'badge' } }
|
45
58
|
end
|
@@ -48,18 +61,21 @@ describe MessageTrain::CollectivesHelper do
|
|
48
61
|
describe '#collective_boxes_dropdown_list' do
|
49
62
|
describe 'passed a regular user' do
|
50
63
|
subject { helper.collective_boxes_dropdown_list(first_user) }
|
51
|
-
|
64
|
+
# Groups and Roles
|
65
|
+
it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 }
|
52
66
|
it { should have_tag 'li', text: /^First Group/ }
|
53
67
|
it { should have_tag 'li', text: /^Membered Group/ }
|
54
68
|
end
|
55
69
|
describe 'passed an admin user' do
|
56
70
|
subject { helper.collective_boxes_dropdown_list(admin_user) }
|
57
|
-
|
71
|
+
# Groups and Roles
|
72
|
+
it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 }
|
58
73
|
it { should have_tag 'li', text: /^Admin/ }
|
59
74
|
end
|
60
75
|
describe 'passed a superadmin user' do
|
61
76
|
subject { helper.collective_boxes_dropdown_list(superadmin_user) }
|
62
|
-
|
77
|
+
# Groups and Roles
|
78
|
+
it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 }
|
63
79
|
it { should have_tag 'li', text: /^Admin/ }
|
64
80
|
end
|
65
81
|
end
|
@@ -73,4 +89,4 @@ describe MessageTrain::CollectivesHelper do
|
|
73
89
|
subject { helper.collective_name(first_group) }
|
74
90
|
it { should eq 'First Group' }
|
75
91
|
end
|
76
|
-
end
|
92
|
+
end
|
@@ -24,55 +24,88 @@ describe MessageTrain::ConversationsHelper do
|
|
24
24
|
describe '#conversation_class' do
|
25
25
|
context 'when it is unread' do
|
26
26
|
context 'in the inbox' do
|
27
|
-
subject
|
28
|
-
|
27
|
+
subject do
|
28
|
+
helper.conversation_class(first_user.box(:in), unread_conversation)
|
29
|
+
end
|
30
|
+
it { should match(/unread/) }
|
29
31
|
end
|
30
32
|
context 'in the ignored box' do
|
31
|
-
subject
|
32
|
-
|
33
|
+
subject do
|
34
|
+
helper.conversation_class(
|
35
|
+
first_user.box(:ignored),
|
36
|
+
unread_conversation
|
37
|
+
)
|
38
|
+
end
|
39
|
+
it { should match(/hide/) }
|
33
40
|
end
|
34
41
|
end
|
35
42
|
context 'when it is read' do
|
36
|
-
subject
|
37
|
-
|
38
|
-
|
43
|
+
subject do
|
44
|
+
helper.conversation_class(first_user.box(:in), read_conversation)
|
45
|
+
end
|
46
|
+
it { should match(/read/) }
|
47
|
+
it { should_not match(/unread/) }
|
39
48
|
end
|
40
49
|
context 'when it is a draft' do
|
41
|
-
subject
|
42
|
-
|
50
|
+
subject do
|
51
|
+
helper.conversation_class(first_user.box(:in), draft_conversation)
|
52
|
+
end
|
53
|
+
it { should match(/draft/) }
|
43
54
|
end
|
44
55
|
context 'when it is deleted' do
|
45
|
-
subject
|
46
|
-
|
56
|
+
subject do
|
57
|
+
helper.conversation_class(first_user.box(:in), deleted_conversation)
|
58
|
+
end
|
59
|
+
it { should match(/hide/) }
|
47
60
|
end
|
48
61
|
context 'when it is trashed' do
|
49
62
|
context 'in the inbox' do
|
50
|
-
subject
|
51
|
-
|
63
|
+
subject do
|
64
|
+
helper.conversation_class(first_user.box(:in), trashed_conversation)
|
65
|
+
end
|
66
|
+
it { should match(/hide/) }
|
52
67
|
end
|
53
68
|
context 'in the trash box' do
|
54
|
-
subject
|
55
|
-
|
69
|
+
subject do
|
70
|
+
helper.conversation_class(
|
71
|
+
first_user.box(:trash),
|
72
|
+
trashed_conversation
|
73
|
+
)
|
74
|
+
end
|
75
|
+
it { should_not match(/hide/) }
|
56
76
|
end
|
57
77
|
end
|
58
78
|
context 'when it is not trashed' do
|
59
79
|
context 'in the inbox' do
|
60
|
-
subject
|
61
|
-
|
80
|
+
subject do
|
81
|
+
helper.conversation_class(first_user.box(:in), unread_conversation)
|
82
|
+
end
|
83
|
+
it { should_not match(/hide/) }
|
62
84
|
end
|
63
85
|
context 'in the trash box' do
|
64
|
-
subject
|
65
|
-
|
86
|
+
subject do
|
87
|
+
helper.conversation_class(first_user.box(:trash), unread_conversation)
|
88
|
+
end
|
89
|
+
it { should match(/hide/) }
|
66
90
|
end
|
67
91
|
end
|
68
92
|
context 'when it is ignored' do
|
69
93
|
context 'in the ignored box' do
|
70
|
-
subject
|
71
|
-
|
94
|
+
subject do
|
95
|
+
helper.conversation_class(
|
96
|
+
first_user.box(:ignored), ignored_conversation
|
97
|
+
)
|
98
|
+
end
|
99
|
+
it { should_not match(/hide/) }
|
72
100
|
end
|
73
101
|
context 'in the trash box' do
|
74
|
-
subject
|
75
|
-
|
102
|
+
subject do
|
103
|
+
helper.conversation_class(
|
104
|
+
first_user.box(:trash),
|
105
|
+
ignored_conversation
|
106
|
+
)
|
107
|
+
end
|
108
|
+
it { should match(/hide/) }
|
76
109
|
end
|
77
110
|
end
|
78
111
|
end
|
@@ -84,13 +117,18 @@ describe MessageTrain::ConversationsHelper do
|
|
84
117
|
assign(:box, first_user.box(:in))
|
85
118
|
end
|
86
119
|
subject { helper.conversation_trashed_toggle(unread_conversation) }
|
87
|
-
it
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
120
|
+
it do
|
121
|
+
should have_tag(
|
122
|
+
:a,
|
123
|
+
with: {
|
124
|
+
'rel' => 'nofollow',
|
125
|
+
'title' => 'Mark as Trashed',
|
126
|
+
'data-confirm' => 'Are you sure?',
|
127
|
+
'data-method' => 'put',
|
128
|
+
'data-remote' => 'true'
|
129
|
+
}
|
130
|
+
)
|
131
|
+
end
|
94
132
|
it { should have_tag(:span, with: { class: 'glyphicon-trash' }) }
|
95
133
|
end
|
96
134
|
context 'when the conversation is all trashed' do
|
@@ -98,12 +136,17 @@ describe MessageTrain::ConversationsHelper do
|
|
98
136
|
assign(:box, first_user.box(:trash))
|
99
137
|
end
|
100
138
|
subject { helper.conversation_trashed_toggle(trashed_conversation) }
|
101
|
-
it
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
139
|
+
it do
|
140
|
+
should have_tag(
|
141
|
+
:a,
|
142
|
+
with: {
|
143
|
+
'rel' => 'nofollow',
|
144
|
+
'title' => 'Mark as Untrashed',
|
145
|
+
'data-method' => 'put',
|
146
|
+
'data-remote' => 'true'
|
147
|
+
}
|
148
|
+
)
|
149
|
+
end
|
107
150
|
it { should have_tag(:span, with: { class: 'glyphicon-inbox' }) }
|
108
151
|
end
|
109
152
|
end
|
@@ -112,27 +155,43 @@ describe MessageTrain::ConversationsHelper do
|
|
112
155
|
before do
|
113
156
|
assign(:box, membered_group.box(:in, first_user))
|
114
157
|
end
|
115
|
-
subject
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
158
|
+
subject do
|
159
|
+
helper.conversation_trashed_toggle(membered_group_conversation)
|
160
|
+
end
|
161
|
+
it do
|
162
|
+
should have_tag(
|
163
|
+
:a,
|
164
|
+
with: {
|
165
|
+
'rel' => 'nofollow',
|
166
|
+
'title' => 'Mark as Trashed',
|
167
|
+
'data-confirm' => 'Are you sure?',
|
168
|
+
'data-method' => 'put',
|
169
|
+
'data-remote' => 'true'
|
170
|
+
}
|
171
|
+
)
|
172
|
+
end
|
123
173
|
it { should have_tag(:span, with: { class: 'glyphicon-trash' }) }
|
124
174
|
end
|
125
175
|
context 'when the conversation is all trashed' do
|
126
176
|
before do
|
127
177
|
assign(:box, membered_group.box(:trash, first_user))
|
128
178
|
end
|
129
|
-
subject
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
179
|
+
subject do
|
180
|
+
helper.conversation_trashed_toggle(
|
181
|
+
membered_group_trashed_conversation
|
182
|
+
)
|
183
|
+
end
|
184
|
+
it do
|
185
|
+
should have_tag(
|
186
|
+
:a,
|
187
|
+
with: {
|
188
|
+
'rel' => 'nofollow',
|
189
|
+
'title' => 'Mark as Untrashed',
|
190
|
+
'data-method' => 'put',
|
191
|
+
'data-remote' => 'true'
|
192
|
+
}
|
193
|
+
)
|
194
|
+
end
|
136
195
|
it { should have_tag(:span, with: { class: 'glyphicon-inbox' }) }
|
137
196
|
end
|
138
197
|
end
|
@@ -145,12 +204,17 @@ describe MessageTrain::ConversationsHelper do
|
|
145
204
|
assign(:box, first_user.box(:in))
|
146
205
|
end
|
147
206
|
subject { helper.conversation_read_toggle(unread_conversation) }
|
148
|
-
it
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
207
|
+
it do
|
208
|
+
should have_tag(
|
209
|
+
:a,
|
210
|
+
with: {
|
211
|
+
'rel' => 'nofollow',
|
212
|
+
'title' => 'Mark as Read',
|
213
|
+
'data-method' => 'put',
|
214
|
+
'data-remote' => 'true'
|
215
|
+
}
|
216
|
+
)
|
217
|
+
end
|
154
218
|
it { should have_tag(:span, with: { class: 'glyphicon-eye-open' }) }
|
155
219
|
end
|
156
220
|
context 'when the conversation is all read' do
|
@@ -158,12 +222,17 @@ describe MessageTrain::ConversationsHelper do
|
|
158
222
|
assign(:box, first_user.box(:trash))
|
159
223
|
end
|
160
224
|
subject { helper.conversation_read_toggle(read_conversation) }
|
161
|
-
it
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
225
|
+
it do
|
226
|
+
should have_tag(
|
227
|
+
:a,
|
228
|
+
with: {
|
229
|
+
'rel' => 'nofollow',
|
230
|
+
'title' => 'Mark as Unread',
|
231
|
+
'data-method' => 'put',
|
232
|
+
'data-remote' => 'true'
|
233
|
+
}
|
234
|
+
)
|
235
|
+
end
|
167
236
|
it { should have_tag(:span, with: { class: 'glyphicon-eye-close' }) }
|
168
237
|
end
|
169
238
|
end
|
@@ -173,25 +242,37 @@ describe MessageTrain::ConversationsHelper do
|
|
173
242
|
assign(:box, membered_group.box(:in, first_user))
|
174
243
|
end
|
175
244
|
subject { helper.conversation_read_toggle(membered_group_conversation) }
|
176
|
-
it
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
245
|
+
it do
|
246
|
+
should have_tag(
|
247
|
+
:a,
|
248
|
+
with: {
|
249
|
+
'rel' => 'nofollow',
|
250
|
+
'title' => 'Mark as Read',
|
251
|
+
'data-method' => 'put',
|
252
|
+
'data-remote' => 'true'
|
253
|
+
}
|
254
|
+
)
|
255
|
+
end
|
182
256
|
it { should have_tag(:span, with: { class: 'glyphicon-eye-open' }) }
|
183
257
|
end
|
184
258
|
context 'when the conversation is all read' do
|
185
259
|
before do
|
186
260
|
assign(:box, membered_group.box(:trash, first_user))
|
187
261
|
end
|
188
|
-
subject
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
262
|
+
subject do
|
263
|
+
helper.conversation_read_toggle(membered_group_read_conversation)
|
264
|
+
end
|
265
|
+
it do
|
266
|
+
should have_tag(
|
267
|
+
:a,
|
268
|
+
with: {
|
269
|
+
'rel' => 'nofollow',
|
270
|
+
'title' => 'Mark as Unread',
|
271
|
+
'data-method' => 'put',
|
272
|
+
'data-remote' => 'true'
|
273
|
+
}
|
274
|
+
)
|
275
|
+
end
|
195
276
|
it { should have_tag(:span, with: { class: 'glyphicon-eye-close' }) }
|
196
277
|
end
|
197
278
|
end
|
@@ -204,13 +285,18 @@ describe MessageTrain::ConversationsHelper do
|
|
204
285
|
assign(:box, first_user.box(:in))
|
205
286
|
end
|
206
287
|
subject { helper.conversation_ignored_toggle(unread_conversation) }
|
207
|
-
it
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
288
|
+
it do
|
289
|
+
should have_tag(
|
290
|
+
:a,
|
291
|
+
with: {
|
292
|
+
'rel' => 'nofollow',
|
293
|
+
'title' => 'Mark as Ignored',
|
294
|
+
'data-confirm' => 'Are you sure?',
|
295
|
+
'data-method' => 'delete',
|
296
|
+
'data-remote' => 'true'
|
297
|
+
}
|
298
|
+
)
|
299
|
+
end
|
214
300
|
it { should have_tag(:span, with: { class: 'glyphicon-volume-off' }) }
|
215
301
|
end
|
216
302
|
context 'when the conversation is all ignored' do
|
@@ -218,12 +304,17 @@ describe MessageTrain::ConversationsHelper do
|
|
218
304
|
assign(:box, first_user.box(:trash))
|
219
305
|
end
|
220
306
|
subject { helper.conversation_ignored_toggle(ignored_conversation) }
|
221
|
-
it
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
307
|
+
it do
|
308
|
+
should have_tag(
|
309
|
+
:a,
|
310
|
+
with: {
|
311
|
+
'rel' => 'nofollow',
|
312
|
+
'title' => 'Mark as Unignored',
|
313
|
+
'data-method' => 'delete',
|
314
|
+
'data-remote' => 'true'
|
315
|
+
}
|
316
|
+
)
|
317
|
+
end
|
227
318
|
it { should have_tag(:span, with: { class: 'glyphicon-volume-up' }) }
|
228
319
|
end
|
229
320
|
end
|
@@ -232,27 +323,43 @@ describe MessageTrain::ConversationsHelper do
|
|
232
323
|
before do
|
233
324
|
assign(:box, membered_group.box(:in, first_user))
|
234
325
|
end
|
235
|
-
subject
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
326
|
+
subject do
|
327
|
+
helper.conversation_ignored_toggle(membered_group_conversation)
|
328
|
+
end
|
329
|
+
it do
|
330
|
+
should have_tag(
|
331
|
+
:a,
|
332
|
+
with: {
|
333
|
+
'rel' => 'nofollow',
|
334
|
+
'title' => 'Mark as Ignored',
|
335
|
+
'data-confirm' => 'Are you sure?',
|
336
|
+
'data-method' => 'delete',
|
337
|
+
'data-remote' => 'true'
|
338
|
+
}
|
339
|
+
)
|
340
|
+
end
|
243
341
|
it { should have_tag(:span, with: { class: 'glyphicon-volume-off' }) }
|
244
342
|
end
|
245
343
|
context 'when the conversation is all ignored' do
|
246
344
|
before do
|
247
345
|
assign(:box, membered_group.box(:trash, first_user))
|
248
346
|
end
|
249
|
-
subject
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
347
|
+
subject do
|
348
|
+
helper.conversation_ignored_toggle(
|
349
|
+
membered_group_ignored_conversation
|
350
|
+
)
|
351
|
+
end
|
352
|
+
it do
|
353
|
+
should have_tag(
|
354
|
+
:a,
|
355
|
+
with: {
|
356
|
+
'rel' => 'nofollow',
|
357
|
+
'title' => 'Mark as Unignored',
|
358
|
+
'data-method' => 'delete',
|
359
|
+
'data-remote' => 'true'
|
360
|
+
}
|
361
|
+
)
|
362
|
+
end
|
256
363
|
it { should have_tag(:span, with: { class: 'glyphicon-volume-up' }) }
|
257
364
|
end
|
258
365
|
end
|
@@ -265,13 +372,18 @@ describe MessageTrain::ConversationsHelper do
|
|
265
372
|
assign(:box, first_user.box(:trash))
|
266
373
|
end
|
267
374
|
subject { helper.conversation_deleted_toggle(unread_conversation) }
|
268
|
-
it
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
375
|
+
it do
|
376
|
+
should have_tag(
|
377
|
+
:a,
|
378
|
+
with: {
|
379
|
+
'rel' => 'nofollow',
|
380
|
+
'title' => 'Mark as Deleted',
|
381
|
+
'data-confirm' => 'Delete forever? This cannot be undone.',
|
382
|
+
'data-method' => 'put',
|
383
|
+
'data-remote' => 'true'
|
384
|
+
}
|
385
|
+
)
|
386
|
+
end
|
275
387
|
it { should have_tag(:span, with: { class: 'glyphicon-remove' }) }
|
276
388
|
end
|
277
389
|
end
|
@@ -280,16 +392,23 @@ describe MessageTrain::ConversationsHelper do
|
|
280
392
|
before do
|
281
393
|
assign(:box, membered_group.box(:trash, first_user))
|
282
394
|
end
|
283
|
-
subject
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
395
|
+
subject do
|
396
|
+
helper.conversation_deleted_toggle(membered_group_conversation)
|
397
|
+
end
|
398
|
+
it do
|
399
|
+
should have_tag(
|
400
|
+
:a,
|
401
|
+
with: {
|
402
|
+
'rel' => 'nofollow',
|
403
|
+
'title' => 'Mark as Deleted',
|
404
|
+
'data-confirm' => 'Delete forever? This cannot be undone.',
|
405
|
+
'data-method' => 'put',
|
406
|
+
'data-remote' => 'true'
|
407
|
+
}
|
408
|
+
)
|
409
|
+
end
|
291
410
|
it { should have_tag(:span, with: { class: 'glyphicon-remove' }) }
|
292
411
|
end
|
293
412
|
end
|
294
413
|
end
|
295
|
-
end
|
414
|
+
end
|