about summary refs log tree commit diff
path: root/spec/lib
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-03-10 07:33:30 -0500
committerGitHub <noreply@github.com>2023-03-10 13:33:30 +0100
commit688287c59d526ef76089322a368789f5846c6ac3 (patch)
tree0a89ad3e71b45b123388898cc67f93ed5a022b91 /spec/lib
parent56bddfbfa39956ea3a8c52721eb364b1120634f6 (diff)
Coverage improvement round-out following up previous work (#23987)
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/importer/base_importer_spec.rb14
-rw-r--r--spec/lib/search_query_transformer_spec.rb18
2 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/importer/base_importer_spec.rb b/spec/lib/importer/base_importer_spec.rb
new file mode 100644
index 000000000..78e9a869b
--- /dev/null
+++ b/spec/lib/importer/base_importer_spec.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe Importer::BaseImporter do
+  describe 'import!' do
+    let(:pool) { Concurrent::FixedThreadPool.new(5) }
+    let(:importer) { described_class.new(batch_size: 123, executor: pool) }
+
+    it 'raises an error' do
+      expect { importer.import! }.to raise_error(NotImplementedError)
+    end
+  end
+end
diff --git a/spec/lib/search_query_transformer_spec.rb b/spec/lib/search_query_transformer_spec.rb
new file mode 100644
index 000000000..109533469
--- /dev/null
+++ b/spec/lib/search_query_transformer_spec.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe SearchQueryTransformer do
+  describe 'initialization' do
+    let(:parser) { SearchQueryParser.new.parse('query') }
+
+    it 'sets attributes' do
+      transformer = described_class.new.apply(parser)
+
+      expect(transformer.should_clauses.first).to be_a(SearchQueryTransformer::TermClause)
+      expect(transformer.must_clauses.first).to be_nil
+      expect(transformer.must_not_clauses.first).to be_nil
+      expect(transformer.filter_clauses.first).to be_nil
+    end
+  end
+end