fixed unit tests

This commit is contained in:
albert
2010-03-18 18:35:16 -04:00
parent 06a959a9fd
commit be10906044
4 changed files with 6 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ class Comment < ActiveRecord::Base
attr_accessor :do_not_bump_post
scope :recent, :order => "comments.id desc", :limit => 6
scope :search_body, lambda {|query| where("body_index @@ plainto_tsquery(?)", query)}
scope :search_body, lambda {|query| where("body_index @@ plainto_tsquery(?)", query).order("comments.id DESC")}
scope :hidden, lambda {|user| where("score < ?", user.comment_threshold)}
def update_last_commented_at

View File

@@ -2,7 +2,7 @@ require 'fileutils'
Factory.define(:upload) do |f|
f.rating "s"
f.uploader {|x| x.association(:user)}
f.uploader {|x| x.association(:user, :is_contributor => true)}
f.uploader_ip_addr "127.0.0.1"
f.tag_string "special"
f.status "pending"

View File

@@ -147,11 +147,11 @@ class BanTest < ActiveSupport::TestCase
user = Factory.create(:user)
ban = Factory.create(:ban, :user => user, :banner => admin, :duration => -1)
assert(!Ban.is_user_banned?(user))
assert(!Ban.is_banned?(user))
user = Factory.create(:user)
ban = Factory.create(:ban, :user => user, :banner => admin, :duration => 1)
assert(Ban.is_user_banned?(user))
assert(Ban.is_banned?(user))
end
end
end

View File

@@ -125,7 +125,7 @@ class UploadTest < ActiveSupport::TestCase
assert_equal(110, post.image_height)
assert_equal(8558, post.file_size)
assert_equal(post.id, @upload.post_id)
assert_equal("finished", @upload.status)
assert_equal("completed", @upload.status)
end
end
@@ -151,6 +151,6 @@ class UploadTest < ActiveSupport::TestCase
assert(File.exists?(post.file_path))
assert_equal(28086, File.size(post.file_path))
assert_equal(post.id, @upload.post_id)
assert_equal("finished", @upload.status)
assert_equal("completed", @upload.status)
end
end