Sha256: 9f8006813bb3a2ce50b4902a011b6db25725e38efff81296a718e970c38a1d56
Contents?: true
Size: 1.71 KB
Versions: 7
Compression:
Stored size: 1.71 KB
Contents
RSpec.describe Symphonia::Query do subject do q = described_class.new q.model = DummyQueryEntity q end describe "#available_filters" do it "include name filter" do expect(subject.available_filters.first&.name).to eq :name end end describe "#initialize" do it "empty" do q = described_class.new q.model = DummyQueryEntity expect(q.entity).to eq DummyQueryEntity expect(q.filters).to be_blank end it "default filters" do q = described_class.new(filters: { name: "!cip" }) q.model = DummyQueryEntity expect(q.filters.size).to eq 1 filter = q.filters.first expect(filter.value).to eq "cip" end it "legacy fallback" do expect(ActiveSupport::Deprecation).to receive(:warn).twice described_class.new(spy("Controller"), default_order: "cip") end end describe "#from_params" do it "blank" do q = DummyQueryEntity.query.new(filters: { name: "!clip" }) expect { q.from_params({}) }.not_to raise_error expect(q.filters).not_to be_blank end it "with filters" do q = DummyQueryEntity.query.new(filters: { name: "!clip" }) expect { q.from_params(set_filter: "1") }.not_to raise_error expect(q.filters).to be_blank end it "columns" do q = DummyQueryEntity.query.new expect(q.column_names).to match_array [:name, :status, :author] q.from_params(column_names: "name") expect(q.column_names).to match_array [:name] end end describe "#entities" do it "get entities" do # scope = spy # expect(subject).to receive(:scope).and_return(scope) Symphonia::User.query.new.entities end end describe "#columns" do end end
Version data entries
7 entries across 7 versions & 1 rubygems