mince_data_model 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/mince_data_model.rb
CHANGED
@@ -45,6 +45,10 @@ module MinceDataModel
|
|
45
45
|
data_store.instance.update_field_with_value(data_collection, id, field, value)
|
46
46
|
end
|
47
47
|
|
48
|
+
def increment_field_by_amount(id, field, amount)
|
49
|
+
data_store.instance.increment_field_by_amount(data_collection, id, field, amount)
|
50
|
+
end
|
51
|
+
|
48
52
|
def remove_from_array(id, field, value)
|
49
53
|
data_store.instance.remove_from_array(data_collection, data_store.primary_key_identifier, id, field, value)
|
50
54
|
end
|
@@ -77,6 +77,16 @@ shared_examples_for 'a data model' do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
describe 'incrementing a specific field by a given an amount' do
|
81
|
+
let(:data_model_id) { mock 'id' }
|
82
|
+
|
83
|
+
it 'has the data store update the field' do
|
84
|
+
mock_data_store.should_receive(:increment_field_by_amount).with(collection_name, data_model_id, :some_field, 4)
|
85
|
+
|
86
|
+
described_class.increment_field_by_amount(data_model_id, :some_field, 4)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
80
90
|
describe "pushing a value to an array for a data model" do
|
81
91
|
let(:data_model_id) { '1234567' }
|
82
92
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mince_data_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
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-08-
|
14
|
+
date: 2012-08-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|