social_stream 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +5 -1
- data/README.rdoc +2 -2
- data/app/controllers/api_controller.rb +2 -1
- data/app/controllers/contacts_controller.rb +25 -2
- data/app/controllers/groups_controller.rb +12 -2
- data/app/controllers/notifications_controller.rb +72 -0
- data/app/controllers/permissions_controller.rb +10 -0
- data/app/controllers/relation/customs_controller.rb +8 -0
- data/app/controllers/spheres_controller.rb +12 -0
- data/app/helpers/contacts_helper.rb +24 -0
- data/app/helpers/location_helper.rb +26 -12
- data/app/helpers/notifications_helper.rb +23 -0
- data/app/helpers/permissions_helper.rb +16 -0
- data/app/helpers/profiles_helper.rb +31 -0
- data/app/helpers/subjects_helper.rb +0 -83
- data/app/helpers/toolbar_helper.rb +83 -0
- data/app/models/activity.rb +43 -36
- data/app/models/actor.rb +71 -14
- data/app/models/contact.rb +121 -0
- data/app/models/group.rb +3 -3
- data/app/models/permission.rb +33 -2
- data/app/models/relation.rb +1 -1
- data/app/models/relation/custom.rb +12 -1
- data/app/models/relation/public.rb +1 -1
- data/app/models/sphere.rb +3 -1
- data/app/models/tie.rb +35 -18
- data/app/views/activities/_walls.html.erb +2 -2
- data/app/views/api/activity_atom_feed.atom.builder +38 -38
- data/app/views/avatars/index.html.erb +12 -40
- data/app/views/comments/_new.html.erb +9 -8
- data/app/views/contacts/_contact.html.erb +20 -0
- data/app/views/contacts/_edit.html.erb +76 -0
- data/app/views/contacts/_form.html.erb +72 -0
- data/app/views/contacts/_index.html.erb +1 -1
- data/app/views/{ties → contacts}/_pendings.html.erb +3 -3
- data/app/views/{ties → contacts}/_suggestions.html.erb +5 -5
- data/app/views/contacts/_suggestions_and_pendings.html.erb +6 -0
- data/app/views/contacts/edit.html.erb +5 -0
- data/app/views/contacts/index.html.erb +1 -1
- data/app/views/contacts/new.html.erb +5 -0
- data/app/views/conversations/_conversation.html.erb +1 -1
- data/app/views/conversations/_index.html.erb +0 -5
- data/app/views/conversations/_show.html.erb +1 -2
- data/app/views/conversations/index.html.erb +4 -0
- data/app/views/conversations/index.js.erb +1 -0
- data/app/views/frontpage/index.html.erb +2 -3
- data/app/views/groups/_index.html.erb +5 -1
- data/app/views/groups/_new.html.erb +4 -3
- data/app/views/groups/_sidebar_index.html.erb +3 -10
- data/app/views/groups/_sidebar_show.html.erb +1 -9
- data/app/views/groups/index.html.erb +6 -8
- data/app/views/groups/show.html.erb +11 -4
- data/app/views/home/_sidebar.html.erb +1 -15
- data/app/views/home/index.html.erb +3 -2
- data/app/views/layouts/_account.html.erb +1 -1
- data/app/views/layouts/_flash.html.erb +5 -0
- data/app/views/layouts/_footer.html.erb +5 -4
- data/app/views/layouts/_representation.html.erb +5 -12
- data/app/views/layouts/application.html.erb +23 -20
- data/app/views/layouts/frontpage.html.erb +22 -10
- data/app/views/location/_location.html.erb +1 -1
- data/app/views/messages/_new.html.erb +0 -2
- data/app/views/notification_mailer/new_notification_email.html.erb +21 -0
- data/app/views/notification_mailer/new_notification_email.text.erb +11 -0
- data/app/views/notifications/_index.html.erb +21 -0
- data/app/views/notifications/_notification.html.erb +47 -0
- data/app/views/notifications/_show.html.erb +3 -0
- data/app/views/notifications/activities/_follow_body.html.erb +2 -0
- data/app/views/notifications/activities/_follow_subject.html.erb +2 -0
- data/app/views/notifications/activities/_like_body.html.erb +5 -0
- data/app/views/notifications/activities/_like_object_body.html.erb +2 -0
- data/app/views/notifications/activities/_like_object_subject.html.erb +2 -0
- data/app/views/notifications/activities/_like_subject.html.erb +5 -0
- data/app/views/notifications/activities/_like_subject_body.html.erb +1 -0
- data/app/views/notifications/activities/_like_subject_subject.html.erb +2 -0
- data/app/views/notifications/activities/_make-friend_body.html.erb +3 -0
- data/app/views/notifications/activities/_make-friend_subject.html.erb +2 -0
- data/app/views/notifications/activities/_post_body.html.erb +2 -0
- data/app/views/notifications/activities/_post_subject.html.erb +1 -0
- data/app/views/notifications/activities/_update_body.html.erb +1 -0
- data/app/views/notifications/activities/_update_subject.html.erb +1 -0
- data/app/views/notifications/index.html.erb +19 -0
- data/app/views/notifications/index.js.erb +8 -0
- data/app/views/notifications/show.html.erb +5 -0
- data/app/views/permissions/_index.html.erb +39 -0
- data/app/views/permissions/index.js.erb +10 -0
- data/app/views/profiles/_contact.html.erb +81 -0
- data/app/views/profiles/_experience.html.erb +22 -0
- data/app/views/profiles/_personal.html.erb +74 -0
- data/app/views/profiles/_profile.html.erb +12 -181
- data/app/views/profiles/_tags.html.erb +22 -0
- data/app/views/profiles/edit.html.erb +0 -14
- data/app/views/profiles/show.html.erb +14 -0
- data/app/views/profiles/update.js.erb +2 -28
- data/app/views/relation/customs/_form.html.erb +29 -0
- data/app/views/relation/customs/_index.html.erb +30 -0
- data/app/views/relation/customs/_list.html.erb +36 -0
- data/app/views/relation/customs/create.js.erb +20 -0
- data/app/views/relation/customs/index.js.erb +2 -0
- data/app/views/relation/customs/update.js.erb +6 -0
- data/app/views/spheres/_form.html.erb +28 -0
- data/app/views/spheres/_jquery.erb +130 -0
- data/app/views/spheres/_list.html.erb +19 -0
- data/app/views/spheres/create.js.erb +20 -0
- data/app/views/spheres/index.html.erb +74 -0
- data/app/views/ties/_edit.html.erb +1 -33
- data/app/views/toolbar/_home.html.erb +9 -0
- data/app/views/{subjects/_toolbar_home_menu.html.erb → toolbar/_home_menu.html.erb} +1 -1
- data/app/views/{subjects/_toolbar_home_menu_options.html.erb → toolbar/_home_menu_options.html.erb} +7 -3
- data/app/views/{subjects/_toolbar_home_menu_options_subjects.html.erb → toolbar/_home_menu_options_subjects.html.erb} +0 -0
- data/app/views/{subjects/_toolbar_logo.html.erb → toolbar/_logo.html.erb} +1 -1
- data/app/views/{subjects/_toolbar_message_menu.html.erb → toolbar/_message_menu.html.erb} +0 -0
- data/app/views/toolbar/_notifications_menu.html.erb +3 -0
- data/app/views/{subjects/_toolbar_profile.html.erb → toolbar/_profile.html.erb} +2 -2
- data/app/views/toolbar/_profile_menu.html.erb +15 -0
- data/app/views/toolbar/_profile_menu_basic_options.html.erb +5 -0
- data/app/views/toolbar/_profile_menu_tie_options.html.erb +35 -0
- data/app/views/users/_index.html.erb +1 -1
- data/app/views/users/_sidebar_index.html.erb +1 -6
- data/app/views/users/index.html.erb +3 -3
- data/app/views/users/show.html.erb +12 -2
- data/config/locales/en.yml +106 -79
- data/config/routes.rb +19 -5
- data/lib/generators/social_stream/templates/initializer.rb +2 -2
- data/lib/generators/social_stream/templates/migration.rb +3 -1
- data/lib/generators/social_stream/templates/public/images/HTML5.png +0 -0
- data/lib/generators/social_stream/templates/public/images/HTML5_Semantics.png +0 -0
- data/lib/generators/social_stream/templates/public/images/HTML5_Styling.png +0 -0
- data/lib/generators/social_stream/templates/public/images/Jcrop.gif +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/btn_notification.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/btn_notification_delete.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/error.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/info.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/success.png +0 -0
- data/lib/generators/social_stream/templates/public/images/btn/warning.png +0 -0
- data/lib/generators/social_stream/templates/public/images/cancel.png +0 -0
- data/lib/generators/social_stream/templates/public/images/html5-badge-h-css3-semantics.png +0 -0
- data/lib/generators/social_stream/templates/public/images/icon_checkbox.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/actor/remote_subject.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/actor/remote_user.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/representation/group.png +0 -0
- data/lib/generators/social_stream/templates/public/images/logos/representation/user.png +0 -0
- data/lib/generators/social_stream/templates/public/images/pbar-ani.gif +0 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload-ui.js +259 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload.js +475 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.form.js +815 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.mouse.js +156 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.slider.js +684 -0
- data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.widget.js +236 -0
- data/lib/generators/social_stream/templates/public/javascripts/ui.checkbox.js +309 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/base.css +13 -12
- data/lib/generators/social_stream/templates/public/stylesheets/default/contacts.css +88 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/footer.css +1 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/header.css +5 -3
- data/lib/generators/social_stream/templates/public/stylesheets/default/home.css +1 -1
- data/lib/generators/social_stream/templates/public/stylesheets/default/images/loading.gif +0 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.fileupload-ui.css +73 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slider.css +24 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slidertheme.css +32 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/messages.css +4 -0
- data/lib/generators/social_stream/templates/public/stylesheets/default/spheres.css +226 -0
- data/lib/generators/social_stream/templates/relations.yml +12 -12
- data/lib/social_stream.rb +2 -1
- data/lib/social_stream/ability.rb +5 -4
- data/lib/social_stream/controllers/helpers.rb +19 -0
- data/lib/social_stream/models/object.rb +3 -1
- data/lib/social_stream/models/subject.rb +19 -6
- data/lib/social_stream/rails.rb +23 -1
- data/lib/social_stream/test_helpers/controllers.rb +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/lib/tasks/db/populate.rake +6 -9
- data/social_stream.gemspec +7 -4
- data/spec/controllers/comments_controller_spec.rb +1 -1
- data/spec/controllers/contacts_controller_spec.rb +23 -0
- data/spec/controllers/groups_controller_spec.rb +12 -1
- data/spec/controllers/permissions_controller_spec.rb +48 -0
- data/spec/controllers/posts_controller_spec.rb +4 -4
- data/spec/controllers/relation_customs_controller_spec.rb +130 -0
- data/spec/controllers/representations_spec.rb +74 -0
- data/spec/controllers/spheres_controller_spec.rb +108 -0
- data/spec/dummy/config/initializers/mailboxer.rb +8 -0
- data/spec/dummy/config/initializers/social_stream.rb +2 -2
- data/spec/dummy/config/relations.yml +12 -12
- data/spec/factories/relation_custom.rb +4 -0
- data/spec/factories/sphere.rb +5 -0
- data/spec/factories/tie.rb +4 -4
- data/spec/models/activity_spec.rb +58 -38
- data/spec/models/actor_spec.rb +1 -1
- data/spec/models/group_spec.rb +12 -0
- data/spec/models/like_spec.rb +68 -0
- data/spec/models/profile_spec.rb +2 -1
- data/spec/models/relation_custom_spec.rb +14 -0
- data/spec/models/tie_spec.rb +26 -2
- metadata +195 -94
- data/app/controllers/avatars_controller.rb +0 -51
- data/app/controllers/representations_controller.rb +0 -19
- data/app/controllers/ties_controller.rb +0 -22
- data/app/helpers/ties_helper.rb +0 -37
- data/app/models/avatar.rb +0 -91
- data/app/models/representation.rb +0 -35
- data/app/views/avatars/_form.html.erb +0 -12
- data/app/views/avatars/_precrop.html.erb +0 -66
- data/app/views/avatars/edit.html.erb +0 -6
- data/app/views/avatars/new.html.erb +0 -32
- data/app/views/avatars/show.html.erb +0 -5
- data/app/views/groups/_location.html.erb +0 -3
- data/app/views/groups/_logo.html.erb +0 -5
- data/app/views/home/_location.html.erb +0 -3
- data/app/views/subjects/_toolbar_home.html.erb +0 -9
- data/app/views/subjects/_toolbar_profile_menu.html.erb +0 -12
- data/app/views/subjects/_toolbar_profile_menu_basic_options.html.erb +0 -13
- data/app/views/subjects/_toolbar_profile_menu_tie_options.html.erb +0 -41
- data/app/views/ties/_new.html.erb +0 -64
- data/app/views/ties/_tie.html.erb +0 -23
- data/app/views/ties/new.html.erb +0 -1
- data/app/views/users/_location.html.erb +0 -3
- data/lib/generators/social_stream/templates/public/images/w3c_css.png +0 -0
- data/lib/generators/social_stream/templates/public/images/w3c_xhtml.png +0 -0
- data/lib/generators/social_stream/templates/public/javascripts/addContact.js +0 -100
- data/lib/generators/social_stream/templates/public/stylesheets/default/addContact.css +0 -29
- data/spec/controllers/representations_controller_spec.rb +0 -51
- data/spec/controllers/ties_controller_spec.rb +0 -19
- data/spec/models/representation_spec.rb +0 -16
@@ -0,0 +1,130 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe Relation::CustomsController do
|
4
|
+
include SocialStream::TestHelpers::Controllers
|
5
|
+
|
6
|
+
render_views
|
7
|
+
|
8
|
+
describe "when authenticated" do
|
9
|
+
before do
|
10
|
+
@user = Factory(:user)
|
11
|
+
|
12
|
+
sign_in @user
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with an existing sphere" do
|
16
|
+
before do
|
17
|
+
@sphere = Factory(:sphere, :actor_id => @user.actor_id)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should render index" do
|
21
|
+
get :index, :sphere_id => @sphere.id, :format => "js"
|
22
|
+
|
23
|
+
response.should be_success
|
24
|
+
end
|
25
|
+
|
26
|
+
context "a new relation" do
|
27
|
+
it "should be created" do
|
28
|
+
count = Relation::Custom.count
|
29
|
+
|
30
|
+
post :create, :custom => { :name => "Test create", :sphere_id => @sphere.id }, :format => 'js'
|
31
|
+
|
32
|
+
relation = assigns(:custom)
|
33
|
+
|
34
|
+
Relation::Custom.count.should eq(count + 1)
|
35
|
+
relation.should be_valid
|
36
|
+
response.should be_success
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
context "a existing own relation" do
|
42
|
+
before do
|
43
|
+
@relation = Factory(:relation_custom, :sphere_id => @sphere.id)
|
44
|
+
@relation.reload
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should allow updating" do
|
48
|
+
attrs = { :name => "Updating own" }
|
49
|
+
|
50
|
+
put :update, :id => @relation.to_param, :relation_custom => attrs, :format => 'js'
|
51
|
+
|
52
|
+
relation = assigns(:custom)
|
53
|
+
|
54
|
+
# relation.should_receive(:update_attributes).with(attrs)
|
55
|
+
relation.should be_valid
|
56
|
+
response.should be_success
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should allow destroying" do
|
60
|
+
pending "Delete relations"
|
61
|
+
|
62
|
+
count = Relation::Custom.count
|
63
|
+
|
64
|
+
delete :destroy, :id => @relation.to_param, :format => :js
|
65
|
+
|
66
|
+
Relation::Custom.count.should eq(count - 1)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
context "with a fake sphere" do
|
73
|
+
before do
|
74
|
+
@sphere = Factory(:sphere)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should not render index" do
|
78
|
+
pending
|
79
|
+
|
80
|
+
get :index, :sphere_id => @sphere.id, :format => "js"
|
81
|
+
|
82
|
+
assert false
|
83
|
+
end
|
84
|
+
|
85
|
+
context "a new relation" do
|
86
|
+
it "should belong to user" do
|
87
|
+
count = Relation::Custom.count
|
88
|
+
|
89
|
+
begin
|
90
|
+
post :create, :relation_custom => { :name => "Test create", :sphere_id => @sphere.id }, :format => 'js'
|
91
|
+
|
92
|
+
assert false
|
93
|
+
rescue CanCan::AccessDenied
|
94
|
+
|
95
|
+
Relation::Custom.count.should eq(count)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "a external relation" do
|
102
|
+
before do
|
103
|
+
@relation = Factory(:relation_custom)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should not allow updating" do
|
107
|
+
begin
|
108
|
+
put :update, :id => @relation.to_param, :relation_custom => { :name => "Updating external" }, :format => 'js'
|
109
|
+
|
110
|
+
assert false
|
111
|
+
rescue CanCan::AccessDenied
|
112
|
+
assigns(:relation).should be_nil
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should not allow destroying" do
|
117
|
+
begin
|
118
|
+
delete :destroy, :id => @relation.to_param
|
119
|
+
|
120
|
+
assert false
|
121
|
+
rescue CanCan::AccessDenied
|
122
|
+
assigns(:relation).should be_nil
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe HomeController do
|
4
|
+
include ActionController::RecordIdentifier
|
5
|
+
include SocialStream::TestHelpers
|
6
|
+
|
7
|
+
render_views
|
8
|
+
|
9
|
+
describe "create" do
|
10
|
+
context "with logged user" do
|
11
|
+
before do
|
12
|
+
@user = Factory(:user)
|
13
|
+
sign_in @user
|
14
|
+
end
|
15
|
+
|
16
|
+
context "to represent herself" do
|
17
|
+
it "should redirect_to root" do
|
18
|
+
get :index, :s => @user.slug
|
19
|
+
|
20
|
+
assigns(:current_subject).should == @user
|
21
|
+
response.should be_success
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "to represent own group" do
|
26
|
+
before do
|
27
|
+
@group = Factory(:member, :receiver => @user.actor).sender_subject
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should redirect_to root" do
|
31
|
+
get :index, :s => @group.slug
|
32
|
+
|
33
|
+
assigns(:current_subject).should == @group
|
34
|
+
response.should be_success
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "representing own group" do
|
39
|
+
before do
|
40
|
+
@group = Factory(:member, :receiver => @user.actor).sender_subject
|
41
|
+
represent @group
|
42
|
+
end
|
43
|
+
|
44
|
+
context "to represent herself" do
|
45
|
+
it "should redirect_to root" do
|
46
|
+
get :index, :s => @user.slug
|
47
|
+
|
48
|
+
assigns(:current_subject).should == @user
|
49
|
+
response.should be_success
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "to represent other group" do
|
55
|
+
before do
|
56
|
+
@group = Factory(:group)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should deny access" do
|
60
|
+
begin
|
61
|
+
get :index, :s => @group.slug
|
62
|
+
|
63
|
+
assert false
|
64
|
+
rescue ActionView::Template::Error => e
|
65
|
+
assert e.message == "Not authorized!"
|
66
|
+
rescue CanCan::AccessDenied
|
67
|
+
assert true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe SpheresController do
|
4
|
+
include SocialStream::TestHelpers::Controllers
|
5
|
+
|
6
|
+
render_views
|
7
|
+
|
8
|
+
describe "when Anonymous" do
|
9
|
+
context "faking a new sphere" do
|
10
|
+
before do
|
11
|
+
model_attributes[:actor_id] = Factory(:user).actor_id
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should not create" do
|
15
|
+
post :create, attributes
|
16
|
+
|
17
|
+
response.should redirect_to(:new_user_session)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "an existing sphere" do
|
22
|
+
before do
|
23
|
+
@current_model = Factory(:sphere)
|
24
|
+
end
|
25
|
+
|
26
|
+
it_should_behave_like "Deny Updating"
|
27
|
+
it_should_behave_like "Deny Destroying"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "when authenticated" do
|
32
|
+
before do
|
33
|
+
@user = Factory(:user)
|
34
|
+
|
35
|
+
sign_in @user
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should render index" do
|
39
|
+
get :index
|
40
|
+
|
41
|
+
assert_response :success
|
42
|
+
end
|
43
|
+
|
44
|
+
context "a new own sphere" do
|
45
|
+
before do
|
46
|
+
model_attributes[:actor_id] = @user.actor_id
|
47
|
+
end
|
48
|
+
|
49
|
+
it_should_behave_like "Allow Creating"
|
50
|
+
end
|
51
|
+
|
52
|
+
context "a new fake sphere" do
|
53
|
+
before do
|
54
|
+
model_attributes[:actor_id] = Factory(:user).actor_id
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should belong to user" do
|
58
|
+
count = Sphere.count
|
59
|
+
post :create, attributes
|
60
|
+
|
61
|
+
resource = assigns(:sphere)
|
62
|
+
|
63
|
+
Sphere.count.should eq(count + 1)
|
64
|
+
resource.should be_valid
|
65
|
+
resource.actor.should eq(@user.actor)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "a external sphere" do
|
70
|
+
before do
|
71
|
+
@current_model = Factory(:sphere)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should not be found on update" do
|
75
|
+
begin
|
76
|
+
put :update, updating_attributes
|
77
|
+
|
78
|
+
assert false
|
79
|
+
rescue ActiveRecord::RecordNotFound
|
80
|
+
assigns(:sphere).should be_nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should not be found on destroy" do
|
85
|
+
begin
|
86
|
+
delete :destroy, :id => @current_model.to_param
|
87
|
+
|
88
|
+
assert false
|
89
|
+
rescue ActiveRecord::RecordNotFound
|
90
|
+
assigns(:sphere).should be_nil
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
context "a existing own sphere" do
|
97
|
+
before do
|
98
|
+
@current_model = Factory(:sphere, :actor_id => @user.actor_id)
|
99
|
+
end
|
100
|
+
|
101
|
+
# This is not working, because of updating attributes. Do not know why
|
102
|
+
# it_should_behave_like "Allow Updating"
|
103
|
+
it_should_behave_like "Allow Destroying"
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Mailboxer.setup do |config|
|
2
|
+
|
3
|
+
#Configures if you applications uses or no the email sending for Notifications and Messages
|
4
|
+
config.uses_emails = true
|
5
|
+
|
6
|
+
#Configures the default from for the email sent for Messages and Notifications of Mailboxer
|
7
|
+
config.default_from = "no-reply@mailboxer.com"
|
8
|
+
end
|
@@ -2,7 +2,7 @@ SocialStream.setup do |config|
|
|
2
2
|
# List the models that are social entities. These will have ties between them.
|
3
3
|
# Remember you must add an "actor_id" foreign key column to your migration!
|
4
4
|
#
|
5
|
-
# config.
|
5
|
+
# config.subjects = [:user, :group ]
|
6
6
|
|
7
7
|
# Include devise modules in User. See devise documentation for details.
|
8
8
|
# Others available are:
|
@@ -13,5 +13,5 @@ SocialStream.setup do |config|
|
|
13
13
|
# Type of activities managed by actors
|
14
14
|
# Remember you must add an "activity_object_id" foreign key column to your migration!
|
15
15
|
#
|
16
|
-
# config.
|
16
|
+
# config.objects = [ :post, :comment ]
|
17
17
|
end
|
@@ -11,17 +11,17 @@ user:
|
|
11
11
|
friend:
|
12
12
|
name: friend
|
13
13
|
permissions:
|
14
|
-
- [ follow ]
|
15
|
-
- [ create, activity ]
|
16
|
-
- [ read, activity,
|
17
|
-
- [ update, activity ]
|
18
|
-
- [ destroy, activity ]
|
14
|
+
- [ follow ] # follow the activities of the friend
|
15
|
+
- [ create, activity ] # let the friend create activities
|
16
|
+
- [ read, activity, weak_star_ties ] # friend can read activities from the other friends and below
|
17
|
+
- [ update, activity ] # update her activities
|
18
|
+
- [ destroy, activity ] # delete her activities
|
19
19
|
sphere: personal
|
20
20
|
acquaintance:
|
21
21
|
name: acquaintance
|
22
22
|
parent: friend # friend relation is stronger than acquaintance
|
23
23
|
permissions:
|
24
|
-
- [ read, activity,
|
24
|
+
- [ read, activity, weak_star_ties ]
|
25
25
|
sphere: personal
|
26
26
|
|
27
27
|
group:
|
@@ -29,15 +29,15 @@ group:
|
|
29
29
|
name: member
|
30
30
|
permissions:
|
31
31
|
- [ represent ] # let the member act as the group
|
32
|
-
- [ create, activity
|
33
|
-
- [ read, activity,
|
34
|
-
- [ update, activity
|
35
|
-
- [ destroy, activity
|
32
|
+
- [ create, activity ] # let them member create activities
|
33
|
+
- [ read, activity, weak_star_ties ] # read activities from other members
|
34
|
+
- [ update, activity ] # update her activities
|
35
|
+
- [ destroy, activity ] # delete her activities
|
36
36
|
- [ read, tie, weak_star_ties ]
|
37
37
|
sphere: organization
|
38
38
|
partner:
|
39
39
|
name: partner
|
40
40
|
parent: member # member is stronger than partner
|
41
41
|
permissions:
|
42
|
-
- [ read, activity,
|
43
|
-
sphere:
|
42
|
+
- [ read, activity, weak_star_ties ]
|
43
|
+
sphere: external_relations
|
data/spec/factories/tie.rb
CHANGED
@@ -6,11 +6,11 @@ end
|
|
6
6
|
# User ties
|
7
7
|
|
8
8
|
Factory.define :friend, :parent => :tie do |t|
|
9
|
-
t.after_build { |u| u.relation = u.sender.
|
9
|
+
t.after_build { |u| u.relation = u.sender.relation_custom('friend') }
|
10
10
|
end
|
11
11
|
|
12
12
|
Factory.define :acquaintance, :parent => :tie do |t|
|
13
|
-
t.after_build { |u| u.relation = u.sender.
|
13
|
+
t.after_build { |u| u.relation = u.sender.relation_custom('acquaintance') }
|
14
14
|
end
|
15
15
|
|
16
16
|
Factory.define :public, :parent => :tie do |t|
|
@@ -23,7 +23,7 @@ Factory.define :g2u_tie, :parent => :tie do |t|
|
|
23
23
|
end
|
24
24
|
|
25
25
|
Factory.define :member, :parent => :g2u_tie do |t|
|
26
|
-
t.after_build { |u| u.relation = u.sender.
|
26
|
+
t.after_build { |u| u.relation = u.sender.relation_custom('member') }
|
27
27
|
end
|
28
28
|
|
29
29
|
Factory.define :g2g_tie, :parent => :tie do |t|
|
@@ -32,6 +32,6 @@ Factory.define :g2g_tie, :parent => :tie do |t|
|
|
32
32
|
end
|
33
33
|
|
34
34
|
Factory.define :partner, :parent => :g2g_tie do |t|
|
35
|
-
t.after_build { |u| u.relation = u.sender.
|
35
|
+
t.after_build { |u| u.relation = u.sender.relation_custom('partner') }
|
36
36
|
end
|
37
37
|
|
@@ -18,7 +18,8 @@ module ActivityTestHelper
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create_ability_accessed_publicly
|
21
|
-
|
21
|
+
u = Factory(:user)
|
22
|
+
@ability = Ability.new(u)
|
22
23
|
end
|
23
24
|
|
24
25
|
shared_examples_for "Allows Creating" do
|
@@ -74,55 +75,74 @@ end
|
|
74
75
|
describe Activity do
|
75
76
|
include ActivityTestHelper
|
76
77
|
|
77
|
-
describe "
|
78
|
-
|
79
|
-
describe "activity" do
|
78
|
+
describe "wall" do
|
79
|
+
context "with a friend activity" do
|
80
80
|
before do
|
81
|
-
@
|
82
|
-
@activity = @like_activity.parent
|
81
|
+
@activity = Factory(:activity)
|
83
82
|
end
|
84
83
|
|
85
|
-
|
86
|
-
|
84
|
+
describe "sender home" do
|
85
|
+
it "should include activity" do
|
86
|
+
@activity.sender.wall(:home).should include(@activity)
|
87
|
+
end
|
87
88
|
end
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
describe "receiver home" do
|
91
|
+
it "should include activity" do
|
92
|
+
@activity.receiver.wall(:home).should include(@activity)
|
93
|
+
end
|
91
94
|
end
|
92
|
-
end
|
93
95
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
96
|
+
describe "alien home" do
|
97
|
+
it "should not include activity" do
|
98
|
+
Factory(:user).wall(:home).should_not include(@activity)
|
99
|
+
end
|
98
100
|
end
|
99
101
|
|
100
|
-
|
101
|
-
|
102
|
+
describe "sender profile" do
|
103
|
+
context "for sender" do
|
104
|
+
it "should include activity" do
|
105
|
+
@activity.sender.wall(:profile, :for => @activity.sender).should include(@activity)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context "for receiver" do
|
110
|
+
it "should include activity" do
|
111
|
+
@activity.sender.wall(:profile, :for => @activity.receiver).should include(@activity)
|
112
|
+
@activity.sender.wall(:profile,
|
113
|
+
:for => @activity.receiver,
|
114
|
+
:relation => @activity.tie.relation).should include(@activity)
|
115
|
+
end
|
116
|
+
end
|
102
117
|
end
|
103
118
|
end
|
104
|
-
end
|
105
119
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
describe "type home" do
|
112
|
-
it "should include activity" do
|
113
|
-
@activity.sender.wall(:home).should include(@activity)
|
114
|
-
@activity.receiver.wall(:home).should include(@activity)
|
120
|
+
context "with public activity" do
|
121
|
+
before do
|
122
|
+
tie = Factory(:user).public_tie
|
123
|
+
@activity = Factory(:activity, :_tie => tie)
|
115
124
|
end
|
116
|
-
end
|
117
125
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
:for => @activity.receiver,
|
124
|
-
:relation => @activity.tie.relation).should include(@activity)
|
126
|
+
describe "sender home" do
|
127
|
+
it "should include activity" do
|
128
|
+
@activity.sender.wall(:home).should include(@activity)
|
129
|
+
end
|
130
|
+
end
|
125
131
|
|
132
|
+
describe "sender profile" do
|
133
|
+
context "accessed by alien" do
|
134
|
+
it "should include activity" do
|
135
|
+
@activity.sender.wall(:profile,
|
136
|
+
:for => Factory(:user)).should include(@activity)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "accessed by anonymous" do
|
141
|
+
it "should include activity" do
|
142
|
+
@activity.sender.wall(:profile,
|
143
|
+
:for => nil).should include(@activity)
|
144
|
+
end
|
145
|
+
end
|
126
146
|
end
|
127
147
|
end
|
128
148
|
end
|
@@ -181,7 +201,7 @@ describe Activity do
|
|
181
201
|
describe "belonging to friend self tie" do
|
182
202
|
before do
|
183
203
|
user = Factory(:user)
|
184
|
-
tie = user.ties.where(:relation_id => user.
|
204
|
+
tie = user.ties.where(:relation_id => user.relation_custom('friend')).first
|
185
205
|
create_activity_assigned_to(tie)
|
186
206
|
end
|
187
207
|
|
@@ -316,8 +336,8 @@ describe Activity do
|
|
316
336
|
|
317
337
|
it_should_behave_like "Denies Creating"
|
318
338
|
it_should_behave_like "Allows Reading"
|
319
|
-
it_should_behave_like "
|
320
|
-
it_should_behave_like "
|
339
|
+
it_should_behave_like "Denies Updating"
|
340
|
+
it_should_behave_like "Denies Destroying"
|
321
341
|
end
|
322
342
|
|
323
343
|
describe "accessed by partner" do
|