mince 0.0.8 → 0.0.9
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 +4 -0
- data/lib/mince/version.rb +1 -1
- data/spec/lib/data_store_spec.rb +7 -0
- metadata +1 -1
data/lib/mince/data_store.rb
CHANGED
@@ -19,6 +19,10 @@ module Mince
|
|
19
19
|
collection(collection_name).update({}, {"$unset" => { key => 1 } }, multi: true)
|
20
20
|
end
|
21
21
|
|
22
|
+
def delete_by_params(collection_name, params)
|
23
|
+
collection(collection_name).remove(params)
|
24
|
+
end
|
25
|
+
|
22
26
|
def add(collection_name, hash)
|
23
27
|
collection(collection_name).insert(hash)
|
24
28
|
end
|
data/lib/mince/version.rb
CHANGED
data/spec/lib/data_store_spec.rb
CHANGED
@@ -33,6 +33,13 @@ describe Mince::DataStore do
|
|
33
33
|
subject.delete_field(collection_name, field)
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'can delete all records the match a given set of params' do
|
37
|
+
params = mock 'params to condition the deleted records to'
|
38
|
+
collection.should_receive(:remove).with(params)
|
39
|
+
|
40
|
+
subject.delete_by_params(collection_name, params)
|
41
|
+
end
|
42
|
+
|
36
43
|
describe "Generating a primary key" do
|
37
44
|
let(:unique_id) { mock 'id' }
|
38
45
|
it 'should create a reasonably unique id' do
|