Sha256: 30b23f2dede31ca5808789474678caa0f7d742331b5711c24a4a5219635f4fc0
Contents?: true
Size: 1.44 KB
Versions: 19
Compression:
Stored size: 1.44 KB
Contents
module Ddr::Index RSpec.describe Filter do describe "#where(conditions)" do it "should add raw query filters for the field, value hash of conditions" do subject.where("foo"=>"bar", "spam"=>"eggs", "stuff"=>["dog", "cat", "bird"]) expect(subject.clauses).to eq(["{!term f=foo}bar", "{!term f=spam}eggs", "stuff:(dog OR cat OR bird)"]) end end describe "#raw(*clauses)" do it "should add the clauses w/o escaping" do subject.raw("foo:bar", "spam:eggs") expect(subject.clauses).to eq(["foo:bar", "spam:eggs"]) end end describe "#present(field)" do it "should add a \"field present\" clause" do subject.present("foo") expect(subject.clauses).to eq(["foo:[* TO *]"]) end end describe "#absent(field)" do it "should add a \"field not present\" clause" do subject.absent("foo") expect(subject.clauses).to eq(["-foo:[* TO *]"]) end end describe "#before_days(field, days)" do it "should add a date range query clause" do subject.before_days("foo", 60) expect(subject.clauses).to eq(["foo:[* TO NOW-60DAYS]"]) end end describe "#before(field, date_time)" do it "should add a date range query clause" do subject.before("foo", DateTime.parse("Thu, 27 Aug 2015 17:42:34 -0400")) expect(subject.clauses).to eq(["foo:[* TO 2015-08-27T21:42:34Z]"]) end end end end
Version data entries
19 entries across 19 versions & 1 rubygems