We were also running into the same issue, and altho we were using the filter_records method (which run the sort_records method). The test that Sebastian metiond also failed. We just made a change that creates the ids for the records in an incremental way, instead of randomly and now all the tests pass all the time.
Manuel On Aug 22, 8:43 pm, "Dan Kubb (dkubb)" <[email protected]> wrote: > Sebastian > > > > > > > i am currently testing my ownadapterto conform to thesharedadapter > > spec: > > >http://github.com/datamapper/dm-core/blob/master/lib/dm-core/spec/sha... > > > It currently fails with two tests, because myadapterdoes return the > > queried objects in > > random order. Thus i would like to know if i really need to provide > > the results in the order > > as they have been initially created or if this is a "bug" of the > >sharedadapterspec? > > > it 'should be able to search for object with a nil value using > > required properties' do > > Heffalump.all(:id.not => nil).should == [ @red, @two, @five ] > > end > > it 'should be able to search for objects not in an empty list (match > > all)' do > > Heffalump.all(:color.not => []).should == [ @red, @two, @five ] > > end > > By default the Query object will have the order set to an Array > equivalent to the properties defined in the model. This ensures that > results are returned in a deterministic order between all adapters. If > results varied between adapters, then client code would have to be > aware of the different behaviour of eachadapter, which somewhat > defeats the purpose of DM. > > There are helper methods inside the Query object that can sort the > resources before returning them from theadapter. Look for the method > Query#sort_records for more info. > > -- > > Dan -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
