more fixes for post ownership change and user deletion

This commit is contained in:
Neil Lalonde
2015-03-11 15:54:11 -04:00
parent 5de563fd2f
commit dece5a351a
3 changed files with 37 additions and 15 deletions

View File

@@ -43,8 +43,8 @@ describe PostOwnerChanger do
topic.user_id = p1user.id
topic.save!
p1user.user_stat.update_attributes(topic_count: 1, post_count: 1)
p2user.user_stat.update_attributes(topic_count: 0, post_count: 1)
p1user.user_stat.update_attributes(topic_count: 1, post_count: 1, first_post_created_at: p1.created_at, topic_reply_count: 0)
p2user.user_stat.update_attributes(topic_count: 0, post_count: 1, first_post_created_at: p2.created_at, topic_reply_count: 1)
UserAction.create!( action_type: UserAction::NEW_TOPIC, user_id: p1user.id, acting_user_id: p1user.id,
target_post_id: p1.id, target_topic_id: p1.topic_id, created_at: p1.created_at )
@@ -66,6 +66,11 @@ describe PostOwnerChanger do
p2user.post_count.should == 0
user_a.topic_count.should == 1
user_a.post_count.should == 2
p1user.user_stat.first_post_created_at.should == nil
p2user.user_stat.first_post_created_at.should == nil
p1user.user_stat.topic_reply_count.should == 0
p2user.user_stat.topic_reply_count.should == 0
[p1.created_at, p2.created_at].should include(user_a.user_stat.first_post_created_at)
end
it "updates UserAction records" do