Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed a few bugs

  • Loading branch information...
commit f61811a582662030e1967e41d453348e139dde60 1 parent b25392a
@kristianmandrup authored
View
1  Gemfile
@@ -5,6 +5,7 @@ gem 'mongoid', "~> 3.0.0"
gem 'origin'
gem 'moped'
gem 'origin-selectable_ext'
+gem 'sugar-high', '~> 0.7.0'
# gem 'mongoid', "~> 2.4"
# gem 'bson'
View
2  Gemfile.lock
@@ -48,6 +48,7 @@ GEM
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
+ sugar-high (0.7.3)
tzinfo (0.3.33)
PLATFORMS
@@ -65,3 +66,4 @@ DEPENDENCIES
rdoc (>= 3.12)
rspec (>= 2.10)
simplecov (>= 0.5)
+ sugar-high (~> 0.7.0)
View
8 README.md
@@ -18,12 +18,18 @@ Bundle via Terminal:
```ruby
require 'money-mongoid'
-``
+```
Now also supports MoneyRange with between queries and can even do dynamic currency conversions as part of the query!!! ;)
See specs for usage examples, fx `money/mongoid/3x/money_spec.rb`
+## Spec note
+
+Please note that currently the `money/mongoid/monetize_spec.rb` fails with a number of errors. Please help fix these bugs
+
+However the `2x` and `3x` specs should pass just fine ;)
+
## Contributing to money-mongoid
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
View
1  lib/money/mongoid.rb
@@ -1,4 +1,5 @@
require 'money'
+require 'sugar-high/delegate'
require 'money/mongoid/core_ext'
require 'money/orm/generic'
View
13 lib/money/mongoid/core_ext/range.rb
@@ -18,19 +18,6 @@ def self.range range, iso_code
end
end
-# http://blog.jayfields.com/2008/02/ruby-replace-methodmissing-with-dynamic.html
-class DelegateDecorator
- def initialize(subject)
- subject.public_methods(false).each do |meth|
- (class << self; self; end).class_eval do
- define_method meth do |*args|
- subject.send meth, *args
- end
- end
- end
- end
-end
-
class MoneyRange < DelegateDecorator
attr_reader :iso_code, :range
View
9 spec/money/mongoid/2x/money_spec.rb
@@ -1,11 +1,16 @@
require 'money/mongoid/spec_helper'
-require 'money/mongoid/money'
+
+require 'money/mongoid/monetize'
+require 'money/mongoid/monetizable'
+
require 'money/mongoid/2x/product'
describe 'Mongoid custom Money type' do
subject { product }
- let(:product) do { Product.create :price => Money.new(3000, 'USD') }
+ let(:product) do
+ Product.create :price => Money.new(3000, 'USD')
+ end
its(:price) { should be_a Money }
Please sign in to comment.
Something went wrong with that request. Please try again.