This commit is contained in:
r888888888
2013-05-07 17:20:42 -07:00
parent c8f83f1442
commit 72b18051f8
2 changed files with 16 additions and 3 deletions

View File

@@ -18,9 +18,11 @@ class ForumPostTest < ActiveSupport::TestCase
setup do
Danbooru.config.stubs(:posts_per_page).returns(3)
@posts = []
10.times do
9.times do
@posts << FactoryGirl.create(:forum_post, :topic_id => @topic.id, :body => rand(100_000))
end
sleep 2
@posts << FactoryGirl.create(:forum_post, :topic_id => @topic.id, :body => rand(100_000))
end
should "know which page it's on" do
@@ -29,6 +31,12 @@ class ForumPostTest < ActiveSupport::TestCase
assert_equal(2, @posts[5].forum_topic_page)
assert_equal(3, @posts[6].forum_topic_page)
end
should "update the topic's updated_at when deleted" do
@posts.last.destroy
@topic.reload
assert_equal(@posts[0].updated_at.to_s, @topic.updated_at.to_s)
end
end
context "belonging to a locked topic" do