Create DataUpdateScript to Index all Tags (#6078) [deploy]

This commit is contained in:
Molly Struve 2020-02-14 14:17:52 -05:00 committed by GitHub
parent b81c2e8df3
commit ef9611d745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,9 @@
module DataUpdateScripts
class IndexTagsToElasticsearch
def run
# Choose to do inline so development envs are ready
# immediately after this is run
Tag.find_each(&:index_to_elasticsearch_inline)
end
end
end

View file

@ -0,0 +1,11 @@
require "rails_helper"
require Rails.root.join("lib/data_update_scripts/20200214171607_index_tags_to_elasticsearch.rb")
describe DataUpdateScripts::IndexTagsToElasticsearch, elasticsearch: true do
it "indexes tags to Elasticsearch" do
tag = FactoryBot.create(:tag)
expect { tag.elasticsearch_doc }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
described_class.new.run
expect(tag.elasticsearch_doc).not_to be_nil
end
end