inkwell 1.0.5 → 1.1.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.
- data/app/models/inkwell/blog_item.rb +1 -1
- data/app/models/inkwell/comment.rb +22 -24
- data/app/models/inkwell/favorite_item.rb +1 -2
- data/app/models/inkwell/timeline_item.rb +1 -2
- data/db/migrate/20130202130030_change_is_comment_to_item_type.rb +18 -0
- data/db/migrate/20130202130040_add_owner_type_to_lines.rb +16 -0
- data/db/migrate/20130212130858_refactor_comment_table.rb +7 -0
- data/db/migrate/20130212130868_rename_parent_id_to_parent_comment_id_in_comment_table.rb +5 -0
- data/lib/acts_as_inkwell_community/base.rb +16 -16
- data/lib/acts_as_inkwell_post/base.rb +15 -14
- data/lib/acts_as_inkwell_user/base.rb +41 -34
- data/lib/common/base.rb +28 -4
- data/lib/inkwell/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130210231424_change_is_comment_to_item_type.inkwell.rb +19 -0
- data/test/dummy/db/migrate/20130212130848_add_owner_type_to_lines.inkwell.rb +17 -0
- data/test/dummy/db/migrate/20130213101736_refactor_comment_table.inkwell.rb +8 -0
- data/test/dummy/db/migrate/20130213121414_rename_parent_id_to_parent_comment_id_in_comment_table.inkwell.rb +6 -0
- data/test/dummy/db/schema.rb +14 -11
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +699 -0
- data/test/dummy/log/test.log +0 -0
- data/test/dummy/spec/functional/blogline_spec.rb +7 -7
- data/test/dummy/spec/functional/comments_spec.rb +129 -132
- data/test/dummy/spec/functional/community_spec.rb +119 -120
- data/test/dummy/spec/functional/favorite_spec.rb +27 -27
- data/test/dummy/spec/functional/following_spec.rb +26 -26
- data/test/dummy/spec/functional/reblog_spec.rb +32 -32
- data/test/dummy/spec/functional/timeline_spec.rb +1 -1
- data/test/dummy_without_community/db/development.sqlite3 +0 -0
- data/test/dummy_without_community/db/migrate/20130213115833_change_is_comment_to_item_type.inkwell.rb +19 -0
- data/test/dummy_without_community/db/migrate/20130213115834_add_owner_type_to_lines.inkwell.rb +17 -0
- data/test/dummy_without_community/db/migrate/20130213115835_refactor_comment_table.inkwell.rb +8 -0
- data/test/dummy_without_community/db/schema.rb +13 -10
- data/test/dummy_without_community/db/test.sqlite3 +0 -0
- data/test/dummy_without_community/log/development.log +111 -0
- data/test/dummy_without_community/log/test.log +11393 -0
- data/test/dummy_without_community/spec/functional/blogline_spec.rb +7 -7
- data/test/dummy_without_community/spec/functional/comments_spec.rb +128 -131
- data/test/dummy_without_community/spec/functional/favorite_spec.rb +27 -27
- data/test/dummy_without_community/spec/functional/following_spec.rb +26 -26
- data/test/dummy_without_community/spec/functional/reblog_spec.rb +32 -32
- data/test/dummy_without_community/spec/functional/timeline_spec.rb +1 -1
- metadata +32 -14
@@ -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, :
|
13
|
-
item = ::Inkwell::BlogItem.where(:owner_id => @salkar.id, :
|
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.
|
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.
|
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(:
|
27
|
-
::Inkwell::TimelineItem.where(:
|
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, :
|
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.
|
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.
|
18
|
+
comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
19
19
|
@salkar.comments.size.should == 1
|
20
|
-
@salkar_post.
|
21
|
-
@salkar.comments.should == @salkar_post.
|
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.
|
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
|
-
|
36
|
-
|
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.
|
45
|
-
@comment1 = @morozovm.
|
46
|
-
@comment2 = @salkar.
|
47
|
-
@comment3 = @morozovm.
|
48
|
-
@comment4 = @salkar.
|
49
|
-
@comment5 = @morozovm.
|
50
|
-
@comment6 = @morozovm.
|
51
|
-
@comment7 = @salkar.
|
52
|
-
@comment8 = @salkar.
|
53
|
-
@comment9 = @morozovm.
|
54
|
-
@comment10 = @salkar.
|
55
|
-
@comment11 = @morozovm.
|
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.
|
71
|
-
@comment1 = @morozovm.
|
72
|
-
@comment2 = @salkar.
|
73
|
-
@comment3 = @morozovm.
|
74
|
-
@comment4 = @salkar.
|
75
|
-
@comment5 = @morozovm.
|
76
|
-
@comment6 = @morozovm.
|
77
|
-
@comment7 = @salkar.
|
78
|
-
@comment8 = @salkar.
|
79
|
-
@comment9 = @morozovm.
|
80
|
-
@comment10 = @salkar.
|
81
|
-
@comment11 = @morozovm.
|
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_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.
|
101
|
-
@morozovm_comment = @morozovm.
|
102
|
-
@salkar_post.
|
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
105
|
it "2 comments with parent_id should been created" do
|
109
|
-
@salkar_comment = @salkar.
|
110
|
-
@morozovm_comment = @morozovm.
|
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_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.
|
125
|
-
@morozovm_comment = @morozovm.
|
126
|
-
@salkar_comment1 = @salkar.
|
127
|
-
@morozovm_comment1 = @morozovm.
|
128
|
-
@salkar_comment2 = @salkar.
|
129
|
-
@morozovm_comment2 = @morozovm.
|
130
|
-
@salkar_comment3 = @salkar.
|
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_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_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_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.
|
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, :
|
158
|
-
::Inkwell::FavoriteItem.create :item_id => @comment.id, :
|
159
|
-
::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @morozovm.id, :
|
160
|
-
::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :
|
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.
|
178
|
-
@comment_to_delete = @morozovm.
|
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_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, :
|
183
|
-
::Inkwell::FavoriteItem.create :item_id => @comment_to_delete.id, :
|
184
|
-
::Inkwell::TimelineItem.create :item_id => @comment.id, :
|
185
|
-
::Inkwell::FavoriteItem.create :item_id => @comment.id, :
|
186
|
-
::Inkwell::BlogItem.create :item_id => @comment_to_delete.id, :owner_id => @morozovm.id, :
|
187
|
-
::Inkwell::BlogItem.create :item_id => @comment_to_delete.id, :owner_id => @salkar.id, :
|
188
|
-
::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :
|
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.
|
209
|
-
@comment2 = @morozovm.
|
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_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, :
|
214
|
-
::Inkwell::FavoriteItem.create :item_id => @comment2.id, :
|
215
|
-
::Inkwell::TimelineItem.create :item_id => @comment.id, :
|
216
|
-
::Inkwell::FavoriteItem.create :item_id => @comment.id, :
|
217
|
-
::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @morozovm.id, :
|
218
|
-
::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @salkar.id, :
|
219
|
-
::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :
|
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.
|
238
|
-
@comment2 = @morozovm.
|
239
|
-
@comment2 = @morozovm.
|
240
|
-
@comment3 = @morozovm.
|
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_id => @comment.id)
|
236
|
+
@comment2 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment2.id)
|
237
|
+
@comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_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, :
|
245
|
-
::Inkwell::FavoriteItem.create :item_id => @comment2.id, :
|
246
|
-
::Inkwell::TimelineItem.create :item_id => @comment.id, :
|
247
|
-
::Inkwell::FavoriteItem.create :item_id => @comment.id, :
|
248
|
-
::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @morozovm.id,
|
249
|
-
::Inkwell::BlogItem.create :item_id => @comment2.id, :owner_id => @salkar.id,
|
250
|
-
::Inkwell::BlogItem.create :item_id => @comment.id, :owner_id => @salkar.id, :
|
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.
|
269
|
-
@comment1 = @morozovm.
|
270
|
-
@comment2 = @salkar.
|
271
|
-
@comment3 = @morozovm.
|
272
|
-
@comment4 = @salkar.
|
273
|
-
@comment5 = @morozovm.
|
274
|
-
@comment6 = @morozovm.
|
275
|
-
@comment7 = @salkar.
|
276
|
-
@comment8 = @salkar.
|
277
|
-
@comment9 = @morozovm.
|
278
|
-
@comment10 = @salkar.
|
279
|
-
@comment11 = @morozovm.
|
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_id => @comment.id)
|
267
|
+
@comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
268
|
+
@comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
269
|
+
@comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
270
|
+
@comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
271
|
+
@comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
272
|
+
@comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
273
|
+
@comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
274
|
+
@comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
275
|
+
@comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
276
|
+
@comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_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.
|
295
|
-
@comment1 = @morozovm.
|
296
|
-
@comment2 = @salkar.
|
297
|
-
@comment3 = @morozovm.
|
298
|
-
@comment4 = @salkar.
|
299
|
-
@comment5 = @morozovm.
|
300
|
-
@comment6 = @morozovm.
|
301
|
-
@comment7 = @salkar.
|
302
|
-
@comment8 = @salkar.
|
303
|
-
@comment9 = @morozovm.
|
304
|
-
@comment10 = @salkar.
|
305
|
-
@comment11 = @morozovm.
|
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_id => @comment.id)
|
293
|
+
@comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
294
|
+
@comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment1.id)
|
295
|
+
@comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment2.id)
|
296
|
+
@comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
297
|
+
@comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment3.id)
|
298
|
+
@comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment2.id)
|
299
|
+
@comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
300
|
+
@comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment5.id)
|
301
|
+
@comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment4.id)
|
302
|
+
@comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_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.
|
321
|
-
@comment1 = @morozovm.
|
322
|
-
@comment2 = @salkar.
|
323
|
-
@comment3 = @morozovm.
|
324
|
-
@comment4 = @salkar.
|
325
|
-
@comment5 = @morozovm.
|
326
|
-
@comment6 = @morozovm.
|
327
|
-
@comment7 = @salkar.
|
328
|
-
@comment8 = @salkar.
|
329
|
-
@comment9 = @morozovm.
|
330
|
-
@comment10 = @salkar.
|
331
|
-
@comment11 = @morozovm.
|
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_id => @comment.id)
|
319
|
+
@comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
320
|
+
@comment3 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment1.id)
|
321
|
+
@comment4 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment2.id)
|
322
|
+
@comment5 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
323
|
+
@comment6 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment3.id)
|
324
|
+
@comment7 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment2.id)
|
325
|
+
@comment8 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
326
|
+
@comment9 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment5.id)
|
327
|
+
@comment10 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment4.id)
|
328
|
+
@comment11 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_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.
|
354
|
-
@comment1 = @morozovm.
|
355
|
-
@comment2 = @salkar.
|
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_id => @comment.id)
|
352
|
+
@comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_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.
|
375
|
-
@comment1 = @morozovm.
|
376
|
-
@comment2 = @salkar.
|
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_id => @comment.id)
|
373
|
+
@comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_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.
|
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.
|
398
|
-
@comment1 = @morozovm.
|
399
|
-
@comment2 = @salkar.
|
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_id => @comment.id)
|
396
|
+
@comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
400
397
|
@salkar_post.reload
|
401
|
-
@salkar_post.
|
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.
|
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.
|
410
|
-
@comment2 = @salkar.
|
406
|
+
@comment1 = @morozovm.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
407
|
+
@comment2 = @salkar.create_comment(:body => 'Lets You Party Like a Facebook User', :for_object => @salkar_post, :parent_id => @comment.id)
|
411
408
|
@comment.reload
|
412
409
|
@comment.comment_count.should == 2
|
413
410
|
end
|
@@ -6,7 +6,7 @@ describe "Favorites" do
|
|
6
6
|
@salkar = User.create :nick => "Salkar"
|
7
7
|
@morozovm = User.create :nick => "Morozovm"
|
8
8
|
@salkar_post = @salkar.posts.create :body => "salkar_post_test_body"
|
9
|
-
@salkar_comment = @salkar.
|
9
|
+
@salkar_comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
10
10
|
end
|
11
11
|
|
12
12
|
it "Post should been favorited" do
|
@@ -22,7 +22,7 @@ describe "Favorites" do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "Post should been favorited" do
|
25
|
-
::Inkwell::FavoriteItem.create :item_id => @salkar_post.id, :
|
25
|
+
::Inkwell::FavoriteItem.create :item_id => @salkar_post.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::POST, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
|
26
26
|
::Inkwell::FavoriteItem.all.size.should == 1
|
27
27
|
@salkar.favorite?(@salkar_post).should == true
|
28
28
|
end
|
@@ -33,7 +33,7 @@ describe "Favorites" do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "Comment should been favorited" do
|
36
|
-
::Inkwell::FavoriteItem.create :item_id => @salkar_comment.id, :
|
36
|
+
::Inkwell::FavoriteItem.create :item_id => @salkar_comment.id, :owner_id => @salkar.id, :item_type => ::Inkwell::Constants::ItemTypes::COMMENT, :owner_type => ::Inkwell::Constants::OwnerTypes::USER
|
37
37
|
::Inkwell::FavoriteItem.all.size.should == 1
|
38
38
|
@salkar.favorite?(@salkar_comment).should == true
|
39
39
|
end
|
@@ -123,17 +123,17 @@ describe "Favorites" do
|
|
123
123
|
|
124
124
|
it "Favoriteline should been return" do
|
125
125
|
@salkar_post = @salkar.posts.create :body => "salkar_post_test_body"
|
126
|
-
@salkar_comment = @salkar.
|
126
|
+
@salkar_comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
127
127
|
@morozovm_post = @morozovm.posts.create :body => "salkar_post_test_body"
|
128
|
-
@morozovm_comment = @morozovm.
|
129
|
-
@salkar_comment1 = @salkar.
|
128
|
+
@morozovm_comment = @morozovm.create_comment :for_object => @morozovm_post, :body => "salkar_comment_body"
|
129
|
+
@salkar_comment1 = @salkar.create_comment :for_object => @morozovm_post, :body => "salkar_comment_body"
|
130
130
|
@morozovm_post1 = @morozovm.posts.create :body => "salkar_post_test_body"
|
131
131
|
@morozovm_post2 = @morozovm.posts.create :body => "salkar_post_test_body"
|
132
132
|
@morozovm_post3 = @morozovm.posts.create :body => "salkar_post_test_body"
|
133
|
-
@salkar_comment2 = @salkar.
|
134
|
-
@salkar_comment3 = @salkar.
|
135
|
-
@salkar_comment4 = @salkar.
|
136
|
-
@morozovm_comment2 = @morozovm.
|
133
|
+
@salkar_comment2 = @salkar.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
134
|
+
@salkar_comment3 = @salkar.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
135
|
+
@salkar_comment4 = @salkar.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
136
|
+
@morozovm_comment2 = @morozovm.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
137
137
|
@salkar_post1 = @salkar.posts.create :body => "salkar_post_test_body"
|
138
138
|
|
139
139
|
@salkar.favorite @salkar_post
|
@@ -154,48 +154,48 @@ describe "Favorites" do
|
|
154
154
|
fline.size.should == 10
|
155
155
|
fline[0].id.should == @salkar_post1.id
|
156
156
|
fline[0].class.to_s.should == 'Post'
|
157
|
-
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
157
|
+
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@salkar_post1.id, ::Inkwell::Constants::ItemTypes::POST).id
|
158
158
|
fline[9].id.should == @morozovm_comment.id
|
159
159
|
fline[9].class.to_s.should == 'Inkwell::Comment'
|
160
|
-
fline[9].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
160
|
+
fline[9].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@morozovm_comment.id, ::Inkwell::Constants::ItemTypes::COMMENT).id
|
161
161
|
|
162
162
|
fline_same = @salkar.favoriteline :last_shown_obj_id => nil, :limit => 10, :for_user => nil
|
163
163
|
fline_same.should == fline
|
164
164
|
|
165
|
-
from_favorite_item_id = ::Inkwell::FavoriteItem.
|
165
|
+
from_favorite_item_id = ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@morozovm_comment2.id, ::Inkwell::Constants::ItemTypes::COMMENT).id
|
166
166
|
fline = @salkar.favoriteline(:last_shown_obj_id => from_favorite_item_id)
|
167
167
|
fline.size.should == 10
|
168
168
|
fline[0].id.should == @salkar_comment4.id
|
169
169
|
fline[0].class.to_s.should == 'Inkwell::Comment'
|
170
|
-
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
170
|
+
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@salkar_comment4.id, ::Inkwell::Constants::ItemTypes::COMMENT).id
|
171
171
|
fline[9].id.should == @salkar_comment.id
|
172
172
|
fline[9].class.to_s.should == 'Inkwell::Comment'
|
173
|
-
fline[9].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
173
|
+
fline[9].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@salkar_comment.id, ::Inkwell::Constants::ItemTypes::COMMENT).id
|
174
174
|
|
175
|
-
from_favorite_item_id = ::Inkwell::FavoriteItem.
|
175
|
+
from_favorite_item_id = ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@morozovm_comment2.id, ::Inkwell::Constants::ItemTypes::COMMENT).id
|
176
176
|
fline = @salkar.favoriteline(:last_shown_obj_id => from_favorite_item_id, :limit => 5)
|
177
177
|
fline.size.should == 5
|
178
178
|
fline[0].id.should == @salkar_comment4.id
|
179
179
|
fline[0].class.to_s.should == 'Inkwell::Comment'
|
180
|
-
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
180
|
+
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@salkar_comment4.id, ::Inkwell::Constants::ItemTypes::COMMENT).id
|
181
181
|
fline[4].id.should == @morozovm_post2.id
|
182
182
|
fline[4].class.to_s.should == 'Post'
|
183
|
-
fline[4].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
183
|
+
fline[4].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@morozovm_post2.id, ::Inkwell::Constants::ItemTypes::POST).id
|
184
184
|
end
|
185
185
|
|
186
186
|
it "Favoriteline should been return for for_user" do
|
187
187
|
@salkar_post = @salkar.posts.create :body => "salkar_post_test_body"
|
188
|
-
@salkar_comment = @salkar.
|
188
|
+
@salkar_comment = @salkar.create_comment :for_object => @salkar_post, :body => "salkar_comment_body"
|
189
189
|
@morozovm_post = @morozovm.posts.create :body => "salkar_post_test_body"
|
190
|
-
@morozovm_comment = @morozovm.
|
191
|
-
@salkar_comment1 = @salkar.
|
190
|
+
@morozovm_comment = @morozovm.create_comment :for_object => @morozovm_post, :body => "salkar_comment_body"
|
191
|
+
@salkar_comment1 = @salkar.create_comment :for_object => @morozovm_post, :body => "salkar_comment_body"
|
192
192
|
@morozovm_post1 = @morozovm.posts.create :body => "salkar_post_test_body"
|
193
193
|
@morozovm_post2 = @morozovm.posts.create :body => "salkar_post_test_body"
|
194
194
|
@morozovm_post3 = @morozovm.posts.create :body => "salkar_post_test_body"
|
195
|
-
@salkar_comment2 = @salkar.
|
196
|
-
@salkar_comment3 = @salkar.
|
197
|
-
@salkar_comment4 = @salkar.
|
198
|
-
@morozovm_comment2 = @morozovm.
|
195
|
+
@salkar_comment2 = @salkar.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
196
|
+
@salkar_comment3 = @salkar.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
197
|
+
@salkar_comment4 = @salkar.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
198
|
+
@morozovm_comment2 = @morozovm.create_comment :for_object => @morozovm_post3, :body => "salkar_comment_body"
|
199
199
|
@salkar_post1 = @salkar.posts.create :body => "salkar_post_test_body"
|
200
200
|
|
201
201
|
@salkar.favorite @salkar_post
|
@@ -221,7 +221,7 @@ describe "Favorites" do
|
|
221
221
|
fline.size.should == 10
|
222
222
|
fline[0].id.should == @salkar_post1.id
|
223
223
|
fline[0].class.to_s.should == 'Post'
|
224
|
-
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
224
|
+
fline[0].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@salkar_post1.id, ::Inkwell::Constants::ItemTypes::POST).id
|
225
225
|
fline[0].is_favorited.should == true
|
226
226
|
fline[0].is_reblogged.should == true
|
227
227
|
fline[2].id.should == @salkar_comment4.id
|
@@ -229,7 +229,7 @@ describe "Favorites" do
|
|
229
229
|
fline[2].is_reblogged.should == true
|
230
230
|
fline[9].id.should == @morozovm_comment.id
|
231
231
|
fline[9].class.to_s.should == 'Inkwell::Comment'
|
232
|
-
fline[9].item_id_in_line.should == ::Inkwell::FavoriteItem.
|
232
|
+
fline[9].item_id_in_line.should == ::Inkwell::FavoriteItem.find_by_item_id_and_item_type(@morozovm_comment.id, ::Inkwell::Constants::ItemTypes::COMMENT).id
|
233
233
|
fline[9].is_favorited.should == true
|
234
234
|
for i in 1..8
|
235
235
|
fline[i].is_favorited.should == false
|