message_train 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/routes.rb +14 -3
- data/message_train.gemspec +2 -2
- data/spec/controllers/message_train/concerns_spec.rb +7 -6
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/features/boxes_spec.rb +3 -0
- data/spec/features/conversations_spec.rb +31 -27
- data/spec/features/messages_spec.rb +56 -52
- data/spec/features/unsubscribes_spec.rb +30 -26
- data/spec/support/feature_behaviors.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 712bc245d27104152fc3be51a4d599273f839b44
|
4
|
+
data.tar.gz: 6decf2e25a128e08535900656121aece93e6f02f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9853cb01edcc15fe18103c15a66f4f008868a7e9143b395c6d41b1967b35950da5370a2b47783bee75e76b4ea3e3af41a84bb973f22212dd61e7928ed3ccfb5a
|
7
|
+
data.tar.gz: c140454a9b30a82c4c37cf2a235b5110dac49aafe55f03e8a9159f243225b9a9311f99e9956683cb1001e5229c436734fecd815f641aa55aa63a2ba5a2355260
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/config/routes.rb
CHANGED
@@ -14,7 +14,18 @@ MessageTrain::Engine.routes.draw do
|
|
14
14
|
resources :unsubscribes, only: [:index, :create, :destroy]
|
15
15
|
end
|
16
16
|
|
17
|
-
match '/box(/*path)'
|
18
|
-
|
19
|
-
|
17
|
+
match '/box(/*path)' => redirect { |p, req|
|
18
|
+
req.flash[:error] = :you_must_sign_in_or_sign_up_to_continue.l
|
19
|
+
MessageTrain.configuration.user_sign_in_path
|
20
|
+
}, via: [:get, :put, :post, :delete]
|
21
|
+
|
22
|
+
match '/collectives(/*path)' => redirect { |p, req|
|
23
|
+
req.flash[:error] = :you_must_sign_in_or_sign_up_to_continue.l
|
24
|
+
MessageTrain.configuration.user_sign_in_path
|
25
|
+
}, via: [:get, :put, :post, :delete]
|
26
|
+
|
27
|
+
match '/unsubscribes(/*path)' => redirect { |p, req|
|
28
|
+
req.flash[:error] = :you_must_sign_in_or_sign_up_to_continue.l
|
29
|
+
MessageTrain.configuration.user_sign_in_path
|
30
|
+
}, via: [:get, :put, :post, :delete]
|
20
31
|
end
|
data/message_train.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: message_train 0.3.
|
5
|
+
# stub: message_train 0.3.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "message_train"
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -6,12 +6,13 @@ describe MessageTrain::BoxesController do
|
|
6
6
|
routes { MessageTrain::Engine.routes }
|
7
7
|
|
8
8
|
describe "GET #show" do
|
9
|
-
describe 'when not logged in' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
# describe 'when not logged in' do
|
10
|
+
# before do
|
11
|
+
# access_anonymous
|
12
|
+
# get :show, division: 'in'
|
13
|
+
# end
|
14
|
+
# it_should_behave_like 'a redirect with error', '/users/sign_in', 'You must sign in or sign up to continue.'
|
15
|
+
# end
|
15
16
|
|
16
17
|
describe 'when neither sending nor receiving is allowed' do
|
17
18
|
before do
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/features/boxes_spec.rb
CHANGED
@@ -2,6 +2,9 @@ require 'rails_helper'
|
|
2
2
|
RSpec.feature 'Boxes' do
|
3
3
|
include_context 'loaded site'
|
4
4
|
|
5
|
+
it_behaves_like 'an authenticated section', '/box'
|
6
|
+
it_behaves_like 'an authenticated section', '/collectives/groups:membered-group'
|
7
|
+
|
5
8
|
describe 'When logged in as first-user' do
|
6
9
|
before do
|
7
10
|
login_as first_user
|
@@ -2,41 +2,45 @@ require 'rails_helper'
|
|
2
2
|
RSpec.feature 'Conversations' do
|
3
3
|
include_context 'loaded site'
|
4
4
|
|
5
|
-
|
6
|
-
login_as first_user
|
7
|
-
end
|
8
|
-
describe 'Showing' do
|
9
|
-
describe 'at /box/in/conversations/:id' do
|
10
|
-
before do
|
11
|
-
visit '/box/in/conversations/' + unread_conversation.id.to_s
|
12
|
-
end
|
13
|
-
it_behaves_like 'a bootstrap page showing an item', MessageTrain::Conversation, 'Unread Conversation'
|
5
|
+
it_behaves_like 'an authenticated section', '/box/in/conversations/1'
|
14
6
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
it_behaves_like 'a bootstrap page', title: 'Reply'
|
20
|
-
end
|
7
|
+
describe 'When logged in' do
|
8
|
+
before do
|
9
|
+
login_as first_user
|
21
10
|
end
|
22
|
-
|
23
|
-
|
24
|
-
describe 'at /box/in/conversations/:id' do
|
25
|
-
describe 'Marking Read' do
|
11
|
+
describe 'Showing' do
|
12
|
+
describe 'at /box/in/conversations/:id' do
|
26
13
|
before do
|
27
14
|
visit '/box/in/conversations/' + unread_conversation.id.to_s
|
28
|
-
click_link "mark_read_#{unread_message.id.to_s}"
|
29
15
|
end
|
30
|
-
it_behaves_like 'a bootstrap page
|
16
|
+
it_behaves_like 'a bootstrap page showing an item', MessageTrain::Conversation, 'Unread Conversation'
|
17
|
+
|
18
|
+
describe 'shows a reply link' do
|
19
|
+
before do
|
20
|
+
click_link 'Reply'
|
21
|
+
end
|
22
|
+
it_behaves_like 'a bootstrap page', title: 'Reply'
|
23
|
+
end
|
31
24
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
25
|
+
end
|
26
|
+
describe 'Marking', js: true do
|
27
|
+
describe 'at /box/in/conversations/:id' do
|
28
|
+
describe 'Marking Read' do
|
29
|
+
before do
|
30
|
+
visit '/box/in/conversations/' + unread_conversation.id.to_s
|
31
|
+
click_link "mark_read_#{unread_message.id.to_s}"
|
32
|
+
end
|
33
|
+
it_behaves_like 'a bootstrap page with an alert', 'info', 'Update successful'
|
34
|
+
end
|
35
|
+
describe 'Marking Ignored' do
|
36
|
+
before do
|
37
|
+
visit '/box/in/conversations/' + unread_conversation.id.to_s
|
38
|
+
accept_confirm do
|
39
|
+
click_link 'Mark as Ignored'
|
40
|
+
end
|
37
41
|
end
|
42
|
+
it_behaves_like 'a bootstrap page with an alert', 'info', 'Update successful'
|
38
43
|
end
|
39
|
-
it_behaves_like 'a bootstrap page with an alert', 'info', 'Update successful'
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
@@ -3,65 +3,69 @@ RSpec.feature 'Messages' do
|
|
3
3
|
include_context 'loaded site'
|
4
4
|
include Wysihtml5Helper
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
before do
|
12
|
-
visit '/box/in/messages/new/'
|
13
|
-
recipient_input = find(:css, "#message_recipients_to_save_users .tags-input")
|
14
|
-
recipient_input.set("")
|
15
|
-
fill_in 'Subject', with: 'This is a draft.'
|
16
|
-
fill_in_html 'Body', with: 'This is the body.'
|
17
|
-
click_button 'Send'
|
18
|
-
end
|
19
|
-
it_behaves_like 'a bootstrap page with an alert', 'warning', 'Message saved as draft.'
|
6
|
+
it_behaves_like 'an authenticated section', '/box/in/messages/new'
|
7
|
+
|
8
|
+
describe 'When logged in' do
|
9
|
+
before do
|
10
|
+
login_as first_user
|
20
11
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
fill_in 'Subject', with: 'This is the subject.'
|
31
|
-
fill_in_html 'Body', with: 'This is the body.'
|
32
|
-
click_link 'add-attachment'
|
33
|
-
click_link 'add-attachment'
|
34
|
-
click_link 'add-attachment'
|
35
|
-
within '#attachments .nested-fields:nth-child(1)' do
|
36
|
-
attach_file 'Attachment', File.absolute_path('./spec/dummy/app/assets/files/message_train/attachments/example.pdf')
|
37
|
-
end
|
38
|
-
within '#attachments .nested-fields:nth-child(2)' do
|
39
|
-
attach_file 'Attachment', File.absolute_path('./spec/dummy/app/assets/files/message_train/attachments/Bambisj.jpg')
|
12
|
+
describe 'Drafting', js: true do
|
13
|
+
describe 'at /box/in/messages' do
|
14
|
+
before do
|
15
|
+
visit '/box/in/messages/new/'
|
16
|
+
recipient_input = find(:css, "#message_recipients_to_save_users .tags-input")
|
17
|
+
recipient_input.set("")
|
18
|
+
fill_in 'Subject', with: 'This is a draft.'
|
19
|
+
fill_in_html 'Body', with: 'This is the body.'
|
20
|
+
click_button 'Send'
|
40
21
|
end
|
41
|
-
|
42
|
-
|
43
|
-
|
22
|
+
it_behaves_like 'a bootstrap page with an alert', 'warning', 'Message saved as draft.'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
describe 'Composing', js: true do
|
26
|
+
describe 'at /box/in/messages' do
|
27
|
+
before do
|
28
|
+
visit '/box/in/messages/new/'
|
29
|
+
recipient_input = find(:css, "#message_recipients_to_save_users .tags-input")
|
30
|
+
recipient_input.set("sec") # Should auto-complete to second-user with the following two key-presses
|
31
|
+
recipient_input.native.send_keys :arrow_down
|
32
|
+
recipient_input.native.send_keys :return
|
33
|
+
fill_in 'Subject', with: 'This is the subject.'
|
34
|
+
fill_in_html 'Body', with: 'This is the body.'
|
35
|
+
click_link 'add-attachment'
|
36
|
+
click_link 'add-attachment'
|
37
|
+
click_link 'add-attachment'
|
38
|
+
within '#attachments .nested-fields:nth-child(1)' do
|
39
|
+
attach_file 'Attachment', File.absolute_path('./spec/dummy/app/assets/files/message_train/attachments/example.pdf')
|
40
|
+
end
|
41
|
+
within '#attachments .nested-fields:nth-child(2)' do
|
42
|
+
attach_file 'Attachment', File.absolute_path('./spec/dummy/app/assets/files/message_train/attachments/Bambisj.jpg')
|
43
|
+
end
|
44
|
+
within '#attachments .nested-fields:nth-child(3)' do
|
45
|
+
accept_confirm do
|
46
|
+
find('.remove_fields').click
|
47
|
+
end
|
44
48
|
end
|
49
|
+
click_button 'Send'
|
45
50
|
end
|
46
|
-
|
51
|
+
it_behaves_like 'a bootstrap page with an alert', 'info', 'Message sent.'
|
47
52
|
end
|
48
|
-
it_behaves_like 'a bootstrap page with an alert', 'info', 'Message sent.'
|
49
53
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
describe 'Editing a Draft', js: true do
|
55
|
+
describe 'at /box/in/messages' do
|
56
|
+
before do
|
57
|
+
visit "/box/in/conversations/#{draft_conversation.id}"
|
58
|
+
recipient_input = find(:css, "#message_recipients_to_save_users .tags-input")
|
59
|
+
recipient_input.set("sec") # Should auto-complete to second-user with the following two key-presses
|
60
|
+
recipient_input.native.send_keys :arrow_down
|
61
|
+
recipient_input.native.send_keys :return
|
62
|
+
fill_in 'Subject', with: 'This is the subject.'
|
63
|
+
fill_in_html 'Body', with: 'This is the body.'
|
64
|
+
click_button 'Send'
|
65
|
+
end
|
66
|
+
it_behaves_like 'a bootstrap page with an alert', 'info', 'Message sent.'
|
67
|
+
it_behaves_like 'a bootstrap page without an alert', 'warning'
|
62
68
|
end
|
63
|
-
it_behaves_like 'a bootstrap page with an alert', 'info', 'Message sent.'
|
64
|
-
it_behaves_like 'a bootstrap page without an alert', 'warning'
|
65
69
|
end
|
66
70
|
end
|
67
71
|
end
|
@@ -2,37 +2,41 @@ require 'rails_helper'
|
|
2
2
|
RSpec.feature 'Unsubscribes' do
|
3
3
|
include_context 'loaded site'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
it_behaves_like 'an authenticated section', '/unsubscribes'
|
6
|
+
|
7
|
+
describe 'When logged in' do
|
8
|
+
before do
|
9
|
+
login_as first_user
|
10
|
+
end
|
11
|
+
describe 'Index' do
|
12
|
+
describe 'at /unsubscribes' do
|
13
|
+
before do
|
14
|
+
visit '/unsubscribes'
|
15
|
+
end
|
16
|
+
it_behaves_like 'a bootstrap page', title: 'Manage Your Email Notifications'
|
17
|
+
context "displays a list of #subscriptions in .subscription" do
|
18
|
+
subject { page }
|
19
|
+
it { should have_css("#subscriptions .subscription", minimum: 3) }
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
describe 'Unsubscribing' do
|
24
|
+
describe 'at /unsubscribes' do
|
25
|
+
before do
|
26
|
+
visit '/unsubscribes'
|
27
|
+
find("#unsubscribe-group-#{membered_group.id.to_s}").click
|
28
|
+
end
|
29
|
+
it_behaves_like 'a bootstrap page with an alert', 'info', 'You are now unsubscribed from Membered Group, which means that you will not be notified by email of any messages received by that Group.'
|
25
30
|
end
|
26
|
-
it_behaves_like 'a bootstrap page with an alert', 'info', 'You are now unsubscribed from Membered Group, which means that you will not be notified by email of any messages received by that Group.'
|
27
31
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
describe 'Removing an Unsubscribe' do
|
33
|
+
describe 'at /unsubscribes' do
|
34
|
+
before do
|
35
|
+
visit '/unsubscribes'
|
36
|
+
find("#remove-unsubscribe-#{unsubscribed_group.id.to_s}").click
|
37
|
+
end
|
38
|
+
it_behaves_like 'a bootstrap page with an alert', 'info', 'You are no longer unsubscribed from Unsubscribed Group, which means that you will now be notified by email of any messages received in that Group.'
|
34
39
|
end
|
35
|
-
it_behaves_like 'a bootstrap page with an alert', 'info', 'You are no longer unsubscribed from Unsubscribed Group, which means that you will now be notified by email of any messages received in that Group.'
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
@@ -1,3 +1,17 @@
|
|
1
|
+
shared_examples_for 'an authenticated section' do |path|
|
2
|
+
describe 'requires login' do
|
3
|
+
before do
|
4
|
+
visit path
|
5
|
+
end
|
6
|
+
it_behaves_like 'a bootstrap page with an alert', 'danger', 'You must sign in or sign up to continue.'
|
7
|
+
context 'displays a login form' do
|
8
|
+
subject { page }
|
9
|
+
it { should have_selector 'form.new_user input#user_email' }
|
10
|
+
it { should have_selector 'form.new_user input#user_password' }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
1
15
|
shared_examples_for 'a bootstrap page' do |options = {}|
|
2
16
|
include ERB::Util
|
3
17
|
context 'displays a page with bootstrap elements' do
|