mince 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ # SRP: Model with implementation on how to store each collection in a data store
1
2
  require 'singleton'
2
3
 
3
4
  require_relative 'connection'
@@ -26,6 +27,10 @@ module Mince
26
27
  get_by_params(collection_name, key.to_s => value)
27
28
  end
28
29
 
30
+ def get_for_key_with_value(collection_name, key, value)
31
+ get_all_for_key_with_value(collection_name, key, value)[0]
32
+ end
33
+
29
34
  def get_by_params(collection_name, hash)
30
35
  collection(collection_name).find(hash)
31
36
  end
@@ -1,3 +1,3 @@
1
1
  module Mince
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -78,6 +78,12 @@ describe Mince::DataStore do
78
78
  subject.get_all_for_key_with_value(collection_name, "key", "value").should == return_data
79
79
  end
80
80
 
81
+ it 'can get a record of a specific key value' do
82
+ collection.should_receive(:find).with({"key" => "value"}).and_return([return_data])
83
+
84
+ subject.get_for_key_with_value(collection_name, "key", "value").should == return_data
85
+ end
86
+
81
87
  it 'can get all records where a value includes any of a set of values' do
82
88
  collection.should_receive(:find).with({"key1" => { "$in" => [1,2,4]} }).and_return(return_data)
83
89
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mince
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2012-03-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
18
- requirement: &70236892657660 !ruby/object:Gem::Requirement
18
+ requirement: &70112417686880 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '3.0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70236892657660
26
+ version_requirements: *70112417686880
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongo
29
- requirement: &70236892657120 !ruby/object:Gem::Requirement
29
+ requirement: &70112417685980 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 1.5.2
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70236892657120
37
+ version_requirements: *70112417685980
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: bson_ext
40
- requirement: &70236892656620 !ruby/object:Gem::Requirement
40
+ requirement: &70112417685300 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: 1.5.2
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70236892656620
48
+ version_requirements: *70112417685300
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rake
51
- requirement: &70236892656140 !ruby/object:Gem::Requirement
51
+ requirement: &70112417684460 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70236892656140
59
+ version_requirements: *70112417684460
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rspec
62
- requirement: &70236892655480 !ruby/object:Gem::Requirement
62
+ requirement: &70112417683380 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70236892655480
70
+ version_requirements: *70112417683380
71
71
  description: Lightweight MongoDB ORM for Ruby.
72
72
  email:
73
73
  - matt@railsgrammer.com