diff --git a/app/workers/search/chat_channel_membership_es_index_worker.rb b/app/workers/search/chat_channel_membership_es_index_worker.rb deleted file mode 100644 index 3a0323882..000000000 --- a/app/workers/search/chat_channel_membership_es_index_worker.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Search - class ChatChannelMembershipEsIndexWorker - include Sidekiq::Worker - - sidekiq_options queue: :high_priority - - def perform(chat_channel_membership_id) - chat_channel_membership = ::ChatChannelMembership.find(chat_channel_membership_id) - chat_channel_membership.index_to_elasticsearch_inline - end - end -end diff --git a/app/workers/search/classified_listing_es_index_worker.rb b/app/workers/search/classified_listing_es_index_worker.rb deleted file mode 100644 index f660291da..000000000 --- a/app/workers/search/classified_listing_es_index_worker.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Search - class ClassifiedListingEsIndexWorker - include Sidekiq::Worker - - sidekiq_options queue: :high_priority - - def perform(classified_listing_id) - classified_listing = ::ClassifiedListing.find(classified_listing_id) - classified_listing.index_to_elasticsearch_inline - end - end -end diff --git a/app/workers/search/tag_es_index_worker.rb b/app/workers/search/tag_es_index_worker.rb deleted file mode 100644 index 6752d7dd7..000000000 --- a/app/workers/search/tag_es_index_worker.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Search - class TagEsIndexWorker - include Sidekiq::Worker - - sidekiq_options queue: :high_priority - - def perform(tag_id) - tag = ::Tag.find(tag_id) - tag.index_to_elasticsearch_inline - end - end -end diff --git a/spec/workers/search/chat_channel_membership_es_index_worker_spec.rb b/spec/workers/search/chat_channel_membership_es_index_worker_spec.rb deleted file mode 100644 index e48eb32b7..000000000 --- a/spec/workers/search/chat_channel_membership_es_index_worker_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "rails_helper" - -RSpec.describe Search::ChatChannelMembershipEsIndexWorker, type: :worker, elasticsearch: true do - let(:worker) { subject } - - include_examples "#enqueues_on_correct_queue", "high_priority", [1] - - it "raises an error if record is not found" do - expect { worker.perform(1234) }.to raise_error(ActiveRecord::RecordNotFound) - end - - it "indexes chat_channel_membership" do - chat_channel_membership = FactoryBot.create(:chat_channel_membership) - expect { chat_channel_membership.elasticsearch_doc }.to raise_error(Search::Errors::Transport::NotFound) - worker.perform(chat_channel_membership.id) - expected_hash = chat_channel_membership.serialized_search_hash.stringify_keys - expect(chat_channel_membership.elasticsearch_doc.dig("_source")).to include( - expected_hash, - ) - end -end diff --git a/spec/workers/search/classified_listing_es_index_worker_spec.rb b/spec/workers/search/classified_listing_es_index_worker_spec.rb deleted file mode 100644 index ab1d7ce93..000000000 --- a/spec/workers/search/classified_listing_es_index_worker_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require "rails_helper" - -RSpec.describe Search::ClassifiedListingEsIndexWorker, type: :worker, elasticsearch: true do - let(:worker) { subject } - - include_examples "#enqueues_on_correct_queue", "high_priority", [1] - - it "raises an error if record is not found" do - expect { worker.perform(1234) }.to raise_error(ActiveRecord::RecordNotFound) - end - - it "indexes classified_listing" do - classified_listing = FactoryBot.create(:classified_listing) - expect { classified_listing.elasticsearch_doc }.to raise_error(Search::Errors::Transport::NotFound) - worker.perform(classified_listing.id) - - elasticsearch_doc = classified_listing.elasticsearch_doc.dig("_source").deep_symbolize_keys - cl_serialized_search_hash = classified_listing.serialized_search_hash.deep_symbolize_keys - - expect(elasticsearch_doc[:id]).to eq(cl_serialized_search_hash[:id]) - expect(elasticsearch_doc[:author][:name]).to eq(cl_serialized_search_hash[:author][:name]) - expect(elasticsearch_doc[:body_markdown]).to eq(cl_serialized_search_hash[:body_markdown]) - end -end diff --git a/spec/workers/search/tag_es_index_worker_spec.rb b/spec/workers/search/tag_es_index_worker_spec.rb deleted file mode 100644 index b3700013a..000000000 --- a/spec/workers/search/tag_es_index_worker_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "rails_helper" - -RSpec.describe Search::TagEsIndexWorker, type: :worker, elasticsearch: true do - let(:worker) { subject } - - include_examples "#enqueues_on_correct_queue", "high_priority", [1] - - it "raises an error if record is not found" do - expect { worker.perform(1234) }.to raise_error(ActiveRecord::RecordNotFound) - end - - it "indexes tag" do - tag = FactoryBot.create(:tag) - expect { tag.elasticsearch_doc }.to raise_error(Search::Errors::Transport::NotFound) - worker.perform(tag.id) - expect(tag.elasticsearch_doc.dig("_source")).to eq( - tag.serialized_search_hash.stringify_keys, - ) - end -end