Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update to money 6.1, fix deprecations

  • Loading branch information...
commit 767073ebf823ccb6496f14374799f96f41d2edc9 1 parent d79d5ee
@glebtv authored
View
2  Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
# Specify your gem's dependencies in mongoid_money_field.gemspec
-gem "mongoid", github: "mongoid/mongoid", branch: "master"
+gem "mongoid", "~> 4.0.0.beta1"
gemspec
View
51 Gemfile.lock
@@ -1,19 +1,9 @@
-GIT
- remote: git://github.com/mongoid/mongoid.git
- revision: a94c2f43573e58f973913c881ad9d11d62bf857c
- branch: master
- specs:
- mongoid (4.0.0.alpha2)
- activemodel (>= 4.0.0)
- moped (~> 2.0.beta5)
- origin (~> 2.1)
- tzinfo (>= 0.3.37)
-
PATH
remote: .
specs:
- mongoid_money_field (5.0.3)
- money (>= 5.0.0)
+ mongoid_money_field (5.0.4)
+ monetize
+ money (~> 6.1.0.beta1)
mongoid (>= 3.0.0)
GEM
@@ -29,39 +19,46 @@ GEM
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
atomic (1.1.14)
- bson (2.1.0)
+ bson (2.2.0)
builder (3.1.4)
connection_pool (1.2.0)
database_cleaner (1.2.0)
diff-lcs (1.2.5)
- docile (1.1.1)
+ docile (1.1.3)
i18n (0.6.9)
json (1.8.1)
minitest (4.7.5)
- money (6.0.0)
+ monetize (0.2.0)
+ money (~> 6.1.0.beta1)
+ money (6.1.0.beta1)
i18n (~> 0.6.4)
+ mongoid (4.0.0.beta1)
+ activemodel (>= 4.0.0)
+ moped (~> 2.0.beta6)
+ origin (~> 2.1)
+ tzinfo (>= 0.3.37)
mongoid-rspec (1.10.0)
mongoid (>= 3.0.1)
rake
rspec (>= 2.14)
- moped (2.0.0.beta5)
- bson (~> 2.1)
+ moped (2.0.0.beta6)
+ bson (~> 2.2)
connection_pool (~> 1.2)
optionable (~> 0.2.0)
multi_json (1.8.4)
optionable (0.2.0)
origin (2.1.0)
rake (10.1.1)
- rdoc (4.0.1)
+ rdoc (4.1.1)
json (~> 1.4)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
- rspec-expectations (2.14.4)
+ rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
- rspec-mocks (2.14.4)
+ rspec-mocks (2.14.5)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
@@ -76,11 +73,11 @@ PLATFORMS
DEPENDENCIES
bundler
- database_cleaner (~> 1.2.0)
- mongoid!
- mongoid-rspec (~> 1.10.0)
+ database_cleaner
+ mongoid (~> 4.0.0.beta1)
+ mongoid-rspec
mongoid_money_field!
rake
- rdoc (~> 4.0.1)
- rspec (~> 2.14.0)
- simplecov (~> 0.8.2)
+ rdoc
+ rspec
+ simplecov
View
2  lib/mongoid_money_field.rb
@@ -1,6 +1,8 @@
# coding: utf-8
require "money"
+require 'monetize'
+require 'monetize/core_extensions'
require "mongoid_money_field/type"
require "mongoid_money_field/version"
View
2  lib/mongoid_money_field/version.rb
@@ -1,3 +1,3 @@
module MongoidMoneyField
- VERSION = "5.0.4"
+ VERSION = "5.1.0"
end
View
13 mongoid_money_field.gemspec
@@ -19,13 +19,14 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_runtime_dependency "mongoid", ">= 3.0.0"
- spec.add_runtime_dependency "money", ">= 5.0.0"
+ spec.add_runtime_dependency "money", "~> 6.1.0.beta1"
+ spec.add_runtime_dependency "monetize"
spec.add_development_dependency "rake"
spec.add_development_dependency "bundler"
- spec.add_development_dependency "rspec", "~> 2.14.0"
- spec.add_development_dependency "rdoc", "~> 4.0.1"
- spec.add_development_dependency "simplecov", "~> 0.8.2"
- spec.add_development_dependency "database_cleaner", "~> 1.2.0"
- spec.add_development_dependency "mongoid-rspec", "~> 1.10.0"
+ spec.add_development_dependency "rspec"
+ spec.add_development_dependency "rdoc"
+ spec.add_development_dependency "simplecov"
+ spec.add_development_dependency "database_cleaner"
+ spec.add_development_dependency "mongoid-rspec"
end
View
30 spec/money_spec.rb
@@ -151,17 +151,17 @@
it 'should be persisted normally when set as Money' do
dummy = DummyMoney.new
- dummy.price = Money.parse(1.23)
+ dummy.price = Monetize.parse(1.23)
dummy.save.should eq true
end
it 'should be possible to set value to nil' do
dummy = DummyMoney.new
- dummy.price = Money.parse(1.23)
+ dummy.price = Monetize.parse(1.23)
dummy.save.should eq true
dummy = DummyMoney.first
- dummy.price.should eq Money.parse(1.23)
+ dummy.price.should eq Monetize.parse(1.23)
dummy.price = nil
dummy.save.should eq true
dummy = DummyMoney.first
@@ -176,14 +176,14 @@
it 'should have a Money value that matches the money value that was initially persisted' do
dummy = DummyMoney.first
- dummy.price.should eq Money.parse('9.99')
+ dummy.price.should eq Monetize.parse('9.99')
end
end
describe 'when accessing a document from the datastore with a Money datatype set as money' do
before(:each) do
dm = DummyMoney.create(:description => "Test")
- dm.price = Money.parse('1.23')
+ dm.price = Monetize.parse('1.23')
dm.save!
end
@@ -195,7 +195,7 @@
describe 'when accessing a document from the datastore with a Money datatype set as money with mass asignment' do
before(:each) do
- DummyMoney.create(:description => "Test", :price => Money.parse('1.23'))
+ DummyMoney.create(:description => "Test", :price => Monetize.parse('1.23'))
end
it 'should have a Money value that matches the money value that was initially persisted' do
@@ -253,7 +253,7 @@
dummy = DummyMoneyWithFixedCurrency.first
dummy.price.currency.iso_code.should eq 'GBP'
dummy.price.cents.should eq 500
- dummy.price.should eq Money.parse('5 GBP')
+ dummy.price.should eq Monetize.parse('5 GBP')
end
it 'works for other field' do
@@ -268,7 +268,7 @@
dummy = DummyMoneyWithFixedCurrency.first
dummy.price.currency.iso_code.should eq 'GBP'
dummy.price.cents.should eq 100_00
- dummy.price.should eq Money.parse('100 GBP')
+ dummy.price.should eq Monetize.parse('100 GBP')
end
end
@@ -278,7 +278,7 @@
dummy = DummyMoney.first
dummy.price.currency.iso_code.should eq 'RUB'
dummy.price.cents.should eq 123
- dummy.price.should eq Money.parse('1.23 RUB')
+ dummy.price.should eq Monetize.parse('1.23 RUB')
end
it 'should handle $' do
@@ -286,7 +286,7 @@
dummy = DummyMoney.first
dummy.price.currency.iso_code.should eq 'USD'
dummy.price.cents.should eq 123
- dummy.price.should eq Money.parse('1.23 USD')
+ dummy.price.should eq Monetize.parse('1.23 USD')
end
end
@@ -332,12 +332,12 @@
it 'should have correct value for first item' do
o = DummyOrder.first
- o.dummy_line_items.first.price.should eq Money.parse('12.99')
+ o.dummy_line_items.first.price.should eq Monetize.parse('12.99')
end
it 'should have correct value for first item' do
o = DummyOrder.first
- o.dummy_line_items.last.price.should eq Money.parse('14.99')
+ o.dummy_line_items.last.price.should eq Monetize.parse('14.99')
end
end
@@ -348,15 +348,15 @@
it 'should have correct Money value for field 1' do
dummy = DummyPrices.first
- dummy.price1.should eq Money.parse('1.23')
+ dummy.price1.should eq Monetize.parse('1.23')
end
it 'should have correct Money value for field 2' do
dummy = DummyPrices.first
- dummy.price2.should eq Money.parse('2.33')
+ dummy.price2.should eq Monetize.parse('2.33')
end
it 'should have correct Money value for field 3' do
dummy = DummyPrices.first
- dummy.price3.should eq Money.parse('1')
+ dummy.price3.should eq Monetize.parse('1')
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.