inkwell 1.2.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. data/app/models/inkwell/community_user.rb +15 -0
  2. data/app/models/inkwell/following.rb +8 -0
  3. data/db/migrate/20130212130888_refactor_followings_relation.rb +27 -0
  4. data/db/migrate/20130212130898_refactor_user_community_relation.rb +72 -0
  5. data/db/migrate/20130212130908_refactor_invites_bans_mutes.rb +48 -0
  6. data/lib/acts_as_inkwell_community/base.rb +185 -180
  7. data/lib/acts_as_inkwell_user/base.rb +72 -30
  8. data/lib/common/base.rb +21 -0
  9. data/lib/inkwell/version.rb +1 -1
  10. data/test/dummy/db/development.sqlite3 +0 -0
  11. data/test/dummy/db/migrate/20130227154519_refactor_followings_relation.inkwell.rb +28 -0
  12. data/test/dummy/db/migrate/20130228115224_refactor_user_community_relation.inkwell.rb +73 -0
  13. data/test/dummy/db/migrate/20130312084529_refactor_invites_bans_mutes.inkwell.rb +49 -0
  14. data/test/dummy/db/schema.rb +33 -12
  15. data/test/dummy/db/test.sqlite3 +0 -0
  16. data/test/dummy/log/development.log +1986 -0
  17. data/test/dummy/log/test.log +0 -0
  18. data/test/dummy/spec/functional/community_spec.rb +513 -196
  19. data/test/dummy/spec/functional/following_spec.rb +55 -7
  20. data/test/dummy_without_community/db/development.sqlite3 +0 -0
  21. data/test/dummy_without_community/db/migrate/20130313083915_refactor_followings_relation.inkwell.rb +28 -0
  22. data/test/dummy_without_community/db/migrate/20130313083916_refactor_user_community_relation.inkwell.rb +73 -0
  23. data/test/dummy_without_community/db/migrate/20130313083917_refactor_invites_bans_mutes.inkwell.rb +49 -0
  24. data/test/dummy_without_community/db/schema.rb +12 -5
  25. data/test/dummy_without_community/db/test.sqlite3 +0 -0
  26. data/test/dummy_without_community/log/development.log +78 -0
  27. data/test/dummy_without_community/log/test.log +12652 -0
  28. data/test/dummy_without_community/spec/functional/following_spec.rb +20 -7
  29. metadata +31 -14
@@ -21,10 +21,15 @@ describe "Following" do
21
21
  @salkar.follow @morozovm
22
22
  @salkar.reload
23
23
  @morozovm.reload
24
- @salkar.followings_ids.should == "[#{@morozovm.id}]"
24
+ @morozovm.followings_row.should == []
25
+ @morozovm.followers_row.should == [@salkar.id]
26
+ @morozovm.follower_count.should == 1
27
+ @morozovm.following_count.should == 0
28
+ @salkar.follower_count.should == 0
29
+ @salkar.following_count.should == 1
25
30
  @salkar.followings_row.should == [@morozovm.id]
26
- @salkar.followers_ids.should == "[]"
27
31
  @salkar.followers_row.should == []
32
+ ::Inkwell::Following.exists?(:follower_id => @salkar.id, :followed_id => @morozovm.id).should == true
28
33
 
29
34
  ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 4
30
35
  ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).find_by_item_id_and_item_type(@morozovm_post.id, ::Inkwell::Constants::ItemTypes::POST).should be
@@ -38,10 +43,6 @@ describe "Following" do
38
43
  end
39
44
 
40
45
  ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
41
- @morozovm.followers_ids.should == "[#{@salkar.id}]"
42
- @morozovm.followers_row.should == [@salkar.id]
43
- @morozovm.followings_ids.should == "[]"
44
- @morozovm.followings_row.should == []
45
46
  end
46
47
 
47
48
  it "created_at from blog_item should transferred to timeline_item for follower when he follow this user" do
@@ -59,8 +60,12 @@ describe "Following" do
59
60
  @morozovm.reload
60
61
  @salkar.follow?(@morozovm).should be
61
62
  @morozovm.follow?(@salkar).should == false
63
+ end
64
+
65
+ it "user should not follow already followed user" do
62
66
  @salkar.follow @morozovm
63
- @salkar.follow?(@morozovm).should be
67
+ @salkar.follow?(@morozovm).should == true
68
+ expect{@salkar.follow @morozovm}.to raise_error
64
69
  end
65
70
 
66
71
  it "user should not follow himself" do
@@ -75,6 +80,14 @@ describe "Following" do
75
80
  @salkar.reload
76
81
  ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
77
82
 
83
+ @salkar.followings_row.should == []
84
+ @salkar.followers_row.should == []
85
+ @morozovm.followings_row.should == []
86
+ @morozovm.followers_row.should == []
87
+ @salkar.follower_count.should == 0
88
+ @salkar.following_count.should == 0
89
+ @morozovm.follower_count.should == 0
90
+ @morozovm.following_count.should == 0
78
91
  end
79
92
 
80
93
  it "reblog should added to followers timeline when follow" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inkwell
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &79324780 !ruby/object:Gem::Requirement
16
+ requirement: &68819720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *79324780
24
+ version_requirements: *68819720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &79324050 !ruby/object:Gem::Requirement
27
+ requirement: &68818400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *79324050
35
+ version_requirements: *68818400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &79340440 !ruby/object:Gem::Requirement
38
+ requirement: &68817170 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *79340440
46
+ version_requirements: *68817170
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: database_cleaner
49
- requirement: &79339600 !ruby/object:Gem::Requirement
49
+ requirement: &68816570 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *79339600
57
+ version_requirements: *68816570
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sqlite3
60
- requirement: &79338890 !ruby/object:Gem::Requirement
60
+ requirement: &68834090 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *79338890
68
+ version_requirements: *68834090
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rails
71
- requirement: &79336950 !ruby/object:Gem::Requirement
71
+ requirement: &68832840 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 3.1.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *79336950
79
+ version_requirements: *68832840
80
80
  description: Inkwell provides simple way to add social networking features like comments,
81
81
  reblogs, favorites, following/followers, communities and timelines to your Ruby
82
82
  on Rails application.
@@ -94,6 +94,8 @@ files:
94
94
  - app/models/inkwell/timeline_item.rb
95
95
  - app/models/inkwell/blog_item.rb
96
96
  - app/models/inkwell/favorite_item.rb
97
+ - app/models/inkwell/community_user.rb
98
+ - app/models/inkwell/following.rb
97
99
  - app/models/inkwell/comment.rb
98
100
  - config/routes.rb
99
101
  - db/migrate/20121209121955_create_inkwell_blog_items.rb
@@ -101,14 +103,17 @@ files:
101
103
  - db/migrate/20130202130030_change_is_comment_to_item_type.rb
102
104
  - db/migrate/20121202140816_add_columns_to_posts.rb
103
105
  - db/migrate/20121202140510_create_inkwell_timeline_items.rb
106
+ - db/migrate/20130212130898_refactor_user_community_relation.rb
104
107
  - db/migrate/20130202130010_change_tables_for_communities.rb
105
108
  - db/migrate/20121209124435_add_columns_to_users.rb
106
109
  - db/migrate/20130212130868_rename_parent_id_to_parent_comment_id_in_comment_table.rb
107
110
  - db/migrate/20121209123557_create_inkwell_favorite_items.rb
111
+ - db/migrate/20130212130908_refactor_invites_bans_mutes.rb
108
112
  - db/migrate/20130212130858_refactor_comment_table.rb
109
113
  - db/migrate/20130202130020_add_community_ids_to_post.rb
110
114
  - db/migrate/20130202130040_add_owner_type_to_lines.rb
111
115
  - db/migrate/20130212130878_change_community_table_for_adding_types_and_user_access.rb
116
+ - db/migrate/20130212130888_refactor_followings_relation.rb
112
117
  - lib/inkwell/version.rb
113
118
  - lib/inkwell/engine.rb
114
119
  - lib/common/base.rb
@@ -172,6 +177,7 @@ files:
172
177
  - test/dummy_without_community/db/migrate/20130208134749_change_tables_for_communities.inkwell.rb
173
178
  - test/dummy_without_community/db/migrate/20130213115835_refactor_comment_table.inkwell.rb
174
179
  - test/dummy_without_community/db/migrate/20130208134745_create_inkwell_blog_items.inkwell.rb
180
+ - test/dummy_without_community/db/migrate/20130313083916_refactor_user_community_relation.inkwell.rb
175
181
  - test/dummy_without_community/db/migrate/20121202112556_create_users.rb
176
182
  - test/dummy_without_community/db/migrate/20130208134743_create_inkwell_timeline_items.inkwell.rb
177
183
  - test/dummy_without_community/db/migrate/20130208134748_create_inkwell_comments.inkwell.rb
@@ -181,7 +187,9 @@ files:
181
187
  - test/dummy_without_community/db/migrate/20130219152806_change_community_table_for_adding_types_and_user_access.inkwell.rb
182
188
  - test/dummy_without_community/db/migrate/20130208134746_create_inkwell_favorite_items.inkwell.rb
183
189
  - test/dummy_without_community/db/migrate/20121202111750_create_posts.rb
190
+ - test/dummy_without_community/db/migrate/20130313083915_refactor_followings_relation.inkwell.rb
184
191
  - test/dummy_without_community/db/migrate/20130208134750_add_community_ids_to_post.inkwell.rb
192
+ - test/dummy_without_community/db/migrate/20130313083917_refactor_invites_bans_mutes.inkwell.rb
185
193
  - test/dummy_without_community/db/migrate/20130208134747_add_columns_to_users.inkwell.rb
186
194
  - test/dummy_without_community/log/development.log
187
195
  - test/dummy_without_community/log/test.log
@@ -241,14 +249,17 @@ files:
241
249
  - test/dummy/db/schema.rb
242
250
  - test/dummy/db/seeds.rb
243
251
  - test/dummy/db/test.sqlite3
252
+ - test/dummy/db/migrate/20130312084529_refactor_invites_bans_mutes.inkwell.rb
244
253
  - test/dummy/db/migrate/20130208134951_create_inkwell_favorite_items.inkwell.rb
245
254
  - test/dummy/db/migrate/20130208134949_add_columns_to_posts.inkwell.rb
246
255
  - test/dummy/db/migrate/20130208134955_add_community_ids_to_post.inkwell.rb
256
+ - test/dummy/db/migrate/20130227154519_refactor_followings_relation.inkwell.rb
247
257
  - test/dummy/db/migrate/20130213101736_refactor_comment_table.inkwell.rb
248
258
  - test/dummy/db/migrate/20121202112556_create_users.rb
249
259
  - test/dummy/db/migrate/20130208134952_add_columns_to_users.inkwell.rb
250
260
  - test/dummy/db/migrate/20130212130848_add_owner_type_to_lines.inkwell.rb
251
261
  - test/dummy/db/migrate/20130213121414_rename_parent_id_to_parent_comment_id_in_comment_table.inkwell.rb
262
+ - test/dummy/db/migrate/20130228115224_refactor_user_community_relation.inkwell.rb
252
263
  - test/dummy/db/migrate/20130217135512_change_community_table_for_adding_types_and_user_access.inkwell.rb
253
264
  - test/dummy/db/migrate/20130208134954_change_tables_for_communities.inkwell.rb
254
265
  - test/dummy/db/migrate/20130201155147_create_communities.rb
@@ -344,6 +355,7 @@ test_files:
344
355
  - test/dummy_without_community/db/migrate/20130208134749_change_tables_for_communities.inkwell.rb
345
356
  - test/dummy_without_community/db/migrate/20130213115835_refactor_comment_table.inkwell.rb
346
357
  - test/dummy_without_community/db/migrate/20130208134745_create_inkwell_blog_items.inkwell.rb
358
+ - test/dummy_without_community/db/migrate/20130313083916_refactor_user_community_relation.inkwell.rb
347
359
  - test/dummy_without_community/db/migrate/20121202112556_create_users.rb
348
360
  - test/dummy_without_community/db/migrate/20130208134743_create_inkwell_timeline_items.inkwell.rb
349
361
  - test/dummy_without_community/db/migrate/20130208134748_create_inkwell_comments.inkwell.rb
@@ -353,7 +365,9 @@ test_files:
353
365
  - test/dummy_without_community/db/migrate/20130219152806_change_community_table_for_adding_types_and_user_access.inkwell.rb
354
366
  - test/dummy_without_community/db/migrate/20130208134746_create_inkwell_favorite_items.inkwell.rb
355
367
  - test/dummy_without_community/db/migrate/20121202111750_create_posts.rb
368
+ - test/dummy_without_community/db/migrate/20130313083915_refactor_followings_relation.inkwell.rb
356
369
  - test/dummy_without_community/db/migrate/20130208134750_add_community_ids_to_post.inkwell.rb
370
+ - test/dummy_without_community/db/migrate/20130313083917_refactor_invites_bans_mutes.inkwell.rb
357
371
  - test/dummy_without_community/db/migrate/20130208134747_add_columns_to_users.inkwell.rb
358
372
  - test/dummy_without_community/log/development.log
359
373
  - test/dummy_without_community/log/test.log
@@ -413,14 +427,17 @@ test_files:
413
427
  - test/dummy/db/schema.rb
414
428
  - test/dummy/db/seeds.rb
415
429
  - test/dummy/db/test.sqlite3
430
+ - test/dummy/db/migrate/20130312084529_refactor_invites_bans_mutes.inkwell.rb
416
431
  - test/dummy/db/migrate/20130208134951_create_inkwell_favorite_items.inkwell.rb
417
432
  - test/dummy/db/migrate/20130208134949_add_columns_to_posts.inkwell.rb
418
433
  - test/dummy/db/migrate/20130208134955_add_community_ids_to_post.inkwell.rb
434
+ - test/dummy/db/migrate/20130227154519_refactor_followings_relation.inkwell.rb
419
435
  - test/dummy/db/migrate/20130213101736_refactor_comment_table.inkwell.rb
420
436
  - test/dummy/db/migrate/20121202112556_create_users.rb
421
437
  - test/dummy/db/migrate/20130208134952_add_columns_to_users.inkwell.rb
422
438
  - test/dummy/db/migrate/20130212130848_add_owner_type_to_lines.inkwell.rb
423
439
  - test/dummy/db/migrate/20130213121414_rename_parent_id_to_parent_comment_id_in_comment_table.inkwell.rb
440
+ - test/dummy/db/migrate/20130228115224_refactor_user_community_relation.inkwell.rb
424
441
  - test/dummy/db/migrate/20130217135512_change_community_table_for_adding_types_and_user_access.inkwell.rb
425
442
  - test/dummy/db/migrate/20130208134954_change_tables_for_communities.inkwell.rb
426
443
  - test/dummy/db/migrate/20130201155147_create_communities.rb