mongo_thing 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -67,7 +67,8 @@ module MongoThing #:nodoc:
67
67
  if spec_or_object_id.is_a? String
68
68
  spec_or_object_id = BSON::ObjectId.from_string(spec_or_object_id)
69
69
  end
70
- self.new(collection.find_one(spec_or_object_id, opts))
70
+ mongo_doc = collection.find_one(spec_or_object_id, opts)
71
+ mongo_doc && self.new(mongo_doc)
71
72
  end
72
73
 
73
74
  # Creating
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongo_thing}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Higginbotham"]
@@ -158,6 +158,11 @@ describe MongoThing::Document do
158
158
  p.reload
159
159
  p.name.should == "Tom"
160
160
  end
161
+
162
+ it "should return nil if no document found with find_one" do
163
+ p = Person.create(:name => "Tom")
164
+ Person.find_one(:name => "Yorick").should be_nil
165
+ end
161
166
  end
162
167
  end
163
168
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_thing
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Higginbotham