collector 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,7 +60,9 @@ module Collector
60
60
  end
61
61
 
62
62
  def find_by_id(id)
63
- deserialize!(collection.find(_id: id))
63
+ collection.find(_id: id).map do |document|
64
+ deserialize!(document)
65
+ end
64
66
  end
65
67
 
66
68
  def method_missing(method_sym, *arguments, &block)
@@ -1,3 +1,3 @@
1
1
  module Collector
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -97,11 +97,14 @@ describe Collector::Repository do
97
97
  end
98
98
 
99
99
  describe "find_by_id" do
100
- it "returns a document by its ID" do
101
- id = "bson-id"
102
- document = stub
103
- TestRepository.expects(:deserialize!).with(document)
104
- collection = mock { expects(:find).with(_id: id).returns(document) }
100
+ it "returns documents by their ID" do
101
+ id = "bson-id"
102
+ document_1 = stub
103
+ document_2 = stub
104
+ documents = [document_1, document_2]
105
+ TestRepository.expects(:deserialize!).with(document_1)
106
+ TestRepository.expects(:deserialize!).with(document_2)
107
+ collection = mock { expects(:find).with(_id: id).returns(documents) }
105
108
  TestRepository.expects(:collection).returns(collection)
106
109
  TestRepository.find_by_id(id)
107
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-05 00:00:00.000000000 Z
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport