FIX: when blocking a user results in hiding their posts, only hide posts made in the last 24 hours

This commit is contained in:
Neil Lalonde
2017-01-19 15:56:14 -05:00
parent 99f9adaf50
commit 6b93b09404
2 changed files with 12 additions and 2 deletions

View File

@@ -118,6 +118,16 @@ describe UserBlocker do
expect(post.reload).to_not be_hidden
expect(post.topic.reload).to be_visible
end
it "only hides posts from the past 24 hours" do
old_post = Fabricate(:post, user: user, created_at: 2.days.ago)
subject.block
expect(post.reload).to be_hidden
expect(post.topic.reload).to_not be_visible
old_post.reload
expect(old_post).to_not be_hidden
expect(old_post.topic).to be_visible
end
end
end