Sha256: e44464ad56881007e071f8f21ed570208c08e601d720362b451f219890aee5b9
Contents?: true
Size: 1.36 KB
Versions: 15
Compression:
Stored size: 1.36 KB
Contents
module Ddr::Index RSpec.describe Query do describe "initialized with attributes" do let(:id) { UniqueKeyField.instance } let(:foo) { Field.new("foo") } let(:spam) { Field.new("spam") } let(:filter) { Filter.where(spam=>"eggs") } let(:sort_order) { SortOrder.new(field: foo, order: "asc") } let(:fields) { [id, foo, spam] } subject { described_class.new(q: "foo:bar", filters: [filter], fields: fields, sort: sort_order, rows: 50) } its(:to_s) { is_expected.to eq "q=foo%3Abar&fq=spam%3Aeggs&fl=id%2Cfoo%2Cspam&sort=foo+asc&rows=50" } its(:params) { is_expected.to eq({q: "foo:bar", fl: "id,foo,spam", fq: ["spam:eggs"], sort: "foo asc", rows: 50}) } end describe "initialized with a block" do subject { described_class.new do q "foo:bar" where "spam"=>"eggs" fields :id, "foo", "spam" asc "foo" limit 50 end } its(:to_s) { is_expected.to eq "q=foo%3Abar&fq=spam%3Aeggs&fl=id%2Cfoo%2Cspam&sort=foo+asc&rows=50" } its(:params) { is_expected.to eq({q: "foo:bar", fl: "id,foo,spam", fq: ["spam:eggs"], sort: "foo asc", rows: 50}) } end end end
Version data entries
15 entries across 15 versions & 1 rubygems