Create DataUpdateScript to Index all Tags (#6078) [deploy]
This commit is contained in:
parent
b81c2e8df3
commit
ef9611d745
2 changed files with 20 additions and 0 deletions
|
|
@ -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
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue