Permalink
Browse files

Ensured consistency between load! of all_delegator and view_by_delega…

…tor.
  • Loading branch information...
paulcarey committed Apr 10, 2010
1 parent 9b85b88 commit e544acb5496ee2aeb7e5a96d156a471c5fb059af
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/relaxdb/all_delegator.rb
  2. +2 −2 spec/all_delegator_spec.rb
  3. +2 −2 spec/doc_inheritable_spec.rb
@@ -27,7 +27,7 @@ def __setobj__ obj
# Intentionally empty
end
- def load
+ def load!
__getobj__
@objs = RelaxDB.load! @ids
end
@@ -39,7 +39,7 @@ def size
# TODO: destroy in a bulk_save if feasible
def destroy!
- load
+ load!
@objs.each do |o|
# A reload is required for deleting objects with a self referential references_many relationship
# This makes all.destroy! very slow. Change if needed
@@ -32,7 +32,7 @@
it "should load all docs for the given class" do
docs = (1..3).map { |i| Primitives.new :num => i }
RelaxDB.bulk_save! *docs
- pms = Primitives.all.load
+ pms = Primitives.all.load!
pms.map { |p| p.num }.inject(&:+).should == 6
end
@@ -44,7 +44,7 @@
docs = (1..3).map { |i| Primitives.new :num => i }
RelaxDB.bulk_save! *docs
Primitives.all.destroy!
- Primitives.all.load.should == []
+ Primitives.all.load!.should == []
end
end
@@ -34,8 +34,8 @@
a = Ancestor.new(:x => 0).save!
d = Descendant.new(:x => 1).save!
- Ancestor.all.load.should == [a, d]
- Descendant.all.load.should == [d]
+ Ancestor.all.load!.should == [a, d]
+ Descendant.all.load!.should == [d]
end
it "should function with inheritance trees" do

0 comments on commit e544acb

Please sign in to comment.