test/dummy/spec/functional/reblog_spec.rb in inkwell-0.0.3 vs test/dummy/spec/functional/reblog_spec.rb in inkwell-0.1.1
- old
+ new
@@ -106,19 +106,22 @@
end
it "timeline items should delete for followers when user unreblog post" do
@talisman = User.create :nick => "Talisman"
@talisman.follow @morozovm
+ @morozovm_post = @morozovm.posts.create :body => "morozovm_post_test_body"
@morozovm.reblog @salkar_post
+ @talisman.timeline_items.size.should == 2
@talisman.timeline_items.where(:item_id => @salkar_post, :is_comment => false).size.should == 1
- item = @talisman.timeline_items.first
+ item = @talisman.timeline_items.where(:item_id => @salkar_post, :is_comment => false).first
item.has_many_sources.should == false
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @morozovm.id, 'type' => 'reblog'}])
@morozovm.unreblog @salkar_post
@talisman.timeline_items.where(:item_id => @salkar_post, :is_comment => false).size.should == 0
+ @talisman.timeline_items.size.should == 1
end
it "timeline items should delete for followers when user unreblog comment" do
@talisman = User.create :nick => "Talisman"
@talisman.follow @morozovm
@@ -136,18 +139,41 @@
it "timeline item should not been delete if post has many sources and unreblogged by following" do
@talisman = User.create :nick => "Talisman"
@talisman.reblog @salkar_post
@morozovm.follow @talisman
@morozovm.follow @salkar
+ @talisman_post = @talisman.posts.create :body => "talisman_post_test_body"
+ @morozovm.timeline_items.size == 2
@morozovm.timeline_items.where(:item_id => @salkar_post, :is_comment => false).size.should == 1
item = @morozovm.timeline_items.where(:item_id => @salkar_post, :is_comment => false).first
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @talisman.id, 'type' => 'reblog'}, {'user_id' => @salkar.id, 'type' => 'following'}])
item.has_many_sources.should == true
@talisman.unreblog @salkar_post
@morozovm.timeline_items.where(:item_id => @salkar_post, :is_comment => false).size.should == 1
item = @morozovm.timeline_items.where(:item_id => @salkar_post, :is_comment => false).first
item.from_source.should == ActiveSupport::JSON.encode([{'user_id' => @salkar.id, 'type' => 'following'}])
item.has_many_sources.should == false
+ @morozovm.timeline_items.size == 2
+ end
+
+ it "reblog count should been received for post" do
+ @talisman = User.create :nick => "Talisman"
+ @salkar_post.reload
+ @salkar_post.reblog_count.should == 0
+ @morozovm.reblog @salkar_post
+ @talisman.reblog @salkar_post
+ @salkar_post.reload
+ @salkar_post.reblog_count.should == 2
+ end
+
+ it "reblog count should been received for post" do
+ @talisman = User.create :nick => "Talisman"
+ @salkar_comment.reload
+ @salkar_comment.reblog_count.should == 0
+ @morozovm.reblog @salkar_comment
+ @talisman.reblog @salkar_comment
+ @salkar_comment.reload
+ @salkar_comment.reblog_count.should == 2
end
end
\ No newline at end of file