Permalink
Browse files

deal with empty responses by returning nil for entity

  • Loading branch information...
1 parent c1d94ee commit e59447656dc18e3204dc668d38385b6c06befd40 @theganyo committed Oct 12, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/usergrid/extensions/response.rb
  2. +4 −0 spec/usergrid/core/entity_spec.rb
@@ -62,7 +62,7 @@ def entity_data
end
def entity
- Usergrid::Entity.new entity_data['uri'], resource.api_url, resource.options, self
+ Usergrid::Entity.new(entity_data['uri'], resource.api_url, resource.options, self) if entity_data
end
protected
@@ -42,4 +42,8 @@
empty.data?.should be_false
end
+ it "should return nil if empty result" do
+ @application['foobars'].get.entity.should be_nil
+ end
+
end

0 comments on commit e594476

Please sign in to comment.