mince_data_model 0.0.4 → 0.0.5
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_model.rb
CHANGED
@@ -61,6 +61,10 @@ module MinceDataModel
|
|
61
61
|
data_store.instance.delete_field(data_collection, field)
|
62
62
|
end
|
63
63
|
|
64
|
+
def delete_by_params(params)
|
65
|
+
data_store.instance.delete_by_params(data_collection, params)
|
66
|
+
end
|
67
|
+
|
64
68
|
def all
|
65
69
|
translate_each_from_data_store data_store.instance.find_all(data_collection)
|
66
70
|
end
|
@@ -33,11 +33,19 @@ shared_examples_for 'a data model' do
|
|
33
33
|
it 'can delete a field' do
|
34
34
|
field = mock 'field to delete from the collection'
|
35
35
|
|
36
|
-
mock_data_store.should_receive(:
|
36
|
+
mock_data_store.should_receive(:delete_field).with(collection_name, field)
|
37
37
|
|
38
38
|
described_class.delete_field(field)
|
39
39
|
end
|
40
40
|
|
41
|
+
it 'can delete records by a given set of params' do
|
42
|
+
params = mock 'params that provide a condition of what records to delete from the collection'
|
43
|
+
|
44
|
+
mock_data_store.should_receive(:delete_by_params).with(collection_name, params)
|
45
|
+
|
46
|
+
described_class.delete_by_params(params)
|
47
|
+
end
|
48
|
+
|
41
49
|
describe "updating a data model" do
|
42
50
|
let(:data_model_id) { '1234567' }
|
43
51
|
let(:mock_model) { mock 'a model', id: data_model_id, instance_values: data_field_attributes }
|