mince 0.0.6 → 0.0.7
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.
- data/lib/mince/data_store.rb +2 -2
- data/lib/mince/version.rb +1 -1
- data/spec/lib/data_store_spec.rb +10 -1
- metadata +2 -2
data/lib/mince/data_store.rb
CHANGED
@@ -23,8 +23,8 @@ module Mince
|
|
23
23
|
collection(collection_name).update({"_id" => hash[:_id]}, hash)
|
24
24
|
end
|
25
25
|
|
26
|
-
def update_field_with_value(
|
27
|
-
|
26
|
+
def update_field_with_value(collection_name, primary_key_value, field_name, new_value)
|
27
|
+
collection(collection_name).update({"_id" => primary_key_value}, {'$set' => { field_name => new_value } })
|
28
28
|
end
|
29
29
|
|
30
30
|
def get_all_for_key_with_value(collection_name, key, value)
|
data/lib/mince/version.rb
CHANGED
data/spec/lib/data_store_spec.rb
CHANGED
@@ -41,6 +41,15 @@ describe Mince::DataStore do
|
|
41
41
|
subject.add(collection_name, data).should == return_data
|
42
42
|
end
|
43
43
|
|
44
|
+
it 'can update a field with a specific value' do
|
45
|
+
key = mock 'key'
|
46
|
+
value = mock 'value'
|
47
|
+
id = mock 'id'
|
48
|
+
collection.should_receive(:update).with({ '_id' => id }, { '$set' => { key => value } })
|
49
|
+
|
50
|
+
subject.update_field_with_value collection_name, id, key, value
|
51
|
+
end
|
52
|
+
|
44
53
|
it 'can read from the collection' do
|
45
54
|
collection.should_receive(:find).and_return(return_data)
|
46
55
|
|
@@ -107,4 +116,4 @@ describe Mince::DataStore do
|
|
107
116
|
|
108
117
|
subject.remove_from_array(collection_name, :key, "value", :array_key, "value_to_remove").should == return_data
|
109
118
|
end
|
110
|
-
end
|
119
|
+
end
|
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.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-05-
|
14
|
+
date: 2012-05-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|