mongoid_money_field 5.0.4 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +24 -27
- data/lib/mongoid_money_field/version.rb +1 -1
- data/lib/mongoid_money_field.rb +2 -0
- data/mongoid_money_field.gemspec +7 -6
- data/spec/money_spec.rb +15 -15
- metadata +39 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d597501e969ab92ffc3a6958e242515f734da04
|
4
|
+
data.tar.gz: 8605ccc7c7666f68cd05f37937f206e5f8e61430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61a4e7253dc18ff0f3e05edc1385a03ec3fe5f684b2f9b9757070429d4c5dc0025e41d47c0fe4a520f34de1ce0a6e0ff8b7bc0a7e4a5c7efd344717cf1e3191f
|
7
|
+
data.tar.gz: f61ba0e48c01a9a32eeac0f5bf5e272790e4288c558de3f0926094d27f562300a45eeea770918af3a64356ac339fe1e84352dc75e7ca9010deac6872d9a5dbf0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,19 +1,9 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/mongoid/mongoid.git
|
3
|
-
revision: a94c2f43573e58f973913c881ad9d11d62bf857c
|
4
|
-
branch: master
|
5
|
-
specs:
|
6
|
-
mongoid (4.0.0.alpha2)
|
7
|
-
activemodel (>= 4.0.0)
|
8
|
-
moped (~> 2.0.beta5)
|
9
|
-
origin (~> 2.1)
|
10
|
-
tzinfo (>= 0.3.37)
|
11
|
-
|
12
1
|
PATH
|
13
2
|
remote: .
|
14
3
|
specs:
|
15
|
-
mongoid_money_field (5.0.
|
16
|
-
|
4
|
+
mongoid_money_field (5.0.4)
|
5
|
+
monetize
|
6
|
+
money (~> 6.1.0.beta1)
|
17
7
|
mongoid (>= 3.0.0)
|
18
8
|
|
19
9
|
GEM
|
@@ -29,39 +19,46 @@ GEM
|
|
29
19
|
thread_safe (~> 0.1)
|
30
20
|
tzinfo (~> 0.3.37)
|
31
21
|
atomic (1.1.14)
|
32
|
-
bson (2.
|
22
|
+
bson (2.2.0)
|
33
23
|
builder (3.1.4)
|
34
24
|
connection_pool (1.2.0)
|
35
25
|
database_cleaner (1.2.0)
|
36
26
|
diff-lcs (1.2.5)
|
37
|
-
docile (1.1.
|
27
|
+
docile (1.1.3)
|
38
28
|
i18n (0.6.9)
|
39
29
|
json (1.8.1)
|
40
30
|
minitest (4.7.5)
|
41
|
-
|
31
|
+
monetize (0.2.0)
|
32
|
+
money (~> 6.1.0.beta1)
|
33
|
+
money (6.1.0.beta1)
|
42
34
|
i18n (~> 0.6.4)
|
35
|
+
mongoid (4.0.0.beta1)
|
36
|
+
activemodel (>= 4.0.0)
|
37
|
+
moped (~> 2.0.beta6)
|
38
|
+
origin (~> 2.1)
|
39
|
+
tzinfo (>= 0.3.37)
|
43
40
|
mongoid-rspec (1.10.0)
|
44
41
|
mongoid (>= 3.0.1)
|
45
42
|
rake
|
46
43
|
rspec (>= 2.14)
|
47
|
-
moped (2.0.0.
|
48
|
-
bson (~> 2.
|
44
|
+
moped (2.0.0.beta6)
|
45
|
+
bson (~> 2.2)
|
49
46
|
connection_pool (~> 1.2)
|
50
47
|
optionable (~> 0.2.0)
|
51
48
|
multi_json (1.8.4)
|
52
49
|
optionable (0.2.0)
|
53
50
|
origin (2.1.0)
|
54
51
|
rake (10.1.1)
|
55
|
-
rdoc (4.
|
52
|
+
rdoc (4.1.1)
|
56
53
|
json (~> 1.4)
|
57
54
|
rspec (2.14.1)
|
58
55
|
rspec-core (~> 2.14.0)
|
59
56
|
rspec-expectations (~> 2.14.0)
|
60
57
|
rspec-mocks (~> 2.14.0)
|
61
58
|
rspec-core (2.14.7)
|
62
|
-
rspec-expectations (2.14.
|
59
|
+
rspec-expectations (2.14.5)
|
63
60
|
diff-lcs (>= 1.1.3, < 2.0)
|
64
|
-
rspec-mocks (2.14.
|
61
|
+
rspec-mocks (2.14.5)
|
65
62
|
simplecov (0.8.2)
|
66
63
|
docile (~> 1.1.0)
|
67
64
|
multi_json
|
@@ -76,11 +73,11 @@ PLATFORMS
|
|
76
73
|
|
77
74
|
DEPENDENCIES
|
78
75
|
bundler
|
79
|
-
database_cleaner
|
80
|
-
mongoid
|
81
|
-
mongoid-rspec
|
76
|
+
database_cleaner
|
77
|
+
mongoid (~> 4.0.0.beta1)
|
78
|
+
mongoid-rspec
|
82
79
|
mongoid_money_field!
|
83
80
|
rake
|
84
|
-
rdoc
|
85
|
-
rspec
|
86
|
-
simplecov
|
81
|
+
rdoc
|
82
|
+
rspec
|
83
|
+
simplecov
|
data/lib/mongoid_money_field.rb
CHANGED
data/mongoid_money_field.gemspec
CHANGED
@@ -19,13 +19,14 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "mongoid", ">= 3.0.0"
|
22
|
-
spec.add_runtime_dependency "money", "
|
22
|
+
spec.add_runtime_dependency "money", "~> 6.1.0.beta1"
|
23
|
+
spec.add_runtime_dependency "monetize"
|
23
24
|
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rspec"
|
27
|
-
spec.add_development_dependency "rdoc"
|
28
|
-
spec.add_development_dependency "simplecov"
|
29
|
-
spec.add_development_dependency "database_cleaner"
|
30
|
-
spec.add_development_dependency "mongoid-rspec"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
spec.add_development_dependency "rdoc"
|
29
|
+
spec.add_development_dependency "simplecov"
|
30
|
+
spec.add_development_dependency "database_cleaner"
|
31
|
+
spec.add_development_dependency "mongoid-rspec"
|
31
32
|
end
|
data/spec/money_spec.rb
CHANGED
@@ -151,17 +151,17 @@ describe Mongoid::MoneyField do
|
|
151
151
|
|
152
152
|
it 'should be persisted normally when set as Money' do
|
153
153
|
dummy = DummyMoney.new
|
154
|
-
dummy.price =
|
154
|
+
dummy.price = Monetize.parse(1.23)
|
155
155
|
dummy.save.should eq true
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'should be possible to set value to nil' do
|
159
159
|
dummy = DummyMoney.new
|
160
|
-
dummy.price =
|
160
|
+
dummy.price = Monetize.parse(1.23)
|
161
161
|
dummy.save.should eq true
|
162
162
|
|
163
163
|
dummy = DummyMoney.first
|
164
|
-
dummy.price.should eq
|
164
|
+
dummy.price.should eq Monetize.parse(1.23)
|
165
165
|
dummy.price = nil
|
166
166
|
dummy.save.should eq true
|
167
167
|
dummy = DummyMoney.first
|
@@ -176,14 +176,14 @@ describe Mongoid::MoneyField do
|
|
176
176
|
|
177
177
|
it 'should have a Money value that matches the money value that was initially persisted' do
|
178
178
|
dummy = DummyMoney.first
|
179
|
-
dummy.price.should eq
|
179
|
+
dummy.price.should eq Monetize.parse('9.99')
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
183
|
describe 'when accessing a document from the datastore with a Money datatype set as money' do
|
184
184
|
before(:each) do
|
185
185
|
dm = DummyMoney.create(:description => "Test")
|
186
|
-
dm.price =
|
186
|
+
dm.price = Monetize.parse('1.23')
|
187
187
|
dm.save!
|
188
188
|
end
|
189
189
|
|
@@ -195,7 +195,7 @@ describe Mongoid::MoneyField do
|
|
195
195
|
|
196
196
|
describe 'when accessing a document from the datastore with a Money datatype set as money with mass asignment' do
|
197
197
|
before(:each) do
|
198
|
-
DummyMoney.create(:description => "Test", :price =>
|
198
|
+
DummyMoney.create(:description => "Test", :price => Monetize.parse('1.23'))
|
199
199
|
end
|
200
200
|
|
201
201
|
it 'should have a Money value that matches the money value that was initially persisted' do
|
@@ -253,7 +253,7 @@ describe Mongoid::MoneyField do
|
|
253
253
|
dummy = DummyMoneyWithFixedCurrency.first
|
254
254
|
dummy.price.currency.iso_code.should eq 'GBP'
|
255
255
|
dummy.price.cents.should eq 500
|
256
|
-
dummy.price.should eq
|
256
|
+
dummy.price.should eq Monetize.parse('5 GBP')
|
257
257
|
end
|
258
258
|
|
259
259
|
it 'works for other field' do
|
@@ -268,7 +268,7 @@ describe Mongoid::MoneyField do
|
|
268
268
|
dummy = DummyMoneyWithFixedCurrency.first
|
269
269
|
dummy.price.currency.iso_code.should eq 'GBP'
|
270
270
|
dummy.price.cents.should eq 100_00
|
271
|
-
dummy.price.should eq
|
271
|
+
dummy.price.should eq Monetize.parse('100 GBP')
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
@@ -278,7 +278,7 @@ describe Mongoid::MoneyField do
|
|
278
278
|
dummy = DummyMoney.first
|
279
279
|
dummy.price.currency.iso_code.should eq 'RUB'
|
280
280
|
dummy.price.cents.should eq 123
|
281
|
-
dummy.price.should eq
|
281
|
+
dummy.price.should eq Monetize.parse('1.23 RUB')
|
282
282
|
end
|
283
283
|
|
284
284
|
it 'should handle $' do
|
@@ -286,7 +286,7 @@ describe Mongoid::MoneyField do
|
|
286
286
|
dummy = DummyMoney.first
|
287
287
|
dummy.price.currency.iso_code.should eq 'USD'
|
288
288
|
dummy.price.cents.should eq 123
|
289
|
-
dummy.price.should eq
|
289
|
+
dummy.price.should eq Monetize.parse('1.23 USD')
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
@@ -332,12 +332,12 @@ describe Mongoid::MoneyField do
|
|
332
332
|
|
333
333
|
it 'should have correct value for first item' do
|
334
334
|
o = DummyOrder.first
|
335
|
-
o.dummy_line_items.first.price.should eq
|
335
|
+
o.dummy_line_items.first.price.should eq Monetize.parse('12.99')
|
336
336
|
end
|
337
337
|
|
338
338
|
it 'should have correct value for first item' do
|
339
339
|
o = DummyOrder.first
|
340
|
-
o.dummy_line_items.last.price.should eq
|
340
|
+
o.dummy_line_items.last.price.should eq Monetize.parse('14.99')
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
@@ -348,15 +348,15 @@ describe Mongoid::MoneyField do
|
|
348
348
|
|
349
349
|
it 'should have correct Money value for field 1' do
|
350
350
|
dummy = DummyPrices.first
|
351
|
-
dummy.price1.should eq
|
351
|
+
dummy.price1.should eq Monetize.parse('1.23')
|
352
352
|
end
|
353
353
|
it 'should have correct Money value for field 2' do
|
354
354
|
dummy = DummyPrices.first
|
355
|
-
dummy.price2.should eq
|
355
|
+
dummy.price2.should eq Monetize.parse('2.33')
|
356
356
|
end
|
357
357
|
it 'should have correct Money value for field 3' do
|
358
358
|
dummy = DummyPrices.first
|
359
|
-
dummy.price3.should eq
|
359
|
+
dummy.price3.should eq Monetize.parse('1')
|
360
360
|
end
|
361
361
|
end
|
362
362
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_money_field
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Tv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -26,18 +26,32 @@ dependencies:
|
|
26
26
|
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: money
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 6.1.0.beta1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 6.1.0.beta1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: monetize
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - '>='
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: '0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - '>='
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,72 +84,72 @@ dependencies:
|
|
70
84
|
name: rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - '>='
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - '>='
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rdoc
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - '>='
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0
|
117
|
+
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - '>='
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: database_cleaner
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - '>='
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - '>='
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: mongoid-rspec
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- -
|
143
|
+
- - '>='
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
145
|
+
version: '0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- -
|
150
|
+
- - '>='
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
152
|
+
version: '0'
|
139
153
|
description: Use RubyMoney with mongoid
|
140
154
|
email:
|
141
155
|
- glebtv@gmail.com
|
@@ -203,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
217
|
version: '0'
|
204
218
|
requirements: []
|
205
219
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.1
|
220
|
+
rubygems_version: 2.2.1
|
207
221
|
signing_key:
|
208
222
|
specification_version: 4
|
209
223
|
summary: Use RubyMoney with mongoid
|