mince 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mince (0.0.4)
4
+ mince (1.0.0)
5
5
  activesupport (~> 3.0)
6
6
  bson_ext (~> 1.5.2)
7
7
  mongo (~> 1.5.2)
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- activesupport (3.2.3)
12
+ activesupport (3.2.7)
13
13
  i18n (~> 0.6)
14
14
  multi_json (~> 1.0)
15
15
  bson (1.5.2)
@@ -19,7 +19,7 @@ GEM
19
19
  i18n (0.6.0)
20
20
  mongo (1.5.2)
21
21
  bson (= 1.5.2)
22
- multi_json (1.2.0)
22
+ multi_json (1.3.6)
23
23
  rake (0.8.7)
24
24
  rspec (2.8.0.rc1)
25
25
  rspec-core (= 2.8.0.rc1)
@@ -35,6 +35,10 @@ module Mince
35
35
  collection(collection_name).update({"_id" => primary_key_value}, {'$set' => { field_name => new_value } })
36
36
  end
37
37
 
38
+ def increment_field_by_amount(collection_name, primary_key_value, field_name, amount)
39
+ collection(collection_name).update({"_id" => primary_key_value}, {'$inc' => { field_name => amount } })
40
+ end
41
+
38
42
  def get_all_for_key_with_value(collection_name, key, value)
39
43
  get_by_params(collection_name, key.to_s => value)
40
44
  end
data/lib/mince/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mince
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -71,6 +71,15 @@ describe Mince::DataStore do
71
71
  subject.update_field_with_value collection_name, id, key, value
72
72
  end
73
73
 
74
+ it 'can increment a field by a specific amount' do
75
+ key = mock 'key'
76
+ amount = mock 'amount to increment the field by'
77
+ id = mock 'id'
78
+ collection.should_receive(:update).with({ '_id' => id }, { '$inc' => { key => amount } })
79
+
80
+ subject.increment_field_by_amount collection_name, id, key, amount
81
+ end
82
+
74
83
  it 'can read from the collection' do
75
84
  collection.should_receive(:find).and_return(return_data)
76
85
 
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: 1.0.0
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-02 00:00:00.000000000 Z
14
+ date: 2012-08-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport