about summary refs log tree commit diff
path: root/spec/lib/search_query_transformer_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/search_query_transformer_spec.rb')
-rw-r--r--spec/lib/search_query_transformer_spec.rb18
1 files changed, 18 insertions, 0 deletions
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