Use webmock instead of fakeweb for VCR; Fix tests; Use Timecop to speed up tests previously using sleep; Move artist rename into seperate operation
This commit is contained in:
@@ -67,8 +67,9 @@ class CommentTest < ActiveSupport::TestCase
|
||||
Danbooru.config.stubs(:comment_threshold).returns(1)
|
||||
p = FactoryGirl.create(:post)
|
||||
c1 = FactoryGirl.create(:comment, :post => p)
|
||||
sleep 1
|
||||
c2 = FactoryGirl.create(:comment, :post => p)
|
||||
Timecop.travel(2.seconds.from_now) do
|
||||
c2 = FactoryGirl.create(:comment, :post => p)
|
||||
end
|
||||
p.reload
|
||||
assert_equal(c1.created_at.to_s, p.last_commented_at.to_s)
|
||||
end
|
||||
|
||||
@@ -21,8 +21,9 @@ class ForumPostTest < ActiveSupport::TestCase
|
||||
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))
|
||||
Timecop.travel(2.seconds.from_now) do
|
||||
@posts << FactoryGirl.create(:forum_post, :topic_id => @topic.id, :body => rand(100_000))
|
||||
end
|
||||
end
|
||||
|
||||
should "know which page it's on" do
|
||||
@@ -59,11 +60,12 @@ class ForumPostTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "update its parent when saved" do
|
||||
sleep 1
|
||||
original_topic_updated_at = @topic.updated_at
|
||||
Timecop.travel(1.second.from_now) do
|
||||
@original_topic_updated_at = @topic.updated_at
|
||||
end
|
||||
post = FactoryGirl.create(:forum_post, :topic_id => @topic.id)
|
||||
@topic.reload
|
||||
assert_not_equal(original_topic_updated_at, @topic.updated_at)
|
||||
assert_not_equal(@original_topic_updated_at, @topic.updated_at)
|
||||
end
|
||||
|
||||
should "be searchable by body content" do
|
||||
|
||||
Reference in New Issue
Block a user