spec/mongoid/criteria/queryable/selector_spec.rb in mongoid-8.0.8 vs spec/mongoid/criteria/queryable/selector_spec.rb in mongoid-8.1.0

- old
+ new

@@ -42,11 +42,11 @@ expect(selector['field']).to eq(10) end end end - context "when selector contains a $nin string" do + context "when selector contains a $nin" do let(:initial) do { "$nin" => ["foo"] } end @@ -70,41 +70,13 @@ }) end end end - context "when selector contains a $nin symbol" do + context "when selector contains a $in" do let(:initial) do - { :$nin => ["foo"] } - end - - before do - selector["field"] = initial - end - - context "when merging in a new $nin" do - - let(:other) do - { "field" => { :$nin => ["bar"] } } - end - - before do - selector.merge!(other) - end - - it "combines the two $nin queries into one" do - expect(selector).to eq({ - "field" => { :$nin => ["foo", "bar"] } - }) - end - end - end - - context "when selector contains a $in string" do - - let(:initial) do { "$in" => [1, 2] } end before do selector["field"] = initial @@ -143,55 +115,10 @@ }) end end end - context "when selector contains a $in symbol" do - - let(:initial) do - { :$in => [1, 2] } - end - - before do - selector["field"] = initial - end - - context "when merging in a new $in with an intersecting value" do - - let(:other) do - { "field" => { :$in => [1] } } - end - - before do - selector.merge!(other) - end - - it "intersects the $in values" do - expect(selector).to eq({ - "field" => { :$in => [1] } - }) - end - end - - context "when merging in a new $in with no intersecting values" do - - let(:other) do - { "field" => { :$in => [3] } } - end - - before do - selector.merge!(other) - end - - it "intersects the $in values" do - expect(selector).to eq({ - "field" => { :$in => [] } - }) - end - end - end - context "when selector is not nested" do before do selector[:field] = selection selector.merge!(other) @@ -679,10 +606,11 @@ end end end context "when the serializer is localized" do + with_default_i18n_configs before(:all) do class Field def evolve(object) Integer.evolve(object) @@ -694,10 +622,9 @@ end end after(:all) do Object.send(:remove_const, :Field) - ::I18n.locale = :en end let(:selector) do described_class.new({}, { "key" => Field.new }) end