spec/parse_adapter_spec.rb in dm-parse-0.3.14 vs spec/parse_adapter_spec.rb in dm-parse-0.3.15

- old
+ new

@@ -100,20 +100,25 @@ let(:query) { model.all(:rank.not => [2, 3]).query } it { should eq("rank" => {"$nin" => [2, 3]}) } end end + context "when query has :eql and others of one field" do + let(:query) { model.all(:rank => 5, :rank.gt => 3).query } + it { should eq("rank" => 5) } + end + + context "when query has [\"0 = 1\"]" do + let(:query) { model.all(conditions: ["0 = 1"]).query } + it { should eq({}) } + end + describe "exceptions" do subject { -> { adapter.send :parse_conditions_for, query } } context "when the key is same" do let(:query) { (model.all("rank" => 5) & model.all("rank" => 3)).query } it { should raise_error("can only use one EqualToComparison for a field") } - end - - context "when query has :eql and others of one field" do - let(:query) { model.all(:rank => 5, :rank.gt => 3).query } - it { should raise_error } end end # exceptions end # #parse_conditions_for describe "#parse_orders_for" do