fixed unit tests
This commit is contained in:
@@ -9,7 +9,7 @@ class Comment < ActiveRecord::Base
|
|||||||
attr_accessor :do_not_bump_post
|
attr_accessor :do_not_bump_post
|
||||||
|
|
||||||
scope :recent, :order => "comments.id desc", :limit => 6
|
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)}
|
scope :hidden, lambda {|user| where("score < ?", user.comment_threshold)}
|
||||||
|
|
||||||
def update_last_commented_at
|
def update_last_commented_at
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ require 'fileutils'
|
|||||||
|
|
||||||
Factory.define(:upload) do |f|
|
Factory.define(:upload) do |f|
|
||||||
f.rating "s"
|
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.uploader_ip_addr "127.0.0.1"
|
||||||
f.tag_string "special"
|
f.tag_string "special"
|
||||||
f.status "pending"
|
f.status "pending"
|
||||||
|
|||||||
@@ -147,11 +147,11 @@ class BanTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
user = Factory.create(:user)
|
user = Factory.create(:user)
|
||||||
ban = Factory.create(:ban, :user => user, :banner => admin, :duration => -1)
|
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)
|
user = Factory.create(:user)
|
||||||
ban = Factory.create(:ban, :user => user, :banner => admin, :duration => 1)
|
ban = Factory.create(:ban, :user => user, :banner => admin, :duration => 1)
|
||||||
assert(Ban.is_user_banned?(user))
|
assert(Ban.is_banned?(user))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
assert_equal(110, post.image_height)
|
assert_equal(110, post.image_height)
|
||||||
assert_equal(8558, post.file_size)
|
assert_equal(8558, post.file_size)
|
||||||
assert_equal(post.id, @upload.post_id)
|
assert_equal(post.id, @upload.post_id)
|
||||||
assert_equal("finished", @upload.status)
|
assert_equal("completed", @upload.status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -151,6 +151,6 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
assert(File.exists?(post.file_path))
|
assert(File.exists?(post.file_path))
|
||||||
assert_equal(28086, File.size(post.file_path))
|
assert_equal(28086, File.size(post.file_path))
|
||||||
assert_equal(post.id, @upload.post_id)
|
assert_equal(post.id, @upload.post_id)
|
||||||
assert_equal("finished", @upload.status)
|
assert_equal("completed", @upload.status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user