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.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +20 -0
  3. data/.ruby-gemset +1 -1
  4. data/.scss-lint.yml +7 -0
  5. data/.simplecov +1 -1
  6. data/.travis.yml +1 -1
  7. data/Gemfile +6 -2
  8. data/LICENSE.txt +2 -2
  9. data/README.rdoc +5 -5
  10. data/Rakefile +22 -21
  11. data/VERSION +1 -1
  12. data/app/assets/javascripts/message_train.js +1 -1
  13. data/app/assets/stylesheets/message_train.scss +29 -19
  14. data/app/controllers/concerns/message_train_support.rb +41 -37
  15. data/app/controllers/message_train/application_controller.rb +1 -0
  16. data/app/controllers/message_train/boxes_controller.rb +5 -4
  17. data/app/controllers/message_train/conversations_controller.rb +8 -7
  18. data/app/controllers/message_train/messages_controller.rb +25 -22
  19. data/app/controllers/message_train/participants_controller.rb +27 -23
  20. data/app/controllers/message_train/unsubscribes_controller.rb +37 -23
  21. data/app/helpers/message_train/application_helper.rb +6 -8
  22. data/app/helpers/message_train/attachments_helper.rb +12 -4
  23. data/app/helpers/message_train/boxes_helper.rb +38 -11
  24. data/app/helpers/message_train/collectives_helper.rb +38 -12
  25. data/app/helpers/message_train/conversations_helper.rb +43 -35
  26. data/app/helpers/message_train/messages_helper.rb +32 -25
  27. data/app/mailers/message_train/application_mailer.rb +7 -4
  28. data/app/mailers/message_train/previews/receipt_mailer_preview.rb +2 -3
  29. data/app/mailers/message_train/receipt_mailer.rb +14 -4
  30. data/app/models/message_train/attachment.rb +41 -25
  31. data/app/models/message_train/box.rb +159 -122
  32. data/app/models/message_train/conversation.rb +84 -41
  33. data/app/models/message_train/ignore.rb +8 -2
  34. data/app/models/message_train/message.rb +72 -42
  35. data/app/models/message_train/receipt.rb +30 -17
  36. data/app/models/message_train/unsubscribe.rb +1 -0
  37. data/app/views/application/404.html.haml +1 -1
  38. data/app/views/layouts/mailer.html.haml +2 -2
  39. data/app/views/layouts/mailer.text.haml +1 -1
  40. data/app/views/message_train/application/_attachment_fields.html.haml +1 -1
  41. data/app/views/message_train/application/_widget.html.haml +1 -1
  42. data/app/views/message_train/application/results.json.jbuilder +1 -1
  43. data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -1
  44. data/app/views/message_train/boxes/_list_item.html.haml +1 -1
  45. data/app/views/message_train/boxes/show.html.haml +1 -1
  46. data/app/views/message_train/collectives/_dropdown_list.html.haml +1 -1
  47. data/app/views/message_train/collectives/_list_item.html.haml +1 -1
  48. data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
  49. data/app/views/message_train/conversations/_ignored_toggle.html.haml +2 -2
  50. data/app/views/message_train/conversations/_read_toggle.html.haml +1 -1
  51. data/app/views/message_train/conversations/_toggle.html.haml +1 -1
  52. data/app/views/message_train/conversations/_trashed_toggle.html.haml +1 -1
  53. data/app/views/message_train/conversations/show.html.haml +2 -2
  54. data/app/views/message_train/conversations/show.json.jbuilder +5 -1
  55. data/app/views/message_train/messages/_form.html.haml +1 -1
  56. data/app/views/message_train/messages/_message.html.haml +6 -6
  57. data/app/views/message_train/messages/_toggle.html.haml +1 -1
  58. data/app/views/message_train/messages/show.json.jbuilder +5 -1
  59. data/app/views/message_train/participants/_participant.json.jbuilder +1 -1
  60. data/app/views/message_train/participants/index.json.jbuilder +1 -1
  61. data/app/views/message_train/participants/show.json.jbuilder +1 -1
  62. data/app/views/message_train/receipt_mailer/notification_email.html.haml +1 -1
  63. data/app/views/message_train/receipt_mailer/notification_email.text.haml +1 -1
  64. data/app/views/message_train/unsubscribes/index.html.haml +1 -1
  65. data/config/environment.rb +1 -1
  66. data/config/initializers/date_time.rb +2 -2
  67. data/config/locales/en.yml +1 -1
  68. data/config/routes.rb +37 -15
  69. data/lib/generators/message_train/install/install_generator.rb +26 -11
  70. data/lib/generators/message_train/install/templates/initializer.rb +0 -2
  71. data/lib/generators/message_train/utils.rb +11 -4
  72. data/lib/message_train/configuration.rb +4 -5
  73. data/lib/message_train/engine.rb +1 -7
  74. data/lib/message_train/localization.rb +14 -18
  75. data/lib/message_train/mixin.rb +211 -150
  76. data/lib/message_train/version.rb +1 -0
  77. data/lib/message_train.rb +7 -6
  78. data/message_train.gemspec +24 -11
  79. data/spec/controllers/message_train/boxes_controller_spec.rb +63 -15
  80. data/spec/controllers/message_train/concerns_spec.rb +17 -13
  81. data/spec/controllers/message_train/conversations_controller_spec.rb +44 -12
  82. data/spec/controllers/message_train/messages_controller_spec.rb +87 -40
  83. data/spec/controllers/message_train/participants_controller_spec.rb +10 -4
  84. data/spec/controllers/message_train/unsubscribes_controller_spec.rb +43 -13
  85. data/spec/dummy/Rakefile +2 -1
  86. data/spec/dummy/app/assets/stylesheets/application.css.scss +7 -23
  87. data/spec/dummy/app/controllers/application_controller.rb +7 -7
  88. data/spec/dummy/app/models/group.rb +1 -1
  89. data/spec/dummy/app/models/role.rb +11 -7
  90. data/spec/dummy/app/models/user.rb +6 -5
  91. data/spec/dummy/app/views/layouts/_top_navigation.html.haml +1 -1
  92. data/spec/dummy/app/views/layouts/application.html.haml +1 -1
  93. data/spec/dummy/app/views/pages/index.html.haml +1 -1
  94. data/spec/dummy/config/application.rb +23 -17
  95. data/spec/dummy/config/environments/development.rb +5 -4
  96. data/spec/dummy/config/environments/production.rb +10 -6
  97. data/spec/dummy/config/environments/test.rb +4 -3
  98. data/spec/dummy/config/initializers/assets.rb +2 -1
  99. data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -2
  100. data/spec/dummy/config/initializers/bootstrap_leather.rb +1 -1
  101. data/spec/dummy/config/initializers/devise.rb +63 -44
  102. data/spec/dummy/config/initializers/high_voltage.rb +1 -1
  103. data/spec/dummy/config/initializers/message_train.rb +5 -2
  104. data/spec/dummy/config/initializers/mime_types.rb +1 -1
  105. data/spec/dummy/config/initializers/paperclip.rb +5 -2
  106. data/spec/dummy/config/initializers/rolify.rb +3 -2
  107. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -1
  108. data/spec/dummy/config/routes.rb +1 -3
  109. data/spec/dummy/config/settings.yml +1 -1
  110. data/spec/dummy/db/schema.rb +98 -98
  111. data/spec/dummy/db/seeds/conversations.seeds.rb +160 -160
  112. data/spec/dummy/db/seeds/development/conversations.seeds.rb +6 -2
  113. data/spec/dummy/db/seeds/groups.seeds.rb +11 -12
  114. data/spec/dummy/db/seeds/test/attachments.seeds.rb +13 -3
  115. data/spec/dummy/db/seeds/test/conversations.seeds.rb +6 -2
  116. data/spec/dummy/db/seeds/unsubscribes.seeds.rb +1 -1
  117. data/spec/dummy/db/seeds/users.seeds.rb +47 -42
  118. data/spec/dummy/db/test.sqlite3 +0 -0
  119. data/spec/factories/attachment.rb +6 -2
  120. data/spec/factories/group.rb +1 -4
  121. data/spec/factories/message.rb +29 -23
  122. data/spec/factories/user.rb +6 -4
  123. data/spec/features/boxes_spec.rb +76 -24
  124. data/spec/features/conversations_spec.rb +19 -7
  125. data/spec/features/messages_spec.rb +24 -5
  126. data/spec/features/unsubscribes_spec.rb +36 -9
  127. data/spec/helpers/message_train/application_helper_spec.rb +1 -1
  128. data/spec/helpers/message_train/attachment_helper_spec.rb +27 -12
  129. data/spec/helpers/message_train/boxes_helper_spec.rb +1 -1
  130. data/spec/helpers/message_train/collectives_helper_spec.rb +25 -9
  131. data/spec/helpers/message_train/conversations_helper_spec.rb +239 -120
  132. data/spec/helpers/message_train/messages_helper_spec.rb +137 -81
  133. data/spec/message_train_spec.rb +3 -2
  134. data/spec/models/group_spec.rb +12 -9
  135. data/spec/models/message_train/attachment_spec.rb +33 -30
  136. data/spec/models/message_train/box_spec.rb +243 -60
  137. data/spec/models/message_train/conversation_spec.rb +16 -12
  138. data/spec/models/message_train/ignore_spec.rb +3 -1
  139. data/spec/models/message_train/message_spec.rb +22 -7
  140. data/spec/models/message_train/receipt_spec.rb +14 -4
  141. data/spec/models/role_spec.rb +10 -6
  142. data/spec/models/user_spec.rb +74 -22
  143. data/spec/rails_helper.rb +9 -4
  144. data/spec/spec_helper.rb +6 -54
  145. data/spec/support/controller_behaviors.rb +8 -5
  146. data/spec/support/controller_macros.rb +2 -2
  147. data/spec/support/factory_girl.rb +1 -1
  148. data/spec/support/feature_behaviors.rb +42 -13
  149. data/spec/support/loaded_site/attachments.rb +8 -0
  150. data/spec/support/loaded_site/conversations.rb +73 -0
  151. data/spec/support/{groups.rb → loaded_site/groups.rb} +1 -1
  152. data/spec/support/{loaded_site.rb → loaded_site/loaded_site.rb} +1 -1
  153. data/spec/support/{messages.rb → loaded_site/messages.rb} +13 -5
  154. data/spec/support/{roles.rb → loaded_site/roles.rb} +1 -1
  155. data/spec/support/{users.rb → loaded_site/users.rb} +1 -1
  156. data/spec/support/shared_connection.rb +8 -6
  157. data/spec/support/utilities.rb +10 -10
  158. metadata +67 -10
  159. data/spec/dummy/config/unused/temporary_i18n_debugging.rb +0 -12
  160. data/spec/support/attachments.rb +0 -4
  161. 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 { should have_tag :img, with: { src: image_attachment.attachment.url(:thumb) } }
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 { should have_tag :a, with: {
21
- href: '#',
22
- class: 'thumbnail',
23
- 'data-toggle' => 'modal',
24
- 'data-target' => '#attachment_preview',
25
- 'data-src' => image_attachment.attachment.url(:large),
26
- 'data-original' => image_attachment.attachment.url(:original),
27
- 'data-text' => 'Click for Original'
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 { should have_tag :a, with: { href: pdf_attachment.attachment.url, class: 'thumbnail' } }
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
@@ -47,4 +47,4 @@ describe MessageTrain::BoxesHelper do
47
47
  subject { helper.box_participant_name(first_user) }
48
48
  it { should eq 'First User' }
49
49
  end
50
- 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 { helper.collective_nav_item(first_group.box(:in, third_user), third_user) }
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 { helper.collective_nav_item(first_group.box(:in, first_user), first_user) }
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 { helper.collective_nav_item(membered_group.box(:in, first_user), first_user) }
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 { helper.collective_list_item(first_group.box(:sent, first_user)) }
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 { helper.collective_list_item(membered_group.box(:in, first_user)) }
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
- it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 } # Groups and Roles
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
- it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 } # Groups and Roles
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
- it { should have_tag 'ul', with: { class: 'dropdown-menu' }, count: 1 } # Groups and Roles
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 { helper.conversation_class(first_user.box(:in), unread_conversation) }
28
- it { should match /unread/ }
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 { helper.conversation_class(first_user.box(:ignored), unread_conversation) }
32
- it { should match /hide/ }
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 { helper.conversation_class(first_user.box(:in), read_conversation) }
37
- it { should match /read/ }
38
- it { should_not match /unread/ }
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 { helper.conversation_class(first_user.box(:in), draft_conversation) }
42
- it { should match /draft/ }
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 { helper.conversation_class(first_user.box(:in), deleted_conversation) }
46
- it { should match /hide/ }
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 { helper.conversation_class(first_user.box(:in), trashed_conversation) }
51
- it { should match /hide/ }
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 { helper.conversation_class(first_user.box(:trash), trashed_conversation) }
55
- it { should_not match /hide/ }
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 { helper.conversation_class(first_user.box(:in), unread_conversation) }
61
- it { should_not match /hide/ }
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 { helper.conversation_class(first_user.box(:trash), unread_conversation) }
65
- it { should match /hide/ }
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 { helper.conversation_class(first_user.box(:ignored), ignored_conversation) }
71
- it { should_not match /hide/ }
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 { helper.conversation_class(first_user.box(:trash), ignored_conversation) }
75
- it { should match /hide/ }
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 { should have_tag(:a, with: {
88
- 'rel' => 'nofollow',
89
- 'title' => 'Mark as Trashed',
90
- 'data-confirm' => 'Are you sure?',
91
- 'data-method' => 'put',
92
- 'data-remote' => 'true'
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 { should have_tag(:a, with: {
102
- 'rel' => 'nofollow',
103
- 'title' => 'Mark as Untrashed',
104
- 'data-method' => 'put',
105
- 'data-remote' => 'true'
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 { helper.conversation_trashed_toggle(membered_group_conversation) }
116
- it { should have_tag(:a, with: {
117
- 'rel' => 'nofollow',
118
- 'title' => 'Mark as Trashed',
119
- 'data-confirm' => 'Are you sure?',
120
- 'data-method' => 'put',
121
- 'data-remote' => 'true'
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 { helper.conversation_trashed_toggle(membered_group_trashed_conversation) }
130
- it { should have_tag(:a, with: {
131
- 'rel' => 'nofollow',
132
- 'title' => 'Mark as Untrashed',
133
- 'data-method' => 'put',
134
- 'data-remote' => 'true'
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 { should have_tag(:a, with: {
149
- 'rel' => 'nofollow',
150
- 'title' => 'Mark as Read',
151
- 'data-method' => 'put',
152
- 'data-remote' => 'true'
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 { should have_tag(:a, with: {
162
- 'rel' => 'nofollow',
163
- 'title' => 'Mark as Unread',
164
- 'data-method' => 'put',
165
- 'data-remote' => 'true'
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 { should have_tag(:a, with: {
177
- 'rel' => 'nofollow',
178
- 'title' => 'Mark as Read',
179
- 'data-method' => 'put',
180
- 'data-remote' => 'true'
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 { helper.conversation_read_toggle(membered_group_read_conversation) }
189
- it { should have_tag(:a, with: {
190
- 'rel' => 'nofollow',
191
- 'title' => 'Mark as Unread',
192
- 'data-method' => 'put',
193
- 'data-remote' => 'true'
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 { should have_tag(:a, with: {
208
- 'rel' => 'nofollow',
209
- 'title' => 'Mark as Ignored',
210
- 'data-confirm' => 'Are you sure?',
211
- 'data-method' => 'delete',
212
- 'data-remote' => 'true'
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 { should have_tag(:a, with: {
222
- 'rel' => 'nofollow',
223
- 'title' => 'Mark as Unignored',
224
- 'data-method' => 'delete',
225
- 'data-remote' => 'true'
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 { helper.conversation_ignored_toggle(membered_group_conversation) }
236
- it { should have_tag(:a, with: {
237
- 'rel' => 'nofollow',
238
- 'title' => 'Mark as Ignored',
239
- 'data-confirm' => 'Are you sure?',
240
- 'data-method' => 'delete',
241
- 'data-remote' => 'true'
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 { helper.conversation_ignored_toggle(membered_group_ignored_conversation) }
250
- it { should have_tag(:a, with: {
251
- 'rel' => 'nofollow',
252
- 'title' => 'Mark as Unignored',
253
- 'data-method' => 'delete',
254
- 'data-remote' => 'true'
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 { should have_tag(:a, with: {
269
- 'rel' => 'nofollow',
270
- 'title' => 'Mark as Deleted',
271
- 'data-confirm' => 'Delete forever? This cannot be undone.',
272
- 'data-method' => 'put',
273
- 'data-remote' => 'true'
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 { helper.conversation_deleted_toggle(membered_group_conversation) }
284
- it { should have_tag(:a, with: {
285
- 'rel' => 'nofollow',
286
- 'title' => 'Mark as Deleted',
287
- 'data-confirm' => 'Delete forever? This cannot be undone.',
288
- 'data-method' => 'put',
289
- 'data-remote' => 'true'
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