failing test case + fix for Collection#[]
This commit is contained in:
parent
78f0b181e2
commit
833e0eb7da
@ -53,7 +53,7 @@ module Mongo
|
||||
# :name :: the name of the collection to get
|
||||
def [](name)
|
||||
name = "#{self.name}.#{name}"
|
||||
return Collection.new(self, name) if !db.strict? || db.collection_names.include?(name)
|
||||
return Collection.new(db, name) if !db.strict? || db.collection_names.include?(name)
|
||||
raise "Collection #{name} doesn't exist. Currently in strict mode."
|
||||
end
|
||||
|
||||
|
@ -42,6 +42,10 @@ class TestCollection < Test::Unit::TestCase
|
||||
assert_kind_of Collection, @@db["test"]["foo"]
|
||||
assert_equal @@db["test"]["foo"].name(), @@db.collection("test.foo").name()
|
||||
assert_equal @@db["test"]["foo"].name(), @@db["test.foo"].name()
|
||||
|
||||
@@db["test"]["foo"].clear
|
||||
@@db["test"]["foo"].insert("x" => 5)
|
||||
assert_equal 5, @@db.collection("test.foo").find_one()["x"]
|
||||
end
|
||||
|
||||
def test_safe_insert
|
||||
|
Loading…
Reference in New Issue
Block a user