mongoid_money_field 5.0.2 → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2521a2542fc009767f20e3dc8f2fb6b6143f8f68
4
- data.tar.gz: 731014b6971bac0af2740fe2348498c3a78c6bf7
3
+ metadata.gz: 3815815264a71bafd70ca2fa85064c484876c9e0
4
+ data.tar.gz: 13ab44c3476d3314458e8caf386d8c1f387f2417
5
5
  SHA512:
6
- metadata.gz: fa36333c3d91be248d625586436ce65f4e2d35b5490b99821b77d5c9e9f0b35a3408d997cd6147309a79539221ece2634fede2c8a24dfb8f3a5f637e89554bca
7
- data.tar.gz: ffc2e9433337de286b55f6d3352a479dc90feccd330eee142d947fb18da1b1d76cb08baf974a955a7b5875e90725447dc4cfb56062e9a9f9bc68e029230d8ded
6
+ metadata.gz: 89193856921d73b35c0e1e394334f8fd74349de6428fec92f66cf0ea4de277fc9b0802dc857403206a6ea68ac53906f36713a5849cd0f3ab27043f324e83bf8e
7
+ data.tar.gz: 17f6f913436daae2f3df6068dcd51b41f72695bc9eaa7f08ea945c8c5ac88bdc51d6623b62a95e964c183ea8de00272a79df3adfa095a9fc70c065c7f46d3635
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- mongoid_money_field (5.0.1)
15
+ mongoid_money_field (5.0.2)
16
16
  money (>= 5.0.0)
17
17
  mongoid (>= 3.0.0)
18
18
 
@@ -68,7 +68,7 @@ class MoneyType
68
68
  Money.default_currency = old_default
69
69
  end
70
70
 
71
- if @options[:fixed_currency]
71
+ if !ret.nil? && @options[:fixed_currency]
72
72
  ret[:currency_iso] = @options[:fixed_currency]
73
73
  end
74
74
 
@@ -1,3 +1,3 @@
1
1
  module MongoidMoneyField
2
- VERSION = "5.0.2"
2
+ VERSION = "5.0.3"
3
3
  end
data/spec/money_spec.rb CHANGED
@@ -256,6 +256,13 @@ describe Mongoid::MoneyField do
256
256
  dummy.price.should eq Money.parse('5 GBP')
257
257
  end
258
258
 
259
+ it 'works for other field' do
260
+ DummyMoneyWithFixedCurrency.create!(old_price: '5$', price: '')
261
+ dummy = DummyMoneyWithFixedCurrency.first
262
+ dummy.price.should be_nil
263
+ dummy.old_price.cents.should eq 500
264
+ end
265
+
259
266
  it 'should have correct currency when value is set to 100 RUB' do
260
267
  DummyMoneyWithFixedCurrency.create!(price: '100 RUB')
261
268
  dummy = DummyMoneyWithFixedCurrency.first
@@ -1,10 +1,11 @@
1
- # coding: utf-8
2
-
3
- class DummyMoneyWithFixedCurrency
4
- include Mongoid::Document
5
- include Mongoid::MoneyField
6
-
7
- field :description
8
-
9
- money_field :price, fixed_currency: 'GBP'
1
+ # coding: utf-8
2
+
3
+ class DummyMoneyWithFixedCurrency
4
+ include Mongoid::Document
5
+ include Mongoid::MoneyField
6
+
7
+ field :description
8
+
9
+ money_field :price, fixed_currency: 'GBP'
10
+ money_field :old_price, fixed_currency: 'RUB'
10
11
  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.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Tv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-21 00:00:00.000000000 Z
11
+ date: 2013-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid