Fix order:comm and comment deletion for unbumped comments
fixes #1351, fixes #1352
This commit is contained in:
@@ -54,16 +54,16 @@ class CommentTest < ActiveSupport::TestCase
|
||||
|
||||
should "not bump the parent post" do
|
||||
post = FactoryGirl.create(:post)
|
||||
comment = FactoryGirl.create(:comment, :do_not_bump_post => "1", :post => post)
|
||||
comment = FactoryGirl.create(:comment, :do_not_bump_post => true, :post => post)
|
||||
post.reload
|
||||
assert_nil(post.last_commented_at)
|
||||
assert_nil(post.last_comment_bumped_at)
|
||||
|
||||
comment = FactoryGirl.create(:comment, :post => post)
|
||||
post.reload
|
||||
assert_not_nil(post.last_commented_at)
|
||||
assert_not_nil(post.last_comment_bumped_at)
|
||||
end
|
||||
|
||||
should "not update the post after exceeding the threshold" do
|
||||
should "not bump the post after exceeding the threshold" do
|
||||
Danbooru.config.stubs(:comment_threshold).returns(1)
|
||||
p = FactoryGirl.create(:post)
|
||||
c1 = FactoryGirl.create(:comment, :post => p)
|
||||
@@ -71,7 +71,22 @@ class CommentTest < ActiveSupport::TestCase
|
||||
c2 = FactoryGirl.create(:comment, :post => p)
|
||||
end
|
||||
p.reload
|
||||
assert_equal(c1.created_at.to_s, p.last_commented_at.to_s)
|
||||
assert_equal(c1.created_at.to_s, p.last_comment_bumped_at.to_s)
|
||||
end
|
||||
|
||||
should "always record the last_commented_at properly" do
|
||||
post = FactoryGirl.create(:post)
|
||||
Danbooru.config.stubs(:comment_threshold).returns(1)
|
||||
|
||||
c1 = FactoryGirl.create(:comment, :do_not_bump_post => true, :post => post)
|
||||
post.reload
|
||||
assert_equal(c1.created_at.to_s, post.last_commented_at.to_s)
|
||||
|
||||
Timecop.travel(2.seconds.from_now) do
|
||||
c2 = FactoryGirl.create(:comment, :post => post)
|
||||
post.reload
|
||||
assert_equal(c2.created_at.to_s, post.last_commented_at.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
should "not record the user id of the voter" do
|
||||
|
||||
Reference in New Issue
Block a user