DEV: Refactor reindex_search_spec.

Follow-up 20dc845418
This commit is contained in:
Guo Xiang Tan 2020-07-24 09:29:54 +08:00
parent 20dc845418
commit 0cbf86f1e7
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
1 changed files with 9 additions and 4 deletions

View File

@ -35,16 +35,21 @@ describe Jobs::ReindexSearch do
describe 'rebuild_problem_posts' do describe 'rebuild_problem_posts' do
class FakeIndexer class FakeIndexer
def self.index(post, force:) def self.index(post, force:)
@posts ||= [] get_posts.push(post)
@posts.push(post)
end end
def self.posts def self.posts
@posts ||= [] get_posts
end end
def self.reset def self.reset
@posts.clear get_posts.clear
end
private
def self.get_posts
@posts ||= []
end end
end end