Simplified DB#collection logic. Removed assert that only worked coincidentally.

This commit is contained in:
Jim Menard 2009-01-16 13:24:49 -05:00
parent 7291995efc
commit 94f5214e45
2 changed files with 2 additions and 7 deletions

View File

@ -148,12 +148,8 @@ module XGen
# new collection. If +strict+ is true, will raise an error if
# collection +name+ does not already exists.
def collection(name)
return Collection.new(self, name) if collection_names.include?(full_coll_name(name))
if strict?
raise "Collection #{name} doesn't exist. Currently in strict mode."
else
create_collection(name)
end
return Collection.new(self, name) if !strict? || collection_names.include?(full_coll_name(name))
raise "Collection #{name} doesn't exist. Currently in strict mode."
end
# Drop collection +name+. Returns +true+ on success or if the

View File

@ -232,7 +232,6 @@ class DBAPITest < Test::Unit::TestCase
assert rows.length >= 1
row = rows.detect { |r| r['name'] == @coll_full_name }
assert_not_nil row
assert_equal @coll.name, row['options']['create']
end
def test_collection_options