spec/module/collections_spec.rb in ampere-1.0.0 vs spec/module/collections_spec.rb in ampere-1.1.0

- old
+ new

@@ -21,16 +21,24 @@ President.create :name => "John F. Kennedy" , :party => "Democratic" President.create :name => "Jimmy Carter" , :party => "Democratic" end ### + + it 'should be returned by President.all' do + democrats = President.all + democrats.class.should == Ampere::Collection + democrats.model.should == President + democrats.raw_array.length.should == 6 + democrats.count.should == 6 + end it 'should be returned by where() queries' do democrats = President.where(:party => "Democratic") democrats.class.should == Ampere::Collection democrats.model.should == President democrats.raw_array.length.should == 3 - democrats.length.should == 3 + democrats.count.should == 3 end it 'should be accessible via [] like an Array' do whigs = President.where(:party => "Whig") whigs[0].name.should == "Millard Fillmore"