about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-03-22 09:06:26 -0400
committerGitHub <noreply@github.com>2023-03-22 14:06:26 +0100
commitb179ff84c76b79f91793fdb23e5e9c84ad46707a (patch)
tree735529f8c552803344a5eb89c4700814933171fc
parent148c3d589461440400c2850cecc79c45a70bdca6 (diff)
Add specs for Chewy importers (#24204)
-rw-r--r--spec/lib/importer/accounts_index_importer_spec.rb16
-rw-r--r--spec/lib/importer/statuses_index_importer_spec.rb16
-rw-r--r--spec/lib/importer/tags_index_importer_spec.rb16
3 files changed, 48 insertions, 0 deletions
diff --git a/spec/lib/importer/accounts_index_importer_spec.rb b/spec/lib/importer/accounts_index_importer_spec.rb
new file mode 100644
index 000000000..73f9bce39
--- /dev/null
+++ b/spec/lib/importer/accounts_index_importer_spec.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Importer::AccountsIndexImporter do
+  describe 'import!' do
+    let(:pool) { Concurrent::FixedThreadPool.new(5) }
+    let(:importer) { described_class.new(batch_size: 123, executor: pool) }
+
+    before { Fabricate(:account) }
+
+    it 'indexes relevant accounts' do
+      expect { importer.import! }.to update_index(AccountsIndex)
+    end
+  end
+end
diff --git a/spec/lib/importer/statuses_index_importer_spec.rb b/spec/lib/importer/statuses_index_importer_spec.rb
new file mode 100644
index 000000000..d5e1c9f2c
--- /dev/null
+++ b/spec/lib/importer/statuses_index_importer_spec.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Importer::StatusesIndexImporter do
+  describe 'import!' do
+    let(:pool) { Concurrent::FixedThreadPool.new(5) }
+    let(:importer) { described_class.new(batch_size: 123, executor: pool) }
+
+    before { Fabricate(:status) }
+
+    it 'indexes relevant statuses' do
+      expect { importer.import! }.to update_index(StatusesIndex)
+    end
+  end
+end
diff --git a/spec/lib/importer/tags_index_importer_spec.rb b/spec/lib/importer/tags_index_importer_spec.rb
new file mode 100644
index 000000000..348990c01
--- /dev/null
+++ b/spec/lib/importer/tags_index_importer_spec.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Importer::TagsIndexImporter do
+  describe 'import!' do
+    let(:pool) { Concurrent::FixedThreadPool.new(5) }
+    let(:importer) { described_class.new(batch_size: 123, executor: pool) }
+
+    before { Fabricate(:tag) }
+
+    it 'indexes relevant tags' do
+      expect { importer.import! }.to update_index(TagsIndex)
+    end
+  end
+end