inkwell 1.0.5 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/app/models/inkwell/blog_item.rb +1 -1
  2. data/app/models/inkwell/comment.rb +22 -24
  3. data/app/models/inkwell/favorite_item.rb +1 -2
  4. data/app/models/inkwell/timeline_item.rb +1 -2
  5. data/db/migrate/20130202130030_change_is_comment_to_item_type.rb +18 -0
  6. data/db/migrate/20130202130040_add_owner_type_to_lines.rb +16 -0
  7. data/db/migrate/20130212130858_refactor_comment_table.rb +7 -0
  8. data/db/migrate/20130212130868_rename_parent_id_to_parent_comment_id_in_comment_table.rb +5 -0
  9. data/lib/acts_as_inkwell_community/base.rb +16 -16
  10. data/lib/acts_as_inkwell_post/base.rb +15 -14
  11. data/lib/acts_as_inkwell_user/base.rb +41 -34
  12. data/lib/common/base.rb +28 -4
  13. data/lib/inkwell/version.rb +1 -1
  14. data/test/dummy/db/development.sqlite3 +0 -0
  15. data/test/dummy/db/migrate/20130210231424_change_is_comment_to_item_type.inkwell.rb +19 -0
  16. data/test/dummy/db/migrate/20130212130848_add_owner_type_to_lines.inkwell.rb +17 -0
  17. data/test/dummy/db/migrate/20130213101736_refactor_comment_table.inkwell.rb +8 -0
  18. data/test/dummy/db/migrate/20130213121414_rename_parent_id_to_parent_comment_id_in_comment_table.inkwell.rb +6 -0
  19. data/test/dummy/db/schema.rb +14 -11
  20. data/test/dummy/db/test.sqlite3 +0 -0
  21. data/test/dummy/log/development.log +699 -0
  22. data/test/dummy/log/test.log +0 -0
  23. data/test/dummy/spec/functional/blogline_spec.rb +7 -7
  24. data/test/dummy/spec/functional/comments_spec.rb +129 -132
  25. data/test/dummy/spec/functional/community_spec.rb +119 -120
  26. data/test/dummy/spec/functional/favorite_spec.rb +27 -27
  27. data/test/dummy/spec/functional/following_spec.rb +26 -26
  28. data/test/dummy/spec/functional/reblog_spec.rb +32 -32
  29. data/test/dummy/spec/functional/timeline_spec.rb +1 -1
  30. data/test/dummy_without_community/db/development.sqlite3 +0 -0
  31. data/test/dummy_without_community/db/migrate/20130213115833_change_is_comment_to_item_type.inkwell.rb +19 -0
  32. data/test/dummy_without_community/db/migrate/20130213115834_add_owner_type_to_lines.inkwell.rb +17 -0
  33. data/test/dummy_without_community/db/migrate/20130213115835_refactor_comment_table.inkwell.rb +8 -0
  34. data/test/dummy_without_community/db/schema.rb +13 -10
  35. data/test/dummy_without_community/db/test.sqlite3 +0 -0
  36. data/test/dummy_without_community/log/development.log +111 -0
  37. data/test/dummy_without_community/log/test.log +11393 -0
  38. data/test/dummy_without_community/spec/functional/blogline_spec.rb +7 -7
  39. data/test/dummy_without_community/spec/functional/comments_spec.rb +128 -131
  40. data/test/dummy_without_community/spec/functional/favorite_spec.rb +27 -27
  41. data/test/dummy_without_community/spec/functional/following_spec.rb +26 -26
  42. data/test/dummy_without_community/spec/functional/reblog_spec.rb +32 -32
  43. data/test/dummy_without_community/spec/functional/timeline_spec.rb +1 -1
  44. metadata +32 -14
Binary file
@@ -9,13 +9,13 @@ describe "BlogLine" do
9
9
  end
10
10
 
11
11
  it "blogitem record should been created for new post" do
12
- ::Inkwell::BlogItem.where(:owner_id => @salkar.id, :is_owner_user => true).size.should == 1
13
- item = ::Inkwell::BlogItem.where(:owner_id => @salkar.id, :is_owner_user => true).first
12
+ ::Inkwell::BlogItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
13
+ item = ::Inkwell::BlogItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
14
14
  item.owner_id.should == @salkar.id
15
- item.is_owner_user.should be
15
+ item.owner_type.should == ::Inkwell::Constants::OwnerTypes::USER
16
16
  item.item_id.should == @salkar_post.id
17
17
  item.is_reblog.should == false
18
- item.is_comment.should == false
18
+ item.item_type.should == ::Inkwell::Constants::ItemTypes::POST
19
19
  end
20
20
 
21
21
  it "timeline items should been created for followers for new post" do
@@ -23,8 +23,8 @@ describe "BlogLine" do
23
23
  @morozovm.follow @salkar
24
24
  @talisman.follow @salkar
25
25
  @salkar_post1 = @salkar.posts.create :body => "salkar_post_test_body"
26
- ::Inkwell::TimelineItem.where(:user_id => @morozovm.id, :is_comment => false, :item_id => @salkar_post1.id).size.should == 1
27
- ::Inkwell::TimelineItem.where(:user_id => @talisman.id, :is_comment => false, :item_id => @salkar_post1.id).size.should == 1
26
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER, :item_type => ::Inkwell::Constants::ItemTypes::POST, :item_id => @salkar_post1.id).size.should == 1
27
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER, :item_type => ::Inkwell::Constants::ItemTypes::POST, :item_id => @salkar_post1.id).size.should == 1
28
28
  end
29
29
 
30
30
  it "user should have blogline with reblogs and his posts" do
@@ -58,7 +58,7 @@ describe "BlogLine" do
58
58
  bline[2].is_reblogged.should == true
59
59
  bline[2].is_favorited.should == true
60
60
  bline[2].is_reblog_in_blogline.should == false
61
- bline[2].item_id_in_line.should == ::Inkwell::BlogItem.where(:item_id => @salkar_post9.id, :is_comment => false).first.id
61
+ bline[2].item_id_in_line.should == ::Inkwell::BlogItem.where(:item_id => @salkar_post9.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first.id
62
62
  bline[3].should == @salkar_post8
63
63
  bline[4].should == @salkar_post7
64
64
  bline[5].should == @salkar_post6
@@ -10,19 +10,20 @@ describe "Comments" do
10
10
 
11
11
  it "comments should be available for user and post" do
12
12
  @salkar.comments.should == []
13
- @salkar_post.comments.should == []
13
+ ::Inkwell::Comment.where(:topmost_obj_id => @salkar_post.id, :topmost_obj_type => ::Inkwell::Constants::ItemTypes::POST).should == []
14
14
  end
15
15
 
16
16
  it "comment should been created" do
17
17
  @salkar.comments.size.should == 0
18
- comment = @salkar.comments.create :post_id => @salkar_post.id, :body => "salkar_comment_body"
18
+ comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
19
19
  @salkar.comments.size.should == 1
20
- @salkar_post.comments.size.should == 1
21
- @salkar.comments.should == @salkar_post.comments
20
+ ::Inkwell::Comment.where(:topmost_obj_id => @salkar_post.id, :topmost_obj_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
21
+ @salkar.comments.should == ::Inkwell::Comment.where(:topmost_obj_id => @salkar_post.id, :topmost_obj_type => ::Inkwell::Constants::ItemTypes::POST)
22
22
  comment.id.should be
23
23
  comment.body.should be
24
24
  comment.user.should == @salkar
25
- comment.post.should == @salkar_post
25
+ comment.topmost_obj_id.should == @salkar_post.id
26
+ comment.topmost_obj_type.should == ::Inkwell::Constants::ItemTypes::POST
26
27
  comment.users_ids_who_favorite_it.should == "[]"
27
28
  comment.users_ids_who_comment_it.should == "[]"
28
29
  comment.users_ids_who_reblog_it.should == "[]"
@@ -32,27 +33,23 @@ describe "Comments" do
32
33
  end
33
34
 
34
35
  it "comment should not been created" do
35
- post = @salkar.comments.create :post_id => @salkar_post.id
36
- post.id.should == nil
37
- post = @salkar.comments.create :body => "salkar_comment_body"
38
- post.id.should == nil
39
- post = @salkar_post.comments.create :body => "salkar_comment_body"
40
- post.id.should == nil
36
+ expect{@salkar.create_comment :for_object => @salkar_post}.to raise_error
37
+ expect{@salkar.create_comment :body => "salkar_comment_body"}.to raise_error
41
38
  end
42
39
 
43
40
  it "10 comments for main post should been received" do
44
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
45
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
46
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
47
- @comment3 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
48
- @comment4 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
49
- @comment5 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
50
- @comment6 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
51
- @comment7 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
52
- @comment8 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
53
- @comment9 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
54
- @comment10 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
55
- @comment11 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
41
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
42
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
43
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
44
+ @comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
45
+ @comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
46
+ @comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
47
+ @comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
48
+ @comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
49
+ @comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
50
+ @comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
51
+ @comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
52
+ @comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
56
53
 
57
54
  commentline = @salkar_post.commentline
58
55
  commentline.size.should == 10
@@ -67,18 +64,18 @@ describe "Comments" do
67
64
  end
68
65
 
69
66
  it "5 comments for main post should been received" do
70
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
71
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
72
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
73
- @comment3 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment1.id)
74
- @comment4 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
75
- @comment5 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
76
- @comment6 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
77
- @comment7 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
78
- @comment8 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
79
- @comment9 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
80
- @comment10 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
81
- @comment11 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
67
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
68
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
69
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
70
+ @comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment1.id)
71
+ @comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
72
+ @comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
73
+ @comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
74
+ @comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
75
+ @comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
76
+ @comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
77
+ @comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
78
+ @comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
82
79
 
83
80
  commentline = @salkar_post.commentline :limit => 5
84
81
  commentline.size.should == 5
@@ -97,17 +94,17 @@ describe "Comments" do
97
94
  end
98
95
 
99
96
  it "comments should been deleted when parent post destroyed" do
100
- @salkar_comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
101
- @morozovm_comment = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
102
- @salkar_post.comments.size.should == 2
97
+ @salkar_comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
98
+ @morozovm_comment = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
99
+ ::Inkwell::Comment.where(:topmost_obj_id => @salkar_post.id, :topmost_obj_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 2
103
100
  ::Inkwell::Comment.all.size.should == 2
104
101
  @salkar_post.destroy
105
102
  ::Inkwell::Comment.all.size.should == 0
106
103
  end
107
104
 
108
- it "2 comments with parent_id should been created" do
109
- @salkar_comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
110
- @morozovm_comment = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @salkar_comment.id)
105
+ it "2 comments with parent_comment_id should been created" do
106
+ @salkar_comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
107
+ @morozovm_comment = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @salkar_comment.id)
111
108
  @salkar_comment = ::Inkwell::Comment.find @salkar_comment
112
109
  @morozovm_comment = ::Inkwell::Comment.find @morozovm_comment
113
110
  @salkar_post.reload
@@ -121,13 +118,13 @@ describe "Comments" do
121
118
  end
122
119
 
123
120
  it "7 comments should been created" do
124
- @salkar_comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
125
- @morozovm_comment = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @salkar_comment.id)
126
- @salkar_comment1 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
127
- @morozovm_comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @salkar_comment.id)
128
- @salkar_comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
129
- @morozovm_comment2 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @salkar_comment.id)
130
- @salkar_comment3 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
121
+ @salkar_comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
122
+ @morozovm_comment = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @salkar_comment.id)
123
+ @salkar_comment1 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
124
+ @morozovm_comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @salkar_comment.id)
125
+ @salkar_comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
126
+ @morozovm_comment2 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @salkar_comment.id)
127
+ @salkar_comment3 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
131
128
  @salkar_post.reload
132
129
  users_ids_who_comment_it = ActiveSupport::JSON.decode(@salkar_post.users_ids_who_comment_it)
133
130
  users_ids_who_comment_it.size.should == 7
@@ -150,14 +147,14 @@ describe "Comments" do
150
147
  end
151
148
 
152
149
  it "1 comments should been deleted from post" do
153
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
150
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
154
151
  @salkar_post.reload
155
152
  users_ids_who_comment_it = ActiveSupport::JSON.decode(@salkar_post.users_ids_who_comment_it)
156
153
  users_ids_who_comment_it.should == [{"user_id"=>@salkar.id, "comment_id"=>@comment.id}]
157
- ::Inkwell::TimelineItem.create :item_id => @comment.id, :user_id => @morozovm.id, :is_comment => true
158
- ::Inkwell::FavoriteItem.create :item_id => @comment.id, :user_id => @salkar.id, :is_comment => true
159
- ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @morozovm.id, :is_owner_user => true, :is_comment => true
160
- ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :is_owner_user => true, :is_comment => true
154
+ ::Inkwell::TimelineItem.create :item_id => @comment.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
155
+ ::Inkwell::FavoriteItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
156
+ ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
157
+ ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
161
158
  ::Inkwell::FavoriteItem.all.size.should == 1
162
159
  ::Inkwell::TimelineItem.all.size.should == 1
163
160
  ::Inkwell::BlogItem.all.size.should == 3
@@ -174,18 +171,18 @@ describe "Comments" do
174
171
  end
175
172
 
176
173
  it "1 comments should been deleted from post with parent comment" do
177
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
178
- @comment_to_delete = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
174
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
175
+ @comment_to_delete = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
179
176
  @salkar_post.reload
180
177
  users_ids_who_comment_it = ActiveSupport::JSON.decode(@salkar_post.users_ids_who_comment_it)
181
178
  users_ids_who_comment_it.should == [{"user_id" => @salkar.id, "comment_id" => @comment.id}, {"user_id" => @morozovm.id, "comment_id" => @comment_to_delete.id}]
182
- ::Inkwell::TimelineItem.create :item_id => @comment_to_delete.id, :user_id => @morozovm.id, :is_comment => true
183
- ::Inkwell::FavoriteItem.create :item_id => @comment_to_delete.id, :user_id => @salkar.id, :is_comment => true
184
- ::Inkwell::TimelineItem.create :item_id => @comment.id, :user_id => @morozovm.id, :is_comment => true
185
- ::Inkwell::FavoriteItem.create :item_id => @comment.id, :user_id => @salkar.id, :is_comment => true
186
- ::Inkwell::BlogItem.create :item_id => @comment_to_delete.id, :owner_id => @morozovm.id, :is_owner_user => true, :is_comment => true
187
- ::Inkwell::BlogItem.create :item_id => @comment_to_delete.id, :owner_id => @salkar.id, :is_owner_user => true, :is_comment => true
188
- ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :is_owner_user => true, :is_comment => true
179
+ ::Inkwell::TimelineItem.create :item_id => @comment_to_delete.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
180
+ ::Inkwell::FavoriteItem.create :item_id => @comment_to_delete.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
181
+ ::Inkwell::TimelineItem.create :item_id => @comment.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
182
+ ::Inkwell::FavoriteItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
183
+ ::Inkwell::BlogItem.create :item_id => @comment_to_delete.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
184
+ ::Inkwell::BlogItem.create :item_id => @comment_to_delete.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
185
+ ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
189
186
  ::Inkwell::FavoriteItem.all.size.should == 2
190
187
  ::Inkwell::TimelineItem.all.size.should == 2
191
188
  ::Inkwell::BlogItem.all.size.should == 4
@@ -205,18 +202,18 @@ describe "Comments" do
205
202
  end
206
203
 
207
204
  it "2 comments should been deleted from post with parent comment" do
208
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
209
- @comment2 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
205
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
206
+ @comment2 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
210
207
  @salkar_post.reload
211
208
  users_ids_who_comment_it = ActiveSupport::JSON.decode(@salkar_post.users_ids_who_comment_it)
212
209
  users_ids_who_comment_it.should == [{"user_id" => @salkar.id, "comment_id" => @comment.id}, {"user_id" => @morozovm.id, "comment_id" => @comment2.id}]
213
- ::Inkwell::TimelineItem.create :item_id => @comment2.id, :user_id => @morozovm.id, :is_comment => true
214
- ::Inkwell::FavoriteItem.create :item_id => @comment2.id, :user_id => @salkar.id, :is_comment => true
215
- ::Inkwell::TimelineItem.create :item_id => @comment.id, :user_id => @morozovm.id, :is_comment => true
216
- ::Inkwell::FavoriteItem.create :item_id => @comment.id, :user_id => @salkar.id, :is_comment => true
217
- ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @morozovm.id, :is_owner_user => true, :is_comment => true
218
- ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @salkar.id, :is_owner_user => true, :is_comment => true
219
- ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :is_owner_user => true, :is_comment => true
210
+ ::Inkwell::TimelineItem.create :item_id => @comment2.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
211
+ ::Inkwell::FavoriteItem.create :item_id => @comment2.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
212
+ ::Inkwell::TimelineItem.create :item_id => @comment.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
213
+ ::Inkwell::FavoriteItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
214
+ ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
215
+ ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
216
+ ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
220
217
  ::Inkwell::FavoriteItem.all.size.should == 2
221
218
  ::Inkwell::TimelineItem.all.size.should == 2
222
219
  ::Inkwell::BlogItem.all.size.should == 4
@@ -234,20 +231,20 @@ describe "Comments" do
234
231
  end
235
232
 
236
233
  it "4 comments should been deleted from post with parent comment" do
237
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
238
- @comment2 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
239
- @comment2 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment2.id)
240
- @comment3 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
234
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
235
+ @comment2 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
236
+ @comment2 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment2.id)
237
+ @comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
241
238
  @salkar_post.reload
242
239
  users_ids_who_comment_it = ActiveSupport::JSON.decode(@salkar_post.users_ids_who_comment_it)
243
240
  users_ids_who_comment_it.size.should == 4
244
- ::Inkwell::TimelineItem.create :item_id => @comment2.id, :user_id => @morozovm.id, :is_comment => true
245
- ::Inkwell::FavoriteItem.create :item_id => @comment2.id, :user_id => @salkar.id, :is_comment => true
246
- ::Inkwell::TimelineItem.create :item_id => @comment.id, :user_id => @morozovm.id, :is_comment => true
247
- ::Inkwell::FavoriteItem.create :item_id => @comment.id, :user_id => @salkar.id, :is_comment => true
248
- ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @morozovm.id, :is_owner_user => true, :is_comment => true
249
- ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @salkar.id, :is_owner_user => true, :is_comment => true
250
- ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :is_owner_user => true, :is_comment => true
241
+ ::Inkwell::TimelineItem.create :item_id => @comment2.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
242
+ ::Inkwell::FavoriteItem.create :item_id => @comment2.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
243
+ ::Inkwell::TimelineItem.create :item_id => @comment.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
244
+ ::Inkwell::FavoriteItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
245
+ ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @morozovm.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
246
+ ::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
247
+ ::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
251
248
  ::Inkwell::FavoriteItem.all.size.should == 2
252
249
  ::Inkwell::TimelineItem.all.size.should == 2
253
250
  ::Inkwell::BlogItem.all.size.should == 4
@@ -265,18 +262,18 @@ describe "Comments" do
265
262
  end
266
263
 
267
264
  it "commentline for comment should been returned (comments for 1 comment)" do
268
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
269
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
270
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
271
- @comment3 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
272
- @comment4 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
273
- @comment5 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
274
- @comment6 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
275
- @comment7 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
276
- @comment8 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
277
- @comment9 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
278
- @comment10 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
279
- @comment11 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
265
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
266
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
267
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
268
+ @comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
269
+ @comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
270
+ @comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
271
+ @comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
272
+ @comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
273
+ @comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
274
+ @comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
275
+ @comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
276
+ @comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
280
277
 
281
278
  @comment.reload
282
279
  commentline = @comment.commentline
@@ -291,18 +288,18 @@ describe "Comments" do
291
288
  end
292
289
 
293
290
  it "commentline for comment should been returned (comments for several comments)" do
294
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
295
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
296
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
297
- @comment3 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment1.id)
298
- @comment4 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment2.id)
299
- @comment5 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
300
- @comment6 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment3.id)
301
- @comment7 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment2.id)
302
- @comment8 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
303
- @comment9 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment5.id)
304
- @comment10 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment4.id)
305
- @comment11 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
291
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
292
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
293
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
294
+ @comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment1.id)
295
+ @comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment2.id)
296
+ @comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
297
+ @comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment3.id)
298
+ @comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment2.id)
299
+ @comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
300
+ @comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment5.id)
301
+ @comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment4.id)
302
+ @comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
306
303
 
307
304
  @comment.reload
308
305
  commentline = @comment.commentline
@@ -317,18 +314,18 @@ describe "Comments" do
317
314
  end
318
315
 
319
316
  it "5 comments for comment should been received" do
320
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
321
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
322
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
323
- @comment3 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment1.id)
324
- @comment4 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment2.id)
325
- @comment5 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
326
- @comment6 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment3.id)
327
- @comment7 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment2.id)
328
- @comment8 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
329
- @comment9 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment5.id)
330
- @comment10 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment4.id)
331
- @comment11 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
317
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
318
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
319
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
320
+ @comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment1.id)
321
+ @comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment2.id)
322
+ @comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
323
+ @comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment3.id)
324
+ @comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment2.id)
325
+ @comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
326
+ @comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment5.id)
327
+ @comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment4.id)
328
+ @comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
332
329
 
333
330
  @comment.reload
334
331
  commentline = @comment.commentline :limit => 5
@@ -350,9 +347,9 @@ describe "Comments" do
350
347
  end
351
348
 
352
349
  it "is_favorited should been returned in commentline for comment for for_user" do
353
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
354
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
355
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
350
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
351
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
352
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
356
353
  @salkar.favorite @comment1
357
354
  @morozovm.favorite @comment2
358
355
 
@@ -371,9 +368,9 @@ describe "Comments" do
371
368
  end
372
369
 
373
370
  it "is_favorited should been returned in commentline for post for for_user" do
374
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
375
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
376
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
371
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
372
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
373
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
377
374
  @salkar.favorite @comment1
378
375
  @morozovm.favorite @comment2
379
376
 
@@ -392,22 +389,22 @@ describe "Comments" do
392
389
  end
393
390
 
394
391
  it "comment count for post should been received" do
395
- @salkar_post.comments.size.should == 0
392
+ ::Inkwell::Comment.where(:topmost_obj_id => @salkar_post.id, :topmost_obj_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 0
396
393
  @salkar_post.comment_count.should == 0
397
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
398
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
399
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
394
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
395
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
396
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
400
397
  @salkar_post.reload
401
- @salkar_post.comments.size.should == 3
398
+ ::Inkwell::Comment.where(:topmost_obj_id => @salkar_post.id, :topmost_obj_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 3
402
399
  @salkar_post.comment_count.should == 3
403
400
  end
404
401
 
405
402
  it "comment count for comment should been received" do
406
- @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
403
+ @comment = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post)
407
404
  @comment.reload
408
405
  @comment.comment_count.should == 0
409
- @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
410
- @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
406
+ @comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
407
+ @comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_comment_id => @comment.id)
411
408
  @comment.reload
412
409
  @comment.comment_count.should == 2
413
410
  end
@@ -1,7 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "Community" do
4
-
5
4
  before(:each) do
6
5
  @salkar = User.create :nick => "Salkar"
7
6
  @morozovm = User.create :nick => "Morozovm"
@@ -38,28 +37,28 @@ describe "Community" do
38
37
  @morozovm_post = @morozovm.posts.create :body => "morozovm_post_test_body"
39
38
  @morozovm_post1 = @morozovm.posts.create :body => "morozovm_post_test_body1"
40
39
  @morozovm_post2 = @morozovm.posts.create :body => "morozovm_post_test_body2"
41
- ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
42
- ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
43
- ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
44
- ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
45
- ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
46
- ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
47
- ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
48
- ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
49
- ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
50
- ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
51
- ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
52
- ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
40
+ ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
41
+ ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
42
+ ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
43
+ ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
44
+ ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
45
+ ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
46
+ ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
47
+ ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
48
+ ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
49
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
50
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
51
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
53
52
  @talisman = User.create :nick => "Talisman"
54
53
  @community_1.add_user :user => @talisman
55
54
  @talisman.reload
56
- tline = @talisman.timeline_items
55
+ tline = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER)
57
56
  tline.size.should == 10
58
57
  tline[0].item_id.should == @morozovm_post2.id
59
- tline[0].is_comment.should == false
58
+ tline[0].item_type.should == ::Inkwell::Constants::ItemTypes::POST
60
59
  ActiveSupport::JSON.decode(tline[0].from_source).should == [Hash['community_id' => @community_1.id]]
61
60
  tline[9].item_id.should == @salkar_post2.id
62
- tline[9].is_comment.should == false
61
+ tline[9].item_type.should == ::Inkwell::Constants::ItemTypes::POST
63
62
  ActiveSupport::JSON.decode(tline[9].from_source).should == [Hash['community_id' => @community_1.id]]
64
63
  end
65
64
 
@@ -77,26 +76,26 @@ describe "Community" do
77
76
  @morozovm_post = @morozovm.posts.create :body => "morozovm_post_test_body"
78
77
  @morozovm_post1 = @morozovm.posts.create :body => "morozovm_post_test_body1"
79
78
  @morozovm_post2 = @morozovm.posts.create :body => "morozovm_post_test_body2"
80
- ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
81
- ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
82
- ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
83
- ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
84
- ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
85
- ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
86
- ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
87
- ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
88
- ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
89
- ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
90
- ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
91
- ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
79
+ ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
80
+ ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
81
+ ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
82
+ ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
83
+ ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
84
+ ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
85
+ ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
86
+ ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
87
+ ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
88
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
89
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
90
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
92
91
  @community_1.add_user :user => @talisman
93
92
  @talisman.reload
94
- tline = @talisman.timeline_items
93
+ tline = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER)
95
94
  tline.size.should == 12
96
- item = tline.where(:item_id => @morozovm_post2.id, :is_comment => false).first
95
+ item = tline.where(:item_id => @morozovm_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
97
96
  item.should be
98
97
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
99
- item = tline.where(:item_id => @salkar_post2.id, :is_comment => false).first
98
+ item = tline.where(:item_id => @salkar_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
100
99
  item.should be
101
100
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @salkar.id, 'type' => 'following'], Hash['community_id' => @community_1.id]]
102
101
  end
@@ -115,26 +114,26 @@ describe "Community" do
115
114
  @morozovm_post = @morozovm.posts.create :body => "morozovm_post_test_body"
116
115
  @morozovm_post1 = @morozovm.posts.create :body => "morozovm_post_test_body1"
117
116
  @morozovm_post2 = @morozovm.posts.create :body => "morozovm_post_test_body2"
118
- ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
119
- ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
120
- ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
121
- ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
122
- ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
123
- ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
124
- ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
125
- ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
126
- ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
127
- ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
128
- ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
129
- ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
117
+ ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
118
+ ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
119
+ ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
120
+ ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
121
+ ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
122
+ ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
123
+ ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
124
+ ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
125
+ ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
126
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
127
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
128
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
130
129
  @community_1.add_user :user => @salkar
131
130
  @salkar.reload
132
- tline = @salkar.timeline_items
131
+ tline = ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER)
133
132
  tline.size.should == 3
134
- item = tline.where(:item_id => @morozovm_post2.id, :is_comment => false).first
133
+ item = tline.where(:item_id => @morozovm_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
135
134
  item.should be
136
135
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
137
- item = tline.where(:item_id => @salkar_post2.id, :is_comment => false).first
136
+ item = tline.where(:item_id => @salkar_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first
138
137
  item.should == nil
139
138
  end
140
139
 
@@ -217,32 +216,32 @@ describe "Community" do
217
216
  @morozovm_post = @morozovm.posts.create :body => "morozovm_post_test_body"
218
217
  @morozovm_post1 = @morozovm.posts.create :body => "morozovm_post_test_body1"
219
218
  @morozovm_post2 = @morozovm.posts.create :body => "morozovm_post_test_body2"
220
- ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
221
- ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
222
- ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
223
- ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
224
- ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
225
- ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
226
- ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
227
- ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
228
- ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
229
- ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
230
- ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
231
- ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :is_comment => false, :owner_id => @community_1.id, :is_owner_user => false
219
+ ::Inkwell::BlogItem.create :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
220
+ ::Inkwell::BlogItem.create :item_id => @salkar_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
221
+ ::Inkwell::BlogItem.create :item_id => @salkar_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
222
+ ::Inkwell::BlogItem.create :item_id => @salkar_post3.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
223
+ ::Inkwell::BlogItem.create :item_id => @salkar_post4.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
224
+ ::Inkwell::BlogItem.create :item_id => @salkar_post5.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
225
+ ::Inkwell::BlogItem.create :item_id => @salkar_post6.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
226
+ ::Inkwell::BlogItem.create :item_id => @salkar_post7.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
227
+ ::Inkwell::BlogItem.create :item_id => @salkar_post8.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
228
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
229
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
230
+ ::Inkwell::BlogItem.create :item_id => @morozovm_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY
232
231
  @community_1.add_user :user => @talisman
233
232
  @talisman.reload
234
233
  @community_1.reload
235
- tline = @talisman.timeline_items
234
+ tline = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER)
236
235
  tline.size.should == 12
237
236
  @community_1.include_user?(@talisman).should == true
238
237
  @community_1.remove_user :user => @talisman
239
238
  @talisman.reload
240
- tline = @talisman.timeline_items
239
+ tline = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER)
241
240
  tline.size.should == 9
242
- tline.where(:item_id => @morozovm_post.id, :is_comment => false).first.should == nil
243
- tline.where(:item_id => @morozovm_post1.id, :is_comment => false).first.should == nil
244
- tline.where(:item_id => @morozovm_post2.id, :is_comment => false).first.should == nil
245
- ActiveSupport::JSON.decode(tline.where(:item_id => @salkar_post8.id, :is_comment => false).first.from_source).should == [Hash['user_id' => @salkar.id, 'type' => 'following']]
241
+ tline.where(:item_id => @morozovm_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first.should == nil
242
+ tline.where(:item_id => @morozovm_post1.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first.should == nil
243
+ tline.where(:item_id => @morozovm_post2.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first.should == nil
244
+ ActiveSupport::JSON.decode(tline.where(:item_id => @salkar_post8.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).first.from_source).should == [Hash['user_id' => @salkar.id, 'type' => 'following']]
246
245
  end
247
246
 
248
247
  it "admin level of user should be returned" do
@@ -387,23 +386,23 @@ describe "Community" do
387
386
  @talisman.follow @morozovm
388
387
  @salkar.follow @morozovm
389
388
  ::Inkwell::BlogItem.all.size.should == 24
390
- @salkar.timeline_items.size.should == 3
391
- @talisman.timeline_items.size.should == 12
392
- @morozovm.timeline_items.size.should == 9
389
+ ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 3
390
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 12
391
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 9
393
392
  id = @community_1.id
394
393
 
395
394
  @community_1.reload
396
395
  @community_1.destroy
397
396
  ::Inkwell::BlogItem.all.size.should == 12
398
- ::Inkwell::BlogItem.where(:owner_id => id, :is_owner_user => false).size.should == 0
399
- @salkar.timeline_items.size.should == 3
400
- @talisman.timeline_items.size.should == 3
401
- @morozovm.timeline_items.size.should == 0
402
- @salkar.timeline_items.each do |item|
397
+ ::Inkwell::BlogItem.where(:owner_id => id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY).size.should == 0
398
+ ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 3
399
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 3
400
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
401
+ ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).each do |item|
403
402
  item.has_many_sources.should == false
404
403
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @morozovm.id, 'type' => 'following']]
405
404
  end
406
- @talisman.timeline_items.each do |item|
405
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).each do |item|
407
406
  item.has_many_sources.should == false
408
407
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @morozovm.id, 'type' => 'following']]
409
408
  end
@@ -418,13 +417,13 @@ describe "Community" do
418
417
 
419
418
  it "post should be added to community blogline and user's timeline" do
420
419
  @community_1.add_user :user => @salkar
421
- ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :is_owner_user => false, :item_id => @salkar_post.id, :is_comment => false).size.should == 0
420
+ ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY, :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 0
422
421
  @community_1.add_post :post => @salkar_post, :user => @salkar
423
- ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :is_owner_user => false, :item_id => @salkar_post.id, :is_comment => false).size.should == 1
424
- @salkar.timeline_items.size.should == 0
425
- @talisman.timeline_items.size.should == 1
426
- @talisman.timeline_items.where(:item_id => @salkar_post.id, :is_comment => false).size.should == 1
427
- item = @talisman.timeline_items.first
422
+ ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY, :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
423
+ ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
424
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
425
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
426
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
428
427
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
429
428
  item.has_many_sources.should == false
430
429
 
@@ -438,24 +437,24 @@ describe "Community" do
438
437
  @community_1.reload
439
438
  @morozovm.reload
440
439
  @talisman.follow @salkar
441
- @talisman.timeline_items.size.should == 1
442
- @talisman.timeline_items.where(:item_id => @salkar_post.id, :is_comment => false).size.should == 1
443
- @morozovm.timeline_items.size.should == 0
444
- @salkar.timeline_items.size.should == 0
440
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
441
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
442
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
443
+ ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
445
444
 
446
445
  @community_1.add_post :post => @salkar_post, :user => @salkar
447
- @talisman.timeline_items.size.should == 1
448
- @talisman.timeline_items.where(:item_id => @salkar_post.id, :is_comment => false).size.should == 1
449
- item = @talisman.timeline_items.first
446
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
447
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
448
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
450
449
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @salkar.id, 'type' => 'following'], Hash['community_id' => @community_1.id]]
451
450
  item.has_many_sources.should == true
452
451
 
453
- @salkar.timeline_items.size.should == 0
452
+ ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
454
453
 
455
454
  @morozovm.reload
456
- @morozovm.timeline_items.size.should == 1
457
- @morozovm.timeline_items.where(:item_id => @salkar_post.id, :is_comment => false).size.should == 1
458
- item = @morozovm.timeline_items.first
455
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
456
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
457
+ item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
459
458
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
460
459
  item.has_many_sources.should == false
461
460
  end
@@ -479,26 +478,26 @@ describe "Community" do
479
478
  @community_1.add_post :post => @salkar_post, :user => @salkar
480
479
  @talisman.follow @salkar
481
480
  @talisman.reload
482
- @talisman.timeline_items.size.should == 1
483
- item = @talisman.timeline_items.first
481
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
482
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
484
483
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id], Hash['user_id' => @salkar.id, 'type' => 'following']]
485
484
  item.has_many_sources.should == true
486
- @morozovm.timeline_items.size.should == 1
487
- item = @morozovm.timeline_items.first
485
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
486
+ item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
488
487
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
489
488
  item.has_many_sources.should == false
490
489
 
491
490
  @community_1.remove_post :post => @salkar_post, :user => @salkar
492
491
  @talisman.reload
493
- @talisman.timeline_items.size.should == 1
494
- item = @talisman.timeline_items.first
492
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
493
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
495
494
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @salkar.id, 'type' => 'following']]
496
495
  item.has_many_sources.should == false
497
496
 
498
497
  @morozovm.reload
499
- @morozovm.timeline_items.size.should == 0
498
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
500
499
 
501
- ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :is_owner_user => false, :item_id => @salkar_post.id, :is_comment => false).size.should == 0
500
+ ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY, :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 0
502
501
  @salkar_post.reload
503
502
  ActiveSupport::JSON.decode(@salkar_post.communities_ids).size.should == 0
504
503
  end
@@ -509,12 +508,12 @@ describe "Community" do
509
508
  @community_1.add_post :post => @salkar_post, :user => @salkar
510
509
  @talisman.follow @salkar
511
510
  @talisman.reload
512
- @talisman.timeline_items.size.should == 1
513
- item = @talisman.timeline_items.first
511
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
512
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
514
513
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id], Hash['user_id' => @salkar.id, 'type' => 'following']]
515
514
  item.has_many_sources.should == true
516
- @morozovm.timeline_items.size.should == 1
517
- item = @morozovm.timeline_items.first
515
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
516
+ item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
518
517
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
519
518
  item.has_many_sources.should == false
520
519
 
@@ -522,15 +521,15 @@ describe "Community" do
522
521
  @talisman.reload
523
522
  @community_1.remove_post :post => @salkar_post, :user => @talisman
524
523
  @talisman.reload
525
- @talisman.timeline_items.size.should == 1
526
- item = @talisman.timeline_items.first
524
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
525
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
527
526
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @salkar.id, 'type' => 'following']]
528
527
  item.has_many_sources.should == false
529
528
 
530
529
  @morozovm.reload
531
- @morozovm.timeline_items.size.should == 0
530
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
532
531
 
533
- ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :is_owner_user => false, :item_id => @salkar_post.id, :is_comment => false).size.should == 0
532
+ ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY, :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 0
534
533
  @salkar_post.reload
535
534
  ActiveSupport::JSON.decode(@salkar_post.communities_ids).size.should == 0
536
535
  end
@@ -603,13 +602,13 @@ describe "Community" do
603
602
 
604
603
  it "post should be sended to community" do
605
604
  @community_1.add_user :user => @salkar
606
- ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :is_owner_user => false, :item_id => @salkar_post.id, :is_comment => false).size.should == 0
605
+ ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY, :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 0
607
606
  @salkar.send_post_to_community :post => @salkar_post, :to_community => @community_1
608
- ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :is_owner_user => false, :item_id => @salkar_post.id, :is_comment => false).size.should == 1
609
- @salkar.timeline_items.size.should == 0
610
- @talisman.timeline_items.size.should == 1
611
- @talisman.timeline_items.where(:item_id => @salkar_post.id, :is_comment => false).size.should == 1
612
- item = @talisman.timeline_items.first
607
+ ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY, :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
608
+ ::Inkwell::TimelineItem.where(:owner_id => @salkar.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
609
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
610
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).where(:item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 1
611
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
613
612
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
614
613
  item.has_many_sources.should == false
615
614
 
@@ -623,26 +622,26 @@ describe "Community" do
623
622
  @community_1.add_post :post => @salkar_post, :user => @salkar
624
623
  @talisman.follow @salkar
625
624
  @talisman.reload
626
- @talisman.timeline_items.size.should == 1
627
- item = @talisman.timeline_items.first
625
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
626
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
628
627
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id], Hash['user_id' => @salkar.id, 'type' => 'following']]
629
628
  item.has_many_sources.should == true
630
- @morozovm.timeline_items.size.should == 1
631
- item = @morozovm.timeline_items.first
629
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
630
+ item = ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
632
631
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['community_id' => @community_1.id]]
633
632
  item.has_many_sources.should == false
634
633
 
635
634
  @salkar.remove_post_from_community :post => @salkar_post, :from_community => @community_1
636
635
  @talisman.reload
637
- @talisman.timeline_items.size.should == 1
638
- item = @talisman.timeline_items.first
636
+ ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 1
637
+ item = ::Inkwell::TimelineItem.where(:owner_id => @talisman.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).first
639
638
  ActiveSupport::JSON.decode(item.from_source).should == [Hash['user_id' => @salkar.id, 'type' => 'following']]
640
639
  item.has_many_sources.should == false
641
640
 
642
641
  @morozovm.reload
643
- @morozovm.timeline_items.size.should == 0
642
+ ::Inkwell::TimelineItem.where(:owner_id => @morozovm.id, :owner_type => ::Inkwell::Constants::OwnerTypes::USER).size.should == 0
644
643
 
645
- ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :is_owner_user => false, :item_id => @salkar_post.id, :is_comment => false).size.should == 0
644
+ ::Inkwell::BlogItem.where(:owner_id => @community_1.id, :owner_type => ::Inkwell::Constants::OwnerTypes::COMMUNITY, :item_id => @salkar_post.id, :item_type => ::Inkwell::Constants::ItemTypes::POST).size.should == 0
646
645
  @salkar_post.reload
647
646
  ActiveSupport::JSON.decode(@salkar_post.communities_ids).size.should == 0
648
647
  end