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,10 @@
|
|
1
|
+
# Read about factories at https://github.com/thoughtbot/factory_girl
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :socializer_identity, class: Socializer::Identity do
|
5
|
+
sequence(:name) { |n| "name#{n}" }
|
6
|
+
sequence(:email) { |n| "name#{n}@example.com" }
|
7
|
+
sequence(:password) { |n| 'foobar' }
|
8
|
+
sequence(:password_confirmation) { |n| 'foobar' }
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Read about factories at https://github.com/thoughtbot/factory_girl
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :socializer_notification, class: Socializer::Notification do
|
5
|
+
read false
|
6
|
+
|
7
|
+
association :activity_object, factory: :socializer_activity_object
|
8
|
+
association :activity, factory: :socializer_activity
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveSupport::Inflector::Inflections do
|
4
|
+
context 'singularize' do
|
5
|
+
it 'should return the singular form of a word' do
|
6
|
+
expect('ties'.singularize(:en)).to eq('tie')
|
7
|
+
expect('Ties'.singularize(:en)).to eq('Tie')
|
8
|
+
expect('activities'.singularize(:en)).to eq('activity')
|
9
|
+
expect('Activities'.singularize(:en)).to eq('Activity')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should not alter an already singular word' do
|
13
|
+
expect('tie'.singularize(:en)).to eq('tie')
|
14
|
+
expect('Tie'.singularize(:en)).to eq('Tie')
|
15
|
+
expect('activity'.singularize(:en)).to eq('activity')
|
16
|
+
expect('Activity'.singularize(:en)).to eq('Activity')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe ActivityField do
|
5
|
+
let(:activity_field) { build(:socializer_activity_field) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(activity_field).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(activity_field).to allow_mass_assignment_of(:content) }
|
13
|
+
it { expect(activity_field).to allow_mass_assignment_of(:activity) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'relationships' do
|
17
|
+
it { expect(activity_field).to belong_to(:activity) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'validations' do
|
21
|
+
it { expect(activity_field).to validate_presence_of(:content) }
|
22
|
+
it { expect(activity_field).to validate_presence_of(:activity) }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe ActivityObject do
|
5
|
+
let(:activity_object) { build(:socializer_activity_object) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(activity_object).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(activity_object).to allow_mass_assignment_of(:scope) }
|
13
|
+
it { expect(activity_object).to allow_mass_assignment_of(:object_ids) }
|
14
|
+
it { expect(activity_object).to allow_mass_assignment_of(:activitable_id) }
|
15
|
+
it { expect(activity_object).to allow_mass_assignment_of(:activitable_type) }
|
16
|
+
it { expect(activity_object).to allow_mass_assignment_of(:like_count) }
|
17
|
+
it { expect(activity_object).to allow_mass_assignment_of(:unread_notifications_count) }
|
18
|
+
it { expect(activity_object).to allow_mass_assignment_of(:object_ids) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'relationships' do
|
22
|
+
it { expect(activity_object).to belong_to(:activitable) }
|
23
|
+
it { expect(activity_object).to have_many(:notifications) }
|
24
|
+
it { expect(activity_object).to have_many(:audiences) }
|
25
|
+
it { expect(activity_object).to have_many(:activities) }
|
26
|
+
it { expect(activity_object).to have_many(:actor_activities) }
|
27
|
+
it { expect(activity_object).to have_many(:object_activities) }
|
28
|
+
it { expect(activity_object).to have_many(:target_activities) }
|
29
|
+
it { expect(activity_object).to have_many(:notes) }
|
30
|
+
it { expect(activity_object).to have_many(:comments) }
|
31
|
+
it { expect(activity_object).to have_many(:groups) }
|
32
|
+
it { expect(activity_object).to have_many(:circles) }
|
33
|
+
it { expect(activity_object).to have_many(:ties) }
|
34
|
+
it { expect(activity_object).to have_many(:memberships) }
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when liked' do
|
38
|
+
let(:liking_person) { create(:socializer_person) }
|
39
|
+
let(:liked_activity_object) { create(:socializer_activity_object) }
|
40
|
+
|
41
|
+
before do
|
42
|
+
liked_activity_object.like! liking_person
|
43
|
+
liked_activity_object.reload
|
44
|
+
end
|
45
|
+
|
46
|
+
it { expect(liked_activity_object.like_count).to eq(1) }
|
47
|
+
# it { expect(liked_activity_object.likes.size).to eq(1) }
|
48
|
+
|
49
|
+
context 'and unliked' do
|
50
|
+
before do
|
51
|
+
liked_activity_object.unlike! liking_person
|
52
|
+
liked_activity_object.reload
|
53
|
+
end
|
54
|
+
|
55
|
+
it { expect(liked_activity_object.like_count).to eq(0) }
|
56
|
+
# it { expect(liked_activity_object.likes.size).to eq(0) }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it '#scope' do
|
61
|
+
expect(activity_object).to respond_to(:scope)
|
62
|
+
end
|
63
|
+
|
64
|
+
it '#like_count' do
|
65
|
+
expect(activity_object).to respond_to(:like_count)
|
66
|
+
end
|
67
|
+
|
68
|
+
it '#note?' do
|
69
|
+
expect(activity_object).to respond_to(:note?)
|
70
|
+
end
|
71
|
+
|
72
|
+
it '#activity?' do
|
73
|
+
expect(activity_object).to respond_to(:activity?)
|
74
|
+
end
|
75
|
+
|
76
|
+
it '#comment?' do
|
77
|
+
expect(activity_object).to respond_to(:comment?)
|
78
|
+
end
|
79
|
+
|
80
|
+
it '#person?' do
|
81
|
+
expect(activity_object).to respond_to(:person?)
|
82
|
+
end
|
83
|
+
|
84
|
+
it '#group?' do
|
85
|
+
expect(activity_object).to respond_to(:group?)
|
86
|
+
end
|
87
|
+
|
88
|
+
it '#circle?' do
|
89
|
+
expect(activity_object).to respond_to(:circle?)
|
90
|
+
end
|
91
|
+
|
92
|
+
it '#likes' do
|
93
|
+
expect(activity_object).to respond_to(:likes)
|
94
|
+
end
|
95
|
+
|
96
|
+
it '#like!' do
|
97
|
+
expect(activity_object).to respond_to(:like!)
|
98
|
+
end
|
99
|
+
|
100
|
+
it '#unlike!' do
|
101
|
+
expect(activity_object).to respond_to(:unlike!)
|
102
|
+
end
|
103
|
+
|
104
|
+
it '#share!' do
|
105
|
+
expect(activity_object).to respond_to(:share!)
|
106
|
+
end
|
107
|
+
|
108
|
+
%w(Person Activity Note Comment Group Circle).each do |type|
|
109
|
+
|
110
|
+
it sprintf('is type of %s', type) do
|
111
|
+
activity_object.activitable_type = "Socializer::#{type}"
|
112
|
+
expect(activity_object.send("#{type.downcase}?")).to be_true
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Activity do
|
5
|
+
let(:activity) { build(:socializer_activity) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(activity).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'relationships' do
|
12
|
+
it { expect(activity).to have_many(:notifications) }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Audience do
|
5
|
+
let(:audience) { build(:socializer_audience) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(audience).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(audience).to allow_mass_assignment_of(:activity_id) }
|
13
|
+
it { expect(audience).to allow_mass_assignment_of(:privacy_level) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'relationships' do
|
17
|
+
it { expect(audience).to belong_to(:activity) }
|
18
|
+
it { expect(audience).to belong_to(:activity_object) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'validations' do
|
22
|
+
it { expect(audience).to validate_presence_of(:privacy_level) }
|
23
|
+
it { expect(create(:socializer_audience)).to validate_uniqueness_of(:activity_id).scoped_to(:activity_object_id) }
|
24
|
+
end
|
25
|
+
|
26
|
+
it { expect(enumerize(:privacy_level).in(:public, :circles, :limited).with_default(:public)) }
|
27
|
+
|
28
|
+
it '#object' do
|
29
|
+
expect(audience).to respond_to(:object)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Authentication do
|
5
|
+
let(:authentication) { build(:socializer_authentication) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(authentication).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(authentication).to allow_mass_assignment_of(:provider) }
|
13
|
+
it { expect(authentication).to allow_mass_assignment_of(:uid) }
|
14
|
+
it { expect(authentication).to allow_mass_assignment_of(:image_url) }
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'relationships' do
|
18
|
+
it { expect(authentication).to belong_to(:person) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when last authentication for a person' do
|
22
|
+
let(:last_authentication) { create(:socializer_authentication) }
|
23
|
+
|
24
|
+
it 'cannot be deleted' do
|
25
|
+
expect { last_authentication.destroy }.to raise_error
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Socializer
|
4
|
+
describe Circle do
|
5
|
+
let(:circle) { build(:socializer_circle) }
|
6
|
+
|
7
|
+
it 'has a valid factory' do
|
8
|
+
expect(circle).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'mass assignment' do
|
12
|
+
it { expect(circle).to allow_mass_assignment_of(:name) }
|
13
|
+
it { expect(circle).to allow_mass_assignment_of(:content) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'relationships' do
|
17
|
+
it { expect(circle).to belong_to(:activity_author) }
|
18
|
+
it { expect(circle).to have_many(:ties) }
|
19
|
+
it { expect(circle).to have_many(:activity_contacts).through(:ties) }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'validations' do
|
23
|
+
it { expect(circle).to validate_presence_of(:name) }
|
24
|
+
it { expect(create(:socializer_circle, name: 'Family')).to validate_uniqueness_of(:name).scoped_to(:author_id) }
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when adding a contact' do
|
28
|
+
let(:circle_with_contacts) { create(:socializer_circle) }
|
29
|
+
|
30
|
+
before do
|
31
|
+
circle_with_contacts.add_contact(1)
|
32
|
+
circle_with_contacts.reload
|
33
|
+
end
|
34
|
+
|
35
|
+
it { expect(circle_with_contacts.ties.size).to be(1) }
|
36
|
+
it { expect(circle_with_contacts.contacts.size).to be(1) }
|
37
|
+
|
38
|
+
context 'and removing it' do
|
39
|
+
before do
|
40
|
+
circle_with_contacts.remove_contact(1)
|
41
|
+
circle_with_contacts.reload
|
42
|
+
end
|
43
|
+
|
44
|
+
it { expect(circle_with_contacts.ties.size).to be(0) }
|
45
|
+
it { expect(circle_with_contacts.contacts.size).to be(0) }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it '#author' do
|
50
|
+
expect(circle).to respond_to(:author)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|