forked from e621ng/e621ng
[Tests] Fix pool related errors in tests
This commit is contained in:
parent
46fe5f1164
commit
dbb5870d93
@ -225,19 +225,19 @@ module PostIndex
|
||||
|
||||
file_size: file_size,
|
||||
parent: parent_id,
|
||||
pools: options[:pools] || Pool.where("post_ids @> '{?}'", id).pluck(:id),
|
||||
sets: options[:sets] || PostSet.where("post_ids @> '{?}'", id).pluck(:id),
|
||||
commenters: options[:commenters] || Comment.undeleted.where(post_id: id).pluck(:creator_id),
|
||||
noters: options[:noters] || Note.active.where(post_id: id).pluck(:creator_id),
|
||||
faves: options[:faves] || Favorite.where(post_id: id).pluck(:user_id),
|
||||
upvotes: options[:upvotes] || PostVote.where(post_id: id).where("score > 0").pluck(:user_id),
|
||||
downvotes: options[:downvotes] || PostVote.where(post_id: id).where("score < 0").pluck(:user_id),
|
||||
children: options[:children] || Post.where(parent_id: id).pluck(:id),
|
||||
notes: options[:notes] || Note.active.where(post_id: id).pluck(:body),
|
||||
pools: options[:pools] || ::Pool.where("post_ids @> '{?}'", id).pluck(:id),
|
||||
sets: options[:sets] || ::PostSet.where("post_ids @> '{?}'", id).pluck(:id),
|
||||
commenters: options[:commenters] || ::Comment.undeleted.where(post_id: id).pluck(:creator_id),
|
||||
noters: options[:noters] || ::Note.active.where(post_id: id).pluck(:creator_id),
|
||||
faves: options[:faves] || ::Favorite.where(post_id: id).pluck(:user_id),
|
||||
upvotes: options[:upvotes] || ::PostVote.where(post_id: id).where("score > 0").pluck(:user_id),
|
||||
downvotes: options[:downvotes] || ::PostVote.where(post_id: id).where("score < 0").pluck(:user_id),
|
||||
children: options[:children] || ::Post.where(parent_id: id).pluck(:id),
|
||||
notes: options[:notes] || ::Note.active.where(post_id: id).pluck(:body),
|
||||
uploader: uploader_id,
|
||||
approver: approver_id,
|
||||
deleter: options[:deleter] || PostFlag.where(post_id: id, is_resolved: false, is_deletion: true).order(id: :desc).first&.creator_id,
|
||||
del_reason: options[:del_reason] || PostFlag.where(post_id: id, is_resolved: false, is_deletion: true).order(id: :desc).first&.reason&.downcase,
|
||||
deleter: options[:deleter] || ::PostFlag.where(post_id: id, is_resolved: false, is_deletion: true).order(id: :desc).first&.creator_id,
|
||||
del_reason: options[:del_reason] || ::PostFlag.where(post_id: id, is_resolved: false, is_deletion: true).order(id: :desc).first&.reason&.downcase,
|
||||
width: image_width,
|
||||
height: image_height,
|
||||
mpixels: image_width && image_height ? (image_width.to_f * image_height / 1_000_000).round(2) : 0.0,
|
||||
|
@ -393,7 +393,7 @@ class Pool < ApplicationRecord
|
||||
errors[:name] << "cannot contain only digits"
|
||||
when /,/
|
||||
errors.add(:name, "cannot contain commas")
|
||||
when /[_- ]{2}/
|
||||
when /[_\- ]{2}/
|
||||
errors.add(:name, "cannot contain consecutive underscores, hyphens or spaces")
|
||||
end
|
||||
end
|
||||
|
@ -15,7 +15,6 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
CurrentUser.user = @user
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
mock_pool_archive_service!
|
||||
Post.__elasticsearch__.index_name = "posts_test"
|
||||
Post.__elasticsearch__.create_index!
|
||||
end
|
||||
@ -774,7 +773,6 @@ class PostTest < ActiveSupport::TestCase
|
||||
|
||||
context "for a pool" do
|
||||
setup do
|
||||
mock_pool_archive_service!
|
||||
start_pool_archive_transaction
|
||||
end
|
||||
|
||||
@ -1603,10 +1601,6 @@ class PostTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
context "Searching:" do
|
||||
setup do
|
||||
mock_pool_archive_service!
|
||||
end
|
||||
|
||||
should "return posts for the age:<1minute tag" do
|
||||
post = FactoryBot.create(:post)
|
||||
assert_tag_match([post], "age:<1minute")
|
||||
|
Loading…
Reference in New Issue
Block a user