test/dummy/spec/functional/comments_spec.rb in inkwell-0.0.3 vs test/dummy/spec/functional/comments_spec.rb in inkwell-0.1.1
- old
+ new
@@ -57,11 +57,11 @@
commentline = @salkar_post.commentline
commentline.size.should == 10
commentline[0].id.should == @comment2.id
commentline[9].id.should == @comment11.id
- commentline = @salkar_post.commentline @comment10.id
+ commentline = @salkar_post.commentline :last_shown_comment_id => @comment10.id
commentline.size.should == 10
commentline[0].id.should == @comment.id
commentline[9].id.should == @comment9.id
end
@@ -78,21 +78,21 @@
@comment8 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
@comment9 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
@comment10 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
@comment11 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
- commentline = @salkar_post.commentline nil, 5
+ commentline = @salkar_post.commentline :limit => 5
commentline.size.should == 5
commentline[0].id.should == @comment7.id
commentline[4].id.should == @comment11.id
- commentline = @salkar_post.commentline @comment10.id, 5
+ commentline = @salkar_post.commentline :last_shown_comment_id => @comment10.id, :limit => 5
commentline.size.should == 5
commentline[0].id.should == @comment5.id
commentline[4].id.should == @comment9.id
- commentline = @salkar_post.commentline @comment5.id, 7
+ commentline = @salkar_post.commentline :last_shown_comment_id => @comment5.id, :limit => 7
commentline.size.should == 5
commentline[0].id.should == @comment.id
commentline[4].id.should == @comment4.id
end
@@ -282,11 +282,11 @@
commentline = @comment.commentline
commentline.size.should == 10
commentline[0].id.should == @comment2.id
commentline[9].id.should == @comment11.id
- commentline = @salkar_post.commentline @comment10.id
+ commentline = @salkar_post.commentline :last_shown_comment_id => @comment10.id
commentline.size.should == 10
commentline[0].id.should == @comment.id
commentline[9].id.should == @comment9.id
end
@@ -308,11 +308,11 @@
commentline = @comment.commentline
commentline.size.should == 10
commentline[0].id.should == @comment2.id
commentline[9].id.should == @comment11.id
- commentline = @salkar_post.commentline @comment10.id
+ commentline = @salkar_post.commentline :last_shown_comment_id => @comment10.id
commentline.size.should == 10
commentline[0].id.should == @comment.id
commentline[9].id.should == @comment9.id
end
@@ -329,23 +329,23 @@
@comment9 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment5.id)
@comment10 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment4.id)
@comment11 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
@comment.reload
- commentline = @comment.commentline nil, 5
+ commentline = @comment.commentline :limit => 5
commentline.size.should == 5
commentline[0].id.should == @comment7.id
commentline[4].id.should == @comment11.id
@comment.reload
- commentline = @comment.commentline @comment10.id, 5
+ commentline = @comment.commentline :last_shown_comment_id => @comment10.id, :limit => 5
commentline.size.should == 5
commentline[0].id.should == @comment5.id
commentline[4].id.should == @comment9.id
@comment.reload
- commentline = @comment.commentline @comment5.id, 7
+ commentline = @comment.commentline :last_shown_comment_id => @comment5.id, :limit => 7
commentline.size.should == 4
commentline[0].id.should == @comment1.id
commentline[3].id.should == @comment4.id
end
@@ -355,17 +355,17 @@
@comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
@salkar.favorite @comment1
@morozovm.favorite @comment2
@comment.reload
- commentline = @comment.commentline nil, 10, @salkar
+ commentline = @comment.commentline :for_user => @salkar
commentline[0].id.should == @comment1.id
commentline[0].is_favorited.should == true
commentline[1].id.should == @comment2.id
commentline[1].is_favorited.should == false
- commentline = @comment.commentline nil, 10, @morozovm
+ commentline = @comment.commentline :for_user => @morozovm
commentline[0].id.should == @comment1.id
commentline[0].is_favorited.should == false
commentline[1].id.should == @comment2.id
commentline[1].is_favorited.should == true
end
@@ -376,20 +376,41 @@
@comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
@salkar.favorite @comment1
@morozovm.favorite @comment2
@salkar_post.reload
- commentline = @salkar_post.commentline nil, 10, @salkar
+ commentline = @salkar_post.commentline :for_user => @salkar
commentline[1].id.should == @comment1.id
commentline[1].is_favorited.should == true
commentline[2].id.should == @comment2.id
commentline[2].is_favorited.should == false
- commentline = @salkar_post.commentline nil, 10, @morozovm
+ commentline = @salkar_post.commentline :for_user => @morozovm
commentline[1].id.should == @comment1.id
commentline[1].is_favorited.should == false
commentline[2].id.should == @comment2.id
commentline[2].is_favorited.should == true
+ end
+
+ it "comment count for post should been received" do
+ @salkar_post.comments.size.should == 0
+ @salkar_post.comment_count.should == 0
+ @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
+ @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
+ @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
+ @salkar_post.reload
+ @salkar_post.comments.size.should == 3
+ @salkar_post.comment_count.should == 3
+ end
+
+ it "comment count for comment should been received" do
+ @comment = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id)
+ @comment.reload
+ @comment.comment_count.should == 0
+ @comment1 = @morozovm.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
+ @comment2 = @salkar.comments.create(:body => 'Lets You Party Like a Facebook User', :post_id => @salkar_post.id, :parent_id => @comment.id)
+ @comment.reload
+ @comment.comment_count.should == 2
end
end
\ No newline at end of file