Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensured consistency between load! of all_delegator and view_by_delega…

…tor.
  • Loading branch information...
commit e544acb5496ee2aeb7e5a96d156a471c5fb059af 1 parent 9b85b88
@paulcarey authored
View
4 lib/relaxdb/all_delegator.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
View
4 spec/all_delegator_spec.rb
@@ -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
View
4 spec/doc_inheritable_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.