socializer 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +11 -0
- data/.gitignore +29 -0
- data/.rubocop.yml +42 -0
- data/.travis.yml +13 -0
- data/CONTRIBUTING.md +46 -0
- data/Gemfile +31 -0
- data/README.md +91 -0
- data/Rakefile +38 -0
- data/app/assets/images/socializer/.gitkeep +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/facebook_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/google_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/linkedin_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/twitter_64.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_128.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_256.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_32.png +0 -0
- data/app/assets/images/socializer/auth_buttons/yahoo_64.png +0 -0
- data/app/assets/images/socializer/close.png +0 -0
- data/app/assets/images/socializer/icons/Bell.png +0 -0
- data/app/assets/images/socializer/icons/Edit.png +0 -0
- data/app/assets/images/socializer/icons/Home.png +0 -0
- data/app/assets/images/socializer/icons/Power.png +0 -0
- data/app/assets/images/socializer/icons/Safe.png +0 -0
- data/app/assets/images/socializer/icons/User.png +0 -0
- data/app/assets/images/socializer/icons/Users.png +0 -0
- data/app/assets/images/socializer/icons/Web.png +0 -0
- data/app/assets/images/socializer/loading.gif +0 -0
- data/app/assets/images/socializer/next.png +0 -0
- data/app/assets/images/socializer/pause.png +0 -0
- data/app/assets/images/socializer/play.png +0 -0
- data/app/assets/images/socializer/previous.png +0 -0
- data/app/assets/javascripts/socializer/activities.js.coffee +47 -0
- data/app/assets/javascripts/socializer/application.js +24 -0
- data/app/assets/javascripts/socializer/circles.js.coffee +33 -0
- data/app/assets/javascripts/socializer/jquery.qtip.min.js +7 -0
- data/app/assets/javascripts/socializer/jquery.tokeninput.js +862 -0
- data/app/assets/javascripts/socializer/notes.js.coffee +38 -0
- data/app/assets/javascripts/socializer/people.js.coffee +7 -0
- data/app/assets/javascripts/socializer/shares.js.coffee +8 -0
- data/app/assets/stylesheets/socializer/activities.css +84 -0
- data/app/assets/stylesheets/socializer/application.css +409 -0
- data/app/assets/stylesheets/socializer/authentications.css +4 -0
- data/app/assets/stylesheets/socializer/circles.css +74 -0
- data/app/assets/stylesheets/socializer/comments.css +4 -0
- data/app/assets/stylesheets/socializer/groups.css +61 -0
- data/app/assets/stylesheets/socializer/jquery.qtip.min.css +2 -0
- data/app/assets/stylesheets/socializer/likes.css +4 -0
- data/app/assets/stylesheets/socializer/memberships.css +4 -0
- data/app/assets/stylesheets/socializer/notes.css +21 -0
- data/app/assets/stylesheets/socializer/notifications.css +46 -0
- data/app/assets/stylesheets/socializer/pages.css +4 -0
- data/app/assets/stylesheets/socializer/persons.css +25 -0
- data/app/assets/stylesheets/socializer/sessions.css +4 -0
- data/app/assets/stylesheets/socializer/shares.css.scss +3 -0
- data/app/assets/stylesheets/socializer/ties.css +4 -0
- data/app/assets/stylesheets/socializer/token-input.css +183 -0
- data/app/controllers/socializer/activities_controller.rb +84 -0
- data/app/controllers/socializer/application_controller.rb +37 -0
- data/app/controllers/socializer/audiences_controller.rb +30 -0
- data/app/controllers/socializer/authentications_controller.rb +13 -0
- data/app/controllers/socializer/circles_controller.rb +54 -0
- data/app/controllers/socializer/comments_controller.rb +37 -0
- data/app/controllers/socializer/groups_controller.rb +70 -0
- data/app/controllers/socializer/likes_controller.rb +50 -0
- data/app/controllers/socializer/memberships_controller.rb +46 -0
- data/app/controllers/socializer/notes_controller.rb +43 -0
- data/app/controllers/socializer/notifications_controller.rb +29 -0
- data/app/controllers/socializer/pages_controller.rb +7 -0
- data/app/controllers/socializer/people_controller.rb +37 -0
- data/app/controllers/socializer/person_addresses_controller.rb +27 -0
- data/app/controllers/socializer/person_contributions_controller.rb +27 -0
- data/app/controllers/socializer/person_educations_controller.rb +27 -0
- data/app/controllers/socializer/person_employments_controller.rb +27 -0
- data/app/controllers/socializer/person_links_controller.rb +27 -0
- data/app/controllers/socializer/person_phones_controller.rb +27 -0
- data/app/controllers/socializer/person_places_controller.rb +27 -0
- data/app/controllers/socializer/person_profiles_controller.rb +27 -0
- data/app/controllers/socializer/sessions_controller.rb +37 -0
- data/app/controllers/socializer/shares_controller.rb +54 -0
- data/app/controllers/socializer/ties_controller.rb +16 -0
- data/app/helpers/socializer/application_helper.rb +22 -0
- data/app/models/concerns/socializer/object_type_base.rb +58 -0
- data/app/models/socializer/activity.rb +162 -0
- data/app/models/socializer/activity_field.rb +10 -0
- data/app/models/socializer/activity_object.rb +118 -0
- data/app/models/socializer/audience.rb +19 -0
- data/app/models/socializer/authentication.rb +20 -0
- data/app/models/socializer/circle.rb +32 -0
- data/app/models/socializer/comment.rb +13 -0
- data/app/models/socializer/group.rb +100 -0
- data/app/models/socializer/group_category.rb +11 -0
- data/app/models/socializer/group_link.rb +12 -0
- data/app/models/socializer/identity.rb +9 -0
- data/app/models/socializer/membership.rb +24 -0
- data/app/models/socializer/note.rb +13 -0
- data/app/models/socializer/notification.rb +16 -0
- data/app/models/socializer/person.rb +129 -0
- data/app/models/socializer/person_address.rb +12 -0
- data/app/models/socializer/person_contribution.rb +12 -0
- data/app/models/socializer/person_education.rb +8 -0
- data/app/models/socializer/person_employment.rb +8 -0
- data/app/models/socializer/person_link.rb +12 -0
- data/app/models/socializer/person_phone.rb +16 -0
- data/app/models/socializer/person_place.rb +11 -0
- data/app/models/socializer/person_profile.rb +12 -0
- data/app/models/socializer/tie.rb +12 -0
- data/app/models/socializer/verb.rb +9 -0
- data/app/views/layouts/socializer/_header.html.erb +11 -0
- data/app/views/layouts/socializer/application.html.erb +60 -0
- data/app/views/socializer/activities/_activity.html.erb +23 -0
- data/app/views/socializer/activities/_activity_bottom.html.erb +55 -0
- data/app/views/socializer/activities/_activity_content.html.erb +19 -0
- data/app/views/socializer/activities/_activity_top.html.erb +22 -0
- data/app/views/socializer/activities/_stream_card.html.erb +6 -0
- data/app/views/socializer/activities/_stream_list.html.erb +16 -0
- data/app/views/socializer/activities/audience.html.erb +19 -0
- data/app/views/socializer/activities/destroy.js.erb +3 -0
- data/app/views/socializer/activities/edit.html.erb +0 -0
- data/app/views/socializer/activities/index.html.erb +15 -0
- data/app/views/socializer/authentications/_form.html.erb +0 -0
- data/app/views/socializer/authentications/_menu.html.erb +5 -0
- data/app/views/socializer/authentications/index.html.erb +8 -0
- data/app/views/socializer/authentications/new.html.erb +8 -0
- data/app/views/socializer/circles/_card.html.erb +7 -0
- data/app/views/socializer/circles/_circles.html.erb +6 -0
- data/app/views/socializer/circles/_form.html.erb +6 -0
- data/app/views/socializer/circles/_menu.html.erb +7 -0
- data/app/views/socializer/circles/contact_of.html.erb +7 -0
- data/app/views/socializer/circles/contacts.html.erb +7 -0
- data/app/views/socializer/circles/edit.html.erb +1 -0
- data/app/views/socializer/circles/find_people.html.erb +7 -0
- data/app/views/socializer/circles/index.html.erb +6 -0
- data/app/views/socializer/circles/new.html.erb +1 -0
- data/app/views/socializer/circles/show.html.erb +10 -0
- data/app/views/socializer/comments/_form.html.erb +8 -0
- data/app/views/socializer/comments/edit.html.erb +1 -0
- data/app/views/socializer/comments/new.html.erb +1 -0
- data/app/views/socializer/groups/_card.html.erb +6 -0
- data/app/views/socializer/groups/_form.html.erb +6 -0
- data/app/views/socializer/groups/_menu.html.erb +10 -0
- data/app/views/socializer/groups/edit.html.erb +1 -0
- data/app/views/socializer/groups/index.html.erb +0 -0
- data/app/views/socializer/groups/joinable.html.erb +16 -0
- data/app/views/socializer/groups/memberships.html.erb +19 -0
- data/app/views/socializer/groups/new.html.erb +1 -0
- data/app/views/socializer/groups/ownerships.html.erb +20 -0
- data/app/views/socializer/groups/pending_invites.html.erb +20 -0
- data/app/views/socializer/groups/public.html.erb +16 -0
- data/app/views/socializer/groups/restricted.html.erb +16 -0
- data/app/views/socializer/groups/show.html.erb +29 -0
- data/app/views/socializer/likes/create.js.erb +2 -0
- data/app/views/socializer/likes/destroy.js.erb +2 -0
- data/app/views/socializer/likes/index.html.erb +5 -0
- data/app/views/socializer/notes/_form.html.erb +7 -0
- data/app/views/socializer/notes/create.js.erb +10 -0
- data/app/views/socializer/notes/destroy.js.erb +3 -0
- data/app/views/socializer/notes/edit.html.erb +1 -0
- data/app/views/socializer/notes/new.html.erb +2 -0
- data/app/views/socializer/notifications/index.html.erb +35 -0
- data/app/views/socializer/pages/index.html.erb +2 -0
- data/app/views/socializer/people/_card.html.erb +15 -0
- data/app/views/socializer/people/_form.html.erb +30 -0
- data/app/views/socializer/people/_login.html.erb +14 -0
- data/app/views/socializer/people/_menu.html.erb +9 -0
- data/app/views/socializer/people/edit.html.erb +2 -0
- data/app/views/socializer/people/index.html.erb +5 -0
- data/app/views/socializer/people/likes.html.erb +6 -0
- data/app/views/socializer/people/message.html.erb +5 -0
- data/app/views/socializer/people/show.html.erb +122 -0
- data/app/views/socializer/person_addresses/_form.html.erb +12 -0
- data/app/views/socializer/person_contributions/_form.html.erb +7 -0
- data/app/views/socializer/person_educations/_form.html.erb +10 -0
- data/app/views/socializer/person_employments/_form.html.erb +10 -0
- data/app/views/socializer/person_links/_form.html.erb +6 -0
- data/app/views/socializer/person_phones/_form.html.erb +6 -0
- data/app/views/socializer/person_places/_form.html.erb +6 -0
- data/app/views/socializer/person_profiles/_form.html.erb +6 -0
- data/app/views/socializer/shares/_form.html.erb +19 -0
- data/app/views/socializer/shares/new.html.erb +1 -0
- data/config.ru +4 -0
- data/config/cucumber.yml +8 -0
- data/config/initializers/inflections.rb +3 -0
- data/config/locales/en.yml +108 -0
- data/config/locales/fr.yml +329 -0
- data/config/rails_best_practices.yml +41 -0
- data/config/routes.rb +71 -0
- data/db/migrate/20110804175740_create_socializer_activity_objects.rb +14 -0
- data/db/migrate/20110804180557_create_socializer_people.rb +31 -0
- data/db/migrate/20110804184415_create_socializer_notes.rb +12 -0
- data/db/migrate/20110804192211_create_socializer_authentications.rb +12 -0
- data/db/migrate/20110805085417_create_socializer_circles.rb +14 -0
- data/db/migrate/20110805090617_create_socializer_activities.rb +17 -0
- data/db/migrate/20110805092635_create_socializer_audiences.rb +14 -0
- data/db/migrate/20110805094846_create_socializer_comments.rb +12 -0
- data/db/migrate/20110805121454_create_socializer_groups.rb +19 -0
- data/db/migrate/20110805121543_create_socializer_memberships.rb +14 -0
- data/db/migrate/20110805125606_create_socializer_ties.rb +13 -0
- data/db/migrate/20111207234435_create_socializer_identities.rb +12 -0
- data/db/migrate/20130524000429_create_socializer_verbs.rb +10 -0
- data/db/migrate/20130528143831_create_socializer_activity_fields.rb +10 -0
- data/db/migrate/20140128235250_create_socializer_notifications.rb +11 -0
- data/db/migrate/20140131065531_create_socializer_person_employments.rb +15 -0
- data/db/migrate/20140131065733_create_socializer_person_educations.rb +15 -0
- data/db/migrate/20140131065836_create_socializer_person_places.rb +11 -0
- data/db/migrate/20140131070051_create_socializer_person_contributions.rb +12 -0
- data/db/migrate/20140131070232_create_socializer_person_links.rb +11 -0
- data/db/migrate/20140131070259_create_socializer_person_profiles.rb +11 -0
- data/db/migrate/20140131070417_create_socializer_person_phones.rb +12 -0
- data/db/migrate/20140131070611_create_socializer_person_addresses.rb +17 -0
- data/db/migrate/20140131070839_create_socializer_group_links.rb +11 -0
- data/db/migrate/20140131070951_create_socializer_group_categories.rb +10 -0
- data/features/support/capybara.rb +14 -0
- data/features/support/env.rb +57 -0
- data/features/support/factory_girl.rb +1 -0
- data/lib/socializer.rb +4 -0
- data/lib/socializer/engine.rb +27 -0
- data/lib/socializer/version.rb +3 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/socializer_tasks.rake +4 -0
- data/script/cucumber +10 -0
- data/socializer.gemspec +49 -0
- data/spec/controllers/socializer/likes_controller_spec.rb +29 -0
- data/spec/controllers/socializer/shares_controller_spec.rb +22 -0
- data/spec/factories/socializer_activities.rb +11 -0
- data/spec/factories/socializer_activity_fields.rb +8 -0
- data/spec/factories/socializer_activity_objects.rb +7 -0
- data/spec/factories/socializer_audiences.rb +9 -0
- data/spec/factories/socializer_authentications.rb +6 -0
- data/spec/factories/socializer_circles.rb +9 -0
- data/spec/factories/socializer_comments.rb +6 -0
- data/spec/factories/socializer_group_categories.rb +8 -0
- data/spec/factories/socializer_group_links.rb +9 -0
- data/spec/factories/socializer_groups.rb +9 -0
- data/spec/factories/socializer_identities.rb +10 -0
- data/spec/factories/socializer_memberships.rb +6 -0
- data/spec/factories/socializer_notes.rb +7 -0
- data/spec/factories/socializer_notifications.rb +10 -0
- data/spec/factories/socializer_people.rb +7 -0
- data/spec/factories/socializer_person_addresses.rb +8 -0
- data/spec/factories/socializer_person_contributions.rb +9 -0
- data/spec/factories/socializer_person_educations.rb +7 -0
- data/spec/factories/socializer_person_employments.rb +7 -0
- data/spec/factories/socializer_person_links.rb +9 -0
- data/spec/factories/socializer_person_phones.rb +9 -0
- data/spec/factories/socializer_person_places.rb +8 -0
- data/spec/factories/socializer_person_profiles.rb +9 -0
- data/spec/factories/socializer_ties.rb +6 -0
- data/spec/factories/socializer_verbs.rb +7 -0
- data/spec/inflector_spec.rb +19 -0
- data/spec/models/socializer/activity_field_spec.rb +25 -0
- data/spec/models/socializer/activity_object_spec.rb +118 -0
- data/spec/models/socializer/activity_spec.rb +16 -0
- data/spec/models/socializer/audience_spec.rb +32 -0
- data/spec/models/socializer/authentication_spec.rb +29 -0
- data/spec/models/socializer/circle_spec.rb +53 -0
- data/spec/models/socializer/comment_spec.rb +19 -0
- data/spec/models/socializer/group_category_spec.rb +23 -0
- data/spec/models/socializer/group_link_spec.rb +25 -0
- data/spec/models/socializer/group_spec.rb +218 -0
- data/spec/models/socializer/identity_spec.rb +32 -0
- data/spec/models/socializer/membership_spec.rb +68 -0
- data/spec/models/socializer/note_spec.rb +19 -0
- data/spec/models/socializer/notification_spec.rb +28 -0
- data/spec/models/socializer/person_address_spec.rb +27 -0
- data/spec/models/socializer/person_contribution_spec.rb +27 -0
- data/spec/models/socializer/person_education_spec.rb +25 -0
- data/spec/models/socializer/person_employment_spec.rb +25 -0
- data/spec/models/socializer/person_link_spec.rb +26 -0
- data/spec/models/socializer/person_phone_spec.rb +28 -0
- data/spec/models/socializer/person_place_spec.rb +25 -0
- data/spec/models/socializer/person_profile_spec.rb +26 -0
- data/spec/models/socializer/person_spec.rb +105 -0
- data/spec/models/socializer/tie_spec.rb +24 -0
- data/spec/models/socializer/verb_spec.rb +24 -0
- data/spec/spec_helper.rb +84 -0
- data/vendor/assets/javascripts/moment/langs.js +5841 -0
- data/vendor/assets/javascripts/moment/moment.js +2400 -0
- metadata +754 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Comment do
|
5
|
+
let(:comment) { build(:socializer_comment) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(comment).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
it '#content' do
|
12
|
+
expect(comment).to respond_to(:content)
|
13
|
+
end
|
14
|
+
|
15
|
+
it '#author' do
|
16
|
+
expect(comment).to respond_to(:author)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe GroupCategory do
|
5
|
+
let(:group_category) { build(:socializer_group_category) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(group_category).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(group_category).to allow_mass_assignment_of(:name) }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'relationships' do
|
16
|
+
it { expect(group_category).to belong_to(:group) }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'validations' do
|
20
|
+
it { expect(group_category).to validate_presence_of(:name) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe GroupLink do
|
5
|
+
let(:group_link) { build(:socializer_group_link) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(group_link).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(group_link).to allow_mass_assignment_of(:label) }
|
13
|
+
it { expect(group_link).to allow_mass_assignment_of(:url) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'relationships' do
|
17
|
+
it { expect(group_link).to belong_to(:group) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'validations' do
|
21
|
+
it { expect(group_link).to validate_presence_of(:label) }
|
22
|
+
it { expect(group_link).to validate_presence_of(:url) }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,218 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Group do
|
5
|
+
let(:group) { build(:socializer_group) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(group).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(group).to allow_mass_assignment_of(:name) }
|
13
|
+
it { expect(group).to allow_mass_assignment_of(:privacy_level) }
|
14
|
+
it { expect(group).to allow_mass_assignment_of(:author_id) }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'relationships' do
|
18
|
+
it { expect(group).to belong_to(:activity_author) }
|
19
|
+
it { expect(group).to have_many(:memberships) }
|
20
|
+
it { expect(group).to have_many(:activity_members).through(:memberships).conditions(socializer_memberships: { active: true }) }
|
21
|
+
it { expect(group).to have_many(:links) }
|
22
|
+
it { expect(group).to have_many(:categories) }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'validations' do
|
26
|
+
# TODO: Update factory to include relationshp
|
27
|
+
# it { expect(group).to validate_presence_of(:activity_author) }
|
28
|
+
it { expect(group).to validate_presence_of(:author_id) }
|
29
|
+
it { expect(group).to validate_presence_of(:name) }
|
30
|
+
it { expect(group).to validate_presence_of(:privacy_level) }
|
31
|
+
it { expect(create(:socializer_group)).to validate_uniqueness_of(:name).scoped_to(:author_id) }
|
32
|
+
end
|
33
|
+
|
34
|
+
it { expect(enumerize(:privacy_level).in(:public, :restricted, :private).with_default(:public)) }
|
35
|
+
|
36
|
+
it '#author' do
|
37
|
+
expect(group).to respond_to(:author)
|
38
|
+
end
|
39
|
+
|
40
|
+
it '#members' do
|
41
|
+
expect(group).to respond_to(:members)
|
42
|
+
end
|
43
|
+
|
44
|
+
it '#join' do
|
45
|
+
expect(group).to respond_to(:join)
|
46
|
+
end
|
47
|
+
|
48
|
+
it '#invite' do
|
49
|
+
expect(group).to respond_to(:invite)
|
50
|
+
end
|
51
|
+
|
52
|
+
it '#leave' do
|
53
|
+
expect(group).to respond_to(:leave)
|
54
|
+
end
|
55
|
+
|
56
|
+
it '#member?' do
|
57
|
+
expect(group).to respond_to(:member?)
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'when group is public' do
|
61
|
+
let(:public_group) { create(:socializer_group, privacy_level: 1) }
|
62
|
+
let(:person) { create(:socializer_person) }
|
63
|
+
|
64
|
+
before do
|
65
|
+
public_group.save!
|
66
|
+
end
|
67
|
+
|
68
|
+
it '.public has 1 group' do
|
69
|
+
expect(Socializer::Group.public.size).to eq(1)
|
70
|
+
end
|
71
|
+
|
72
|
+
it '.joinable has 1 group' do
|
73
|
+
expect(Socializer::Group.joinable.size).to eq(1)
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'is has the right privacy level' do
|
77
|
+
expect(public_group.privacy_level.public?).to be_true
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'member? is false' do
|
81
|
+
expect(public_group.member?(person)).to be_false
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'and a person joins it' do
|
85
|
+
before do
|
86
|
+
public_group.join(person)
|
87
|
+
@membership = Membership.find_by(member_id: person.guid, group_id: public_group.id)
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'creates an active membership' do
|
91
|
+
expect(@membership.active).to be_true
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'member? is true' do
|
95
|
+
expect(public_group.member?(person)).to be_true
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'has 1 member' do
|
99
|
+
expect(public_group.members.size).to eq(1)
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'and leaving' do
|
103
|
+
before do
|
104
|
+
public_group.leave(person)
|
105
|
+
@membership = Membership.find_by(member_id: person.guid, group_id: public_group.id)
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'destroys the membership' do
|
109
|
+
expect(@membership).to be_nil
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'has 0 member' do
|
113
|
+
expect(public_group.members.size).to eq(0)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'when group is restricted' do
|
120
|
+
let(:restricted_group) { create(:socializer_group, privacy_level: 2) }
|
121
|
+
let(:person) { create(:socializer_person) }
|
122
|
+
|
123
|
+
before do
|
124
|
+
restricted_group.save!
|
125
|
+
end
|
126
|
+
|
127
|
+
it '.restricted has 1 group' do
|
128
|
+
expect(Socializer::Group.restricted.size).to eq(1)
|
129
|
+
end
|
130
|
+
|
131
|
+
it '.joinable has 1 group' do
|
132
|
+
expect(Socializer::Group.joinable.size).to eq(1)
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'is has the right privacy level' do
|
136
|
+
expect(restricted_group.privacy_level.restricted?).to be_true
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'and a person joins it' do
|
140
|
+
before do
|
141
|
+
restricted_group.join(person)
|
142
|
+
@membership = Membership.find_by(member_id: person.guid, group_id: restricted_group.id)
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'creates an inactive membership' do
|
146
|
+
expect(@membership.active).to be_false
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'when group is private' do
|
152
|
+
let(:private_group) { create(:socializer_group, privacy_level: 3) }
|
153
|
+
let(:person) { create(:socializer_person) }
|
154
|
+
|
155
|
+
before do
|
156
|
+
private_group.save!
|
157
|
+
end
|
158
|
+
|
159
|
+
it '.private has 1 group' do
|
160
|
+
expect(Socializer::Group.private.size).to eq(1)
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'is has the right privacy level' do
|
164
|
+
expect(private_group.privacy_level.private?).to be_true
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'cannot be joined' do
|
168
|
+
expect { private_group.join(person) }.to raise_error
|
169
|
+
end
|
170
|
+
|
171
|
+
context 'and a person gets invited' do
|
172
|
+
before do
|
173
|
+
private_group.invite(person)
|
174
|
+
@membership = Membership.find_by(member_id: person.guid, group_id: private_group.id)
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'creates an inactive membership' do
|
178
|
+
expect(@membership.active).to be_false
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context 'when inviting a person' do
|
184
|
+
let(:person) { create(:socializer_person) }
|
185
|
+
|
186
|
+
before do
|
187
|
+
group.invite(person)
|
188
|
+
@membership = Membership.find_by(member_id: person.guid, group_id: group.id)
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'creates an inactive membership' do
|
192
|
+
expect(@membership.active).to be_false
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'when having no member' do
|
197
|
+
let(:group_without_members) { create(:socializer_group, privacy_level: 3) }
|
198
|
+
|
199
|
+
before do
|
200
|
+
# the author is added as a member, so remove it first
|
201
|
+
group_without_members.memberships.first.destroy
|
202
|
+
end
|
203
|
+
|
204
|
+
it 'can be deleted' do
|
205
|
+
expect { group_without_members.destroy }.not_to raise_error
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
context 'when having at least one member' do
|
210
|
+
let(:group_with_members) { create(:socializer_group, privacy_level: 3) }
|
211
|
+
|
212
|
+
it 'cannot be deleted' do
|
213
|
+
expect { group_with_members.destroy }.to raise_error
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Identity do
|
5
|
+
let(:identity) { build(:socializer_identity) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(identity).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(identity).to allow_mass_assignment_of(:name) }
|
13
|
+
it { expect(identity).to allow_mass_assignment_of(:email) }
|
14
|
+
it { expect(identity).to allow_mass_assignment_of(:password) }
|
15
|
+
it { expect(identity).to allow_mass_assignment_of(:password_confirmation) }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'validations' do
|
19
|
+
it { expect(identity).to validate_presence_of(:name) }
|
20
|
+
it { expect(identity).to validate_presence_of(:email) }
|
21
|
+
it { expect(create(:socializer_identity)).to validate_uniqueness_of(:email) }
|
22
|
+
end
|
23
|
+
|
24
|
+
it '#password' do
|
25
|
+
expect(identity).to respond_to(:password)
|
26
|
+
end
|
27
|
+
|
28
|
+
it '#password_confirmation' do
|
29
|
+
expect(identity).to respond_to(:password_confirmation)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Membership do
|
5
|
+
let(:membership) { build(:socializer_membership) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(membership).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
it '#member' do
|
12
|
+
expect(membership).to respond_to(:member)
|
13
|
+
end
|
14
|
+
|
15
|
+
it '#group' do
|
16
|
+
expect(membership).to respond_to(:group)
|
17
|
+
end
|
18
|
+
|
19
|
+
it '#approve!' do
|
20
|
+
expect(membership).to respond_to(:approve!)
|
21
|
+
end
|
22
|
+
|
23
|
+
it '#confirm!' do
|
24
|
+
expect(membership).to respond_to(:confirm!)
|
25
|
+
end
|
26
|
+
|
27
|
+
it '#decline!' do
|
28
|
+
expect(membership).to respond_to(:decline!)
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when approved' do
|
32
|
+
let(:inactive_membership) { create(:socializer_membership, active: false) }
|
33
|
+
|
34
|
+
before do
|
35
|
+
inactive_membership.approve!
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'becomes active' do
|
39
|
+
expect(inactive_membership.active).to be_true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'when confirmed' do
|
44
|
+
let(:inactive_membership) { create(:socializer_membership, active: false) }
|
45
|
+
|
46
|
+
before do
|
47
|
+
inactive_membership.confirm!
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'becomes active' do
|
51
|
+
expect(inactive_membership.active).to be_true
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'when declined' do
|
56
|
+
let(:inactive_membership) { create(:socializer_membership, active: false) }
|
57
|
+
|
58
|
+
before do
|
59
|
+
inactive_membership.decline!
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'no longer exists' do
|
63
|
+
expect { inactive_membership.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Note do
|
5
|
+
let(:note) { build(:socializer_note) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(note).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
it '#content' do
|
12
|
+
expect(note).to respond_to(:content)
|
13
|
+
end
|
14
|
+
|
15
|
+
it '#author' do
|
16
|
+
expect(note).to respond_to(:author)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Notification do
|
5
|
+
|
6
|
+
# Define a person for common testd instead of build one for each
|
7
|
+
let(:notification) { build(:socializer_notification) }
|
8
|
+
|
9
|
+
it 'has a valid factory' do
|
10
|
+
expect(notification).to be_valid
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'mass assignment' do
|
14
|
+
it { expect(notification).to allow_mass_assignment_of(:read) }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'relationships' do
|
18
|
+
it { expect(notification).to belong_to(:activity) }
|
19
|
+
it { expect(notification).to belong_to(:activity_object) }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'validations' do
|
23
|
+
it { expect(notification).to validate_presence_of(:activity_id) }
|
24
|
+
it { expect(notification).to validate_presence_of(:activity_object_id) }
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe PersonAddress do
|
5
|
+
let(:person_address) { build(:socializer_person_address) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(person_address).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(person_address).to allow_mass_assignment_of(:line1) }
|
13
|
+
it { expect(person_address).to allow_mass_assignment_of(:line2) }
|
14
|
+
it { expect(person_address).to allow_mass_assignment_of(:city) }
|
15
|
+
it { expect(person_address).to allow_mass_assignment_of(:postal_code_or_zip) }
|
16
|
+
it { expect(person_address).to allow_mass_assignment_of(:province_or_state) }
|
17
|
+
it { expect(person_address).to allow_mass_assignment_of(:country) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'relationships' do
|
21
|
+
it { expect(person_address).to belong_to(:person) }
|
22
|
+
end
|
23
|
+
|
24
|
+
it { expect(enumerize(:category).in(:home, :work).with_default(:home)) }
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|