money-rails 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ if defined?(Mongoid) && ::Mongoid::VERSION =~ /^3(.*)/
4
+
5
+ describe Money do
6
+ let!(:priceable) { Priceable.create(:price => Money.new(100, 'EUR')) }
7
+
8
+ context "mongoize" do
9
+ it "mongoizes correctly a Money object to a hash of cents and currency" do
10
+ priceable.price.cents.should == 100
11
+ priceable.price.currency.should == Money::Currency.find('EUR')
12
+ end
13
+ end
14
+
15
+ context "demongoize" do
16
+ subject { priceable.price }
17
+ it { should be_an_instance_of(Money) }
18
+ it { should == Money.new(100, 'EUR') }
19
+ it "returns nil if a nil value was stored" do
20
+ nil_priceable = Priceable.create(:price => nil)
21
+ nil_priceable.price.should be_nil
22
+ end
23
+ end
24
+
25
+ context "evolve" do
26
+ it "transforms correctly a Money object to a Mongo friendly value" do
27
+ Priceable.where(:price => Money.new(100, 'EUR')).first.should == priceable
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- if defined? Mongoid
3
+ if defined?(Mongoid) && ::Mongoid::VERSION =~ /^2(.*)/
4
4
 
5
5
  describe Money do
6
6
  let(:priceable) { Priceable.create(:price => Money.new(100, 'EUR')) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.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-07-22 00:00:00.000000000 Z
14
+ date: 2012-09-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: money
@@ -132,7 +132,7 @@ dependencies:
132
132
  requirements:
133
133
  - - ! '>='
134
134
  - !ruby/object:Gem::Version
135
- version: '0'
135
+ version: 0.8.0
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
@@ -140,7 +140,7 @@ dependencies:
140
140
  requirements:
141
141
  - - ! '>='
142
142
  - !ruby/object:Gem::Version
143
- version: '0'
143
+ version: 0.8.0
144
144
  description: This library provides integration of RubyMoney - Money gem with Rails
145
145
  email:
146
146
  - alup.rubymoney@gmail.com
@@ -150,6 +150,7 @@ extra_rdoc_files: []
150
150
  files:
151
151
  - lib/money-rails.rb
152
152
  - lib/money-rails/railtie.rb
153
+ - lib/money-rails/mongoid/three.rb
153
154
  - lib/money-rails/mongoid/two.rb
154
155
  - lib/money-rails/hooks.rb
155
156
  - lib/money-rails/active_record/monetizable.rb
@@ -160,6 +161,7 @@ files:
160
161
  - lib/generators/templates/money.rb
161
162
  - spec/spec_helper.rb
162
163
  - spec/mongoid/two_spec.rb
164
+ - spec/mongoid/three_spec.rb
163
165
  - spec/active_record/monetizable_spec.rb
164
166
  - spec/support/database_cleaner.rb
165
167
  - spec/helpers/action_view_extension_spec.rb
@@ -245,6 +247,7 @@ summary: Money gem integration with Rails
245
247
  test_files:
246
248
  - spec/spec_helper.rb
247
249
  - spec/mongoid/two_spec.rb
250
+ - spec/mongoid/three_spec.rb
248
251
  - spec/active_record/monetizable_spec.rb
249
252
  - spec/support/database_cleaner.rb
250
253
  - spec/helpers/action_view_extension_spec.rb