money-rails 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  # Changelog
2
2
 
3
3
  ## master (next release)
4
+ - Raise error when trying to change model based currency
4
5
  - Add testing tasks for rails 4.x
5
6
  - Fix issue with Numeric values in MoneyValidator (GH-83).
6
7
  - Fix test helper
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # RubyMoney - Money-Rails [![endorse](http://api.coderwall.com/alup/endorsecount.png)](http://coderwall.com/alup)
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/money-rails.png)](http://badge.fury.io/rb/money-rails)
3
4
  [![Build Status](https://secure.travis-ci.org/RubyMoney/money-rails.png?branch=master)](http://travis-ci.org/RubyMoney/money-rails)
4
5
  [![Dependency Status](https://gemnasium.com/RubyMoney/money-rails.png)](https://gemnasium.com/RubyMoney/money-rails)
5
6
  [![Code Climate](https://codeclimate.com/github/RubyMoney/money-rails.png)](https://codeclimate.com/github/RubyMoney/money-rails)
7
+ [![License](http://img.shields.io/license/MIT.png?color=green)](http://opensource.org/licenses/MIT)
6
8
 
7
9
  ## Introduction
8
10
 
@@ -40,17 +42,6 @@ $ rails g money_rails:initializer
40
42
  There, you can define the default currency value and set other
41
43
  configuration parameters for the rails app.
42
44
 
43
- ### Setup for money-rails development
44
-
45
- Our tests are executed with several ORMs - see `Rakefile` for details. To install all required gems run these:
46
-
47
- bundle install --gemfile=gemfiles/mongoid2.gemfile
48
- bundle install --gemfile=gemfiles/mongoid3.gemfile
49
- bundle install --gemfile=gemfiles/rails3.gemfile
50
- bundle install --gemfile=gemfiles/rails4.gemfile
51
-
52
- Then you can run the test suite with `rake`,
53
-
54
45
  ## Usage
55
46
 
56
47
  ### ActiveRecord
@@ -292,8 +283,9 @@ currency, whereas ```product.discount.currency_as_string # => EUR ```
292
283
  All the previous options do not require any extra model field to hold
293
284
  currency values. If you need to provide differrent currency per model
294
285
  instance, then you need to add a column with the name ```currency```
295
- in your db table. Money-rails will discover this automatically,
296
- and will use this knowledge to override the model level and global
286
+ in your db table. You should specify ```with_model_currency``` as an argument
287
+ to the ```monetize``` macro.
288
+ Money-rails will use this knowledge to override the model level and global
297
289
  default values. Non-nil instance currency values also override attribute
298
290
  currency values, so they have the highest precedence.
299
291
 
@@ -306,8 +298,8 @@ class Transaction < ActiveRecord::Base
306
298
  # Use model level currency
307
299
  register_currency :gbp
308
300
 
309
- monetize :amount_cents
310
- monetize :tax_cents
301
+ monetize :amount_cents, with_model_currency: :amount_currency
302
+ monetize :tax_cents, with_model_currency: :tax_currency
311
303
 
312
304
  end
313
305
 
@@ -371,6 +363,21 @@ MoneyRails.configure do |config|
371
363
  # :decimal_mark => ","
372
364
  # }
373
365
 
366
+ # Specify a rounding mode
367
+ # Any one of:
368
+ #
369
+ # BigDecimal::ROUND_UP,
370
+ # BigDecimal::ROUND_DOWN,
371
+ # BigDecimal::ROUND_HALF_UP,
372
+ # BigDecimal::ROUND_HALF_DOWN,
373
+ # BigDecimal::ROUND_HALF_EVEN,
374
+ # BigDecimal::ROUND_CEILING,
375
+ # BigDecimal::ROUND_FLOOR
376
+ #
377
+ # set to BigDecimal::ROUND_HALF_EVEN by default
378
+ #
379
+ config.rounding_mode = BigDecimal::ROUND_HALF_UP
380
+
374
381
  # Set money formatted output globally.
375
382
  # Default value is nil meaning "ignore this option".
376
383
  # Options are nil, true, false.
@@ -399,6 +406,7 @@ end
399
406
  * ```sign_before_symbol```: Force `Money#format` to place the negative sign before the currency symbol.
400
407
  * ```amount_column```: Provide values for the amount column (holding the fractional part of a money object).
401
408
  * ```currency_column```: Provide default values or even disable (`present: false`) the currency column.
409
+ * ```rounding_mode```: Set Money.rounding_mode to one of the BigDecimal constants
402
410
 
403
411
  ### Helpers
404
412
 
@@ -484,6 +492,24 @@ For examples on using the test_helpers look at
484
492
 
485
493
  You can see a full list of the currently supported interpreters in [travis.yml](http://github.com/RubyMoney/money-rails/blob/master/.travis.yml)
486
494
 
495
+ ## Contributing
496
+
497
+ ### Steps
498
+
499
+ 1. Fork the repo
500
+ 2. Run the tests
501
+ 3. Make your changes
502
+ 4. Test your changes
503
+ 5. Create a Pull Request
504
+
505
+ ### How to run the tests
506
+
507
+ Our tests are executed with several ORMs - see `Rakefile` for details. To install all required gems run `rake spec:all` That command will take care of installing all required gems for all the different Gemfiles and then running the test suite with the installed bundle.
508
+
509
+ You can also run the test suite against a specific ORM or Rails version, `rake -T` will give you an idea of the possible task (take a look at the tasks under the spec: namespace).
510
+
511
+ If you are testing against mongoid, make sure to have the mongod process running before executing the suite, (E.g. `sudo mongod --quiet`)
512
+
487
513
  ## Maintainers
488
514
 
489
515
  * Andreas Loupasakis (https://github.com/alup)
@@ -492,4 +518,4 @@ You can see a full list of the currently supported interpreters in [travis.yml](
492
518
 
493
519
  ## License
494
520
 
495
- MIT License. Copyright 2012-2013 RubyMoney.
521
+ MIT License. Copyright 2012-2014 RubyMoney.
data/Rakefile CHANGED
@@ -11,6 +11,10 @@ rescue Bundler::BundlerError => e
11
11
  exit e.status_code
12
12
  end
13
13
 
14
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
15
+
16
+ load 'rails/tasks/engine.rake' if File.exists?(APP_RAKEFILE)
17
+
14
18
  require 'rake'
15
19
  require 'rspec/core/rake_task'
16
20
 
@@ -18,56 +22,43 @@ RSpec::Core::RakeTask.new
18
22
 
19
23
  task :default => "spec:all"
20
24
  task :test => :spec
25
+ task :spec => :prepare_test_env
26
+
27
+ desc "Prepare money-rails engine test environment"
28
+ task :prepare_test_env do
29
+ Rake.application['app:db:drop:all'].invoke
30
+ Rake.application['app:db:migrate'].invoke
31
+ Rake.application['app:db:test:prepare'].invoke
32
+ end
33
+
34
+ def run_with_gemfile(gemfile)
35
+ sh "BUNDLE_GEMFILE='#{gemfile}' bundle install --quiet"
36
+ sh "BUNDLE_GEMFILE='#{gemfile}' bundle exec rake -t spec"
37
+ end
21
38
 
22
39
  namespace :spec do
40
+
23
41
  desc "Run Tests against mongoid (version 3)"
24
- task :mongoid3 do
25
- sh "BUNDLE_GEMFILE='gemfiles/mongoid3.gemfile' bundle --quiet"
26
- sh "BUNDLE_GEMFILE='gemfiles/mongoid3.gemfile' bundle exec rake -t spec"
27
- end
42
+ task(:mongoid3) { run_with_gemfile 'gemfiles/mongoid3.gemfile' }
28
43
 
29
44
  desc "Run Tests against mongoid (version 2)"
30
- task :mongoid2 do
31
- sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle --quiet"
32
- sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle exec rake -t spec"
33
- end
45
+ task(:mongoid2) { run_with_gemfile 'gemfiles/mongoid2.gemfile' }
34
46
 
35
47
  desc "Run Tests against rails 4"
36
- task :rails4 do
37
- sh "BUNDLE_GEMFILE='gemfiles/rails4.gemfile' bundle --quiet"
38
- sh "BUNDLE_GEMFILE='gemfiles/rails4.gemfile' bundle exec rake -t spec"
39
- end
48
+ task(:rails4) { run_with_gemfile 'gemfiles/rails4.gemfile' }
40
49
 
41
50
  desc "Run Tests against rails 3"
42
- task :rails3 do
43
- sh "BUNDLE_GEMFILE='gemfiles/rails3.gemfile' bundle --quiet"
44
- sh "BUNDLE_GEMFILE='gemfiles/rails3.gemfile' bundle exec rake -t spec"
45
- end
51
+ task(:rails3) { run_with_gemfile 'gemfiles/rails3.gemfile' }
46
52
 
47
- desc "Run Tests against activerecord"
48
- task :activerecord do
49
- sh "bundle --quiet"
50
- sh "bundle exec rake -t spec"
51
- end
53
+ desc "Run Tests against mongoid 2 & 3"
54
+ task :mongoid => [:mongoid2, :mongoid3]
55
+
56
+ desc "Run Tests against rails 3 & 4"
57
+ task :rails => [:rails3, :rails4]
52
58
 
53
59
  desc "Run Tests against all ORMs"
54
- task :all do
55
- # Mongoid 3
56
- sh "BUNDLE_GEMFILE='gemfiles/mongoid3.gemfile' bundle --quiet"
57
- sh "BUNDLE_GEMFILE='gemfiles/mongoid3.gemfile' bundle exec rake -t spec"
58
-
59
- # Mongoid 2
60
- sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle --quiet"
61
- sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle exec rake -t spec"
62
-
63
- # rails 4
64
- sh "BUNDLE_GEMFILE='gemfiles/rails4.gemfile' bundle --quiet"
65
- sh "BUNDLE_GEMFILE='gemfiles/rails4.gemfile' bundle exec rake -t spec"
66
-
67
- # rails 3
68
- sh "BUNDLE_GEMFILE='gemfiles/rails3.gemfile' bundle --quiet"
69
- sh "BUNDLE_GEMFILE='gemfiles/rails3.gemfile' bundle exec rake -t spec"
70
- end
60
+ task :all => [:rails, :mongoid]
61
+
71
62
  end
72
63
 
73
64
  desc "Update CONTRIBUTORS file"
@@ -1,4 +1,6 @@
1
1
  require "money"
2
+ require "monetize"
3
+ require "monetize/core_extensions"
2
4
  require "money-rails/configuration"
3
5
  require "money-rails/money"
4
6
  require "money-rails/version"
@@ -39,7 +39,7 @@ module MoneyRails
39
39
  symbol = I18n.t('number.currency.format.unit', default: currency.symbol)
40
40
 
41
41
  raw_value = raw_value.to_s.strip.gsub(symbol, "")
42
- abs_raw_value = raw_value.gsub(/^-/, "")
42
+ abs_raw_value = raw_value.strip.gsub(/^-/, "")
43
43
 
44
44
  decimal_pieces = abs_raw_value.split(decimal_mark)
45
45
 
@@ -78,3 +78,6 @@ module MoneyRails
78
78
  end
79
79
  end
80
80
  end
81
+
82
+ # Compatibility with ActiveModel validates method which matches option keys to their validator class
83
+ ActiveModel::Validations::MoneyValidator = MoneyRails::ActiveModel::MoneyValidator
@@ -140,22 +140,35 @@ module MoneyRails
140
140
  if options[:allow_nil] && value.blank?
141
141
  money = nil
142
142
  else
143
- begin
144
- money = value.is_a?(Money) ? value : value.to_money(send("currency_for_#{name}"))
145
- rescue NoMethodError
146
- return nil
143
+ if value.is_a?(Money)
144
+ money = value
145
+ else
146
+ begin
147
+ money = value.to_money(send("currency_for_#{name}"))
148
+ rescue NoMethodError
149
+ return nil
150
+ rescue ArgumentError
151
+ raise if MoneyRails.raise_error_on_money_parsing
152
+ return nil
153
+ end
147
154
  end
148
155
  end
149
156
 
150
157
  # Update cents
151
158
  send("#{subunit_name}=", money.try(:cents))
152
159
 
160
+ money_currency = money.try(:currency)
161
+
153
162
  # Update currency iso value if there is an instance currency attribute
154
163
  if instance_currency_name.present? &&
155
164
  self.respond_to?("#{instance_currency_name}=")
156
165
 
157
- send("#{instance_currency_name}=",
158
- money.try(:currency).try(:iso_code))
166
+ send("#{instance_currency_name}=", money_currency.try(:iso_code))
167
+ else
168
+ current_currency = send("currency_for_#{name}")
169
+ if money_currency && current_currency != money_currency
170
+ raise "Can't change readonly currency '#{current_currency}' to '#{money_currency}' for field '#{name}'"
171
+ end
159
172
  end
160
173
 
161
174
  # Save and return the new Money object
@@ -45,6 +45,19 @@ module MoneyRails
45
45
  currency_column.merge! default: iso_code
46
46
  end
47
47
 
48
+ def rounding_mode=(mode)
49
+ valid_modes = [
50
+ BigDecimal::ROUND_UP,
51
+ BigDecimal::ROUND_DOWN,
52
+ BigDecimal::ROUND_HALF_UP,
53
+ BigDecimal::ROUND_HALF_DOWN,
54
+ BigDecimal::ROUND_HALF_EVEN,
55
+ BigDecimal::ROUND_CEILING,
56
+ BigDecimal::ROUND_FLOOR
57
+ ]
58
+ raise ArgumentError, "#{mode} is not a valid rounding mode" unless valid_modes.include?(mode)
59
+ Money.rounding_mode = mode
60
+ end
48
61
  # Set default bank object
49
62
  #
50
63
  # example (given that eu_central_bank is in Gemfile):
@@ -76,5 +89,10 @@ module MoneyRails
76
89
 
77
90
  mattr_accessor :sign_before_symbol
78
91
  @@sign_before_symbol = nil
92
+
93
+ # Configure whether to raise exception when an improper value
94
+ # is going to be converted to a Money object.
95
+ mattr_accessor :raise_error_on_money_parsing
96
+ @@raise_error_on_money_parsing = false
79
97
  end
80
98
  end
@@ -3,7 +3,7 @@ class Money
3
3
  # Converts an object of this instance into a database friendly value.
4
4
  def mongoize
5
5
  {
6
- :cents => cents.mongoize,
6
+ :cents => cents.mongoize.to_f,
7
7
  :currency_iso => currency.iso_code.mongoize
8
8
  }
9
9
  end
@@ -30,7 +30,12 @@ class Money
30
30
  object.symbolize_keys! if object.respond_to?(:symbolize_keys!)
31
31
  ::Money.new(object[:cents], object[:currency_iso]).mongoize
32
32
  when object.respond_to?(:to_money) then
33
+ begin
33
34
  object.to_money.mongoize
35
+ rescue ArgumentError
36
+ raise if MoneyRails.raise_error_on_money_parsing
37
+ nil
38
+ end
34
39
  else object
35
40
  end
36
41
  end
@@ -22,7 +22,12 @@ class Money
22
22
  :currency_iso => object.currency.iso_code
23
23
  }
24
24
  when object.respond_to?(:to_money)
25
- serialize(object.to_money)
25
+ begin
26
+ serialize(object.to_money)
27
+ rescue ArgumentError
28
+ raise if MoneyRails.raise_error_on_money_parsing
29
+ nil
30
+ end
26
31
  else nil
27
32
  end
28
33
  end
@@ -1,3 +1,3 @@
1
1
  module MoneyRails
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -26,7 +26,8 @@ Gem::Specification.new do |s|
26
26
 
27
27
  s.require_path = "lib"
28
28
 
29
- s.add_dependency "money", "~> 6.0.0"
29
+ s.add_dependency "money", "~> 6.1.1"
30
+ s.add_dependency "monetize", "~> 0.3.0"
30
31
  s.add_dependency "activesupport", ">= 3.0"
31
32
  s.add_dependency "railties", ">= 3.0"
32
33
 
@@ -47,6 +47,13 @@ if defined? ActiveRecord
47
47
  product.price_cents.should == 215
48
48
  end
49
49
 
50
+ it "should raise error if can't change currency" do
51
+ product = Product.new
52
+ expect {
53
+ product.price = Money.new(10, "RUB")
54
+ }.to raise_error("Can't change readonly currency 'USD' to 'RUB' for field 'price'")
55
+ end
56
+
50
57
  it "respects :as argument" do
51
58
  product.discount_value.should == Money.new(150, "USD")
52
59
  end
@@ -64,6 +71,21 @@ if defined? ActiveRecord
64
71
  product.save.should be_true
65
72
  end
66
73
 
74
+ context "when MoneyRails.raise_error_on_money_parsing is true" do
75
+ before { MoneyRails.raise_error_on_money_parsing = true }
76
+ after { MoneyRails.raise_error_on_money_parsing = false }
77
+
78
+ it "raises exception when a String value with hyphen is assigned" do
79
+ expect { product.invalid_price = "10-235" }.to raise_error
80
+ end
81
+ end
82
+
83
+ context "when MoneyRails.raise_error_on_money_parsing is false (default)" do
84
+ it "does not raise exception when a String value with hyphen is assigned" do
85
+ expect { product.invalid_price = "10-235" }.not_to raise_error
86
+ end
87
+ end
88
+
67
89
  it "respects numericality validation when using update_attributes" do
68
90
  product.update_attributes(:price_cents => "some text").should be_false
69
91
  product.update_attributes(:price_cents => 2000).should be_true
@@ -143,6 +165,34 @@ if defined? ActiveRecord
143
165
  product.errors[:price_in_a_range].first.should match(/Must be greater than zero and less than \$100/)
144
166
  end
145
167
 
168
+ it "fails validation with the proper error message using validates :money" do
169
+ product.validates_method_amount = "-12"
170
+ product.valid?.should be_false
171
+ product.errors[:validates_method_amount].first.should match(/Must be greater than zero and less than \$100/)
172
+
173
+ product.validates_method_amount = Money.new(-1200, "USD")
174
+ product.valid?.should be_false
175
+ product.errors[:validates_method_amount].first.should match(/Must be greater than zero and less than \$100/)
176
+
177
+ product.validates_method_amount = "0"
178
+ product.valid?.should be_false
179
+ product.errors[:validates_method_amount].first.should match(/Must be greater than zero and less than \$100/)
180
+
181
+ product.validates_method_amount = "12"
182
+ product.valid?.should be_true
183
+
184
+ product.validates_method_amount = Money.new(1200, "USD")
185
+ product.valid?.should be_true
186
+
187
+ product.validates_method_amount = "101"
188
+ product.valid?.should be_false
189
+ product.errors[:validates_method_amount].first.should match(/Must be greater than zero and less than \$100/)
190
+
191
+ product.validates_method_amount = Money.new(10100, "USD")
192
+ product.valid?.should be_false
193
+ product.errors[:validates_method_amount].first.should match(/Must be greater than zero and less than \$100/)
194
+ end
195
+
146
196
  it "fails validation with the proper error message on the cents field " do
147
197
  product.price_in_a_range = "-12"
148
198
  product.valid?.should be_false
@@ -195,6 +245,11 @@ if defined? ActiveRecord
195
245
  product.save.should be_true
196
246
  end
197
247
 
248
+ it "passes validation if there is a whitespace between the currency symbol and amount" do
249
+ product.price = "$ 123,456.78"
250
+ product.save.should be_true
251
+ end
252
+
198
253
  it "respects numericality validation when using update_attributes on money attribute" do
199
254
  product.update_attributes(:price => "some text").should be_false
200
255
  product.update_attributes(:price => Money.new(320, 'USD')).should be_true
@@ -389,11 +444,30 @@ if defined? ActiveRecord
389
444
  product = Product.create(:sale_price_amount => 1234)
390
445
  product.sale_price.currency_as_string == 'USD'
391
446
  end
447
+
392
448
  it "is overridden by instance currency column" do
393
449
  product = Product.create(:sale_price_amount => 1234,
394
450
  :sale_price_currency_code => 'CAD')
395
451
  product.sale_price.currency_as_string.should == 'CAD'
396
452
  end
453
+
454
+ it 'can change currency of custom column' do
455
+ product = Product.create!(
456
+ :price => Money.new(10,'USD'),
457
+ :bonus => Money.new(10,'GBP'),
458
+ :discount => 10,
459
+ :sale_price_amount => 1234,
460
+ :sale_price_currency_code => 'USD')
461
+
462
+ product.sale_price.currency_as_string.should == 'USD'
463
+
464
+ product.sale_price = Money.new 456, 'CAD'
465
+ product.save
466
+ product.reload
467
+
468
+ product.sale_price.currency_as_string.should == 'CAD'
469
+ product.discount_value.currency_as_string.should == 'USD'
470
+ end
397
471
  end
398
472
 
399
473
  context "for model with currency column:" do
@@ -106,5 +106,23 @@ describe "configuration" do
106
106
  MoneyRails.default_bank = old_bank
107
107
  end
108
108
 
109
+ describe "rounding mode" do
110
+ [BigDecimal::ROUND_UP, BigDecimal::ROUND_DOWN, BigDecimal::ROUND_HALF_UP, BigDecimal::ROUND_HALF_DOWN,
111
+ BigDecimal::ROUND_HALF_EVEN, BigDecimal::ROUND_CEILING, BigDecimal::ROUND_FLOOR].each do |mode|
112
+ context "when set to #{mode}" do
113
+ it "sets Money.rounding mode to #{mode}" do
114
+ MoneyRails.rounding_mode = mode
115
+ expect(Money.rounding_mode).to eq(mode)
116
+ end
117
+ end
118
+ end
119
+
120
+ context "when passed an invalid value" do
121
+ it "should raise an ArgumentError" do
122
+ expect(lambda{MoneyRails.rounding_mode = "booyakasha"}).to raise_error(ArgumentError, 'booyakasha is not a valid rounding mode')
123
+ end
124
+ end
125
+ end
126
+
109
127
  end
110
128
  end
@@ -3,7 +3,8 @@ class Product < ActiveRecord::Base
3
3
  attr_accessible :price_cents, :discount, :bonus_cents,
4
4
  :price, :discount_value, :bonus, :optional_price_cents, :optional_price,
5
5
  :sale_price, :sale_price_amount, :sale_price_currency_code,
6
- :price_in_a_range_cents, :price_in_a_range, :invalid_price_cents
6
+ :price_in_a_range_cents, :price_in_a_range, :invalid_price_cents,
7
+ :validates_method_amount, :validates_method_amount_cents
7
8
 
8
9
  # Use USD as model level currency
9
10
  register_currency :usd
@@ -38,4 +39,11 @@ class Product < ActiveRecord::Base
38
39
  attr_accessor :invalid_price_cents
39
40
  monetize :invalid_price_cents, disable_validation: true
40
41
 
42
+ monetize :validates_method_amount_cents, allow_nil: true
43
+
44
+ validates :validates_method_amount, :money => {
45
+ :greater_than => 0,
46
+ :less_than_or_equal_to => 100,
47
+ :message => 'Must be greater than zero and less than $100',
48
+ }
41
49
  end
@@ -14,6 +14,9 @@ require "money-rails"
14
14
 
15
15
  module Dummy
16
16
  class Application < Rails::Application
17
+
18
+ I18n.enforce_available_locales = false # removes deprecation warning
19
+
17
20
  # Settings in config/environments/* take precedence over those specified here.
18
21
  # Application configuration should go into files in config/initializers
19
22
  # -- all .rb files in that directory are automatically loaded.
@@ -39,6 +42,8 @@ module Dummy
39
42
  # Configure the default encoding used in templates for Ruby 1.9.
40
43
  config.encoding = "utf-8"
41
44
 
45
+ config.secret_key_base = "1234567890" # removes deprecation warning
46
+
42
47
  # Configure sensitive parameters which will be filtered from the log file.
43
48
  config.filter_parameters += [:password]
44
49
 
@@ -1,10 +1,13 @@
1
1
  require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
2
 
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
3
+ # The default gemfile is rails4
4
+ gemfile = File.expand_path('../../../../gemfiles/rails4.gemfile', __FILE__)
5
+
6
+ unless ENV['BUNDLE_GEMFILE']
7
+ puts "No Gemfile specified, booting rails env with rails4.gemfile (default)"
8
+ ENV['BUNDLE_GEMFILE'] ||= gemfile
8
9
  end
9
10
 
11
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
12
+
10
13
  $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -7,6 +7,7 @@ Dummy::Application.configure do
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
+ config.eager_load = false
10
11
  # Configure static asset server for tests with Cache-Control for performance
11
12
  config.serve_static_assets = true
12
13
  config.static_cache_control = "public, max-age=3600"
@@ -0,0 +1,5 @@
1
+ class AddValidatesMethodAmountCentsToProducts < ActiveRecord::Migration
2
+ def change
3
+ add_column :products, :validates_method_amount_cents, :integer
4
+ end
5
+ end
@@ -9,45 +9,43 @@
9
9
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
10
  # you'll amass, the slower it'll run and the greater likelihood for issues).
11
11
  #
12
- # It's strongly recommended to check this file into your version control system.
12
+ # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130124023419) do
14
+ ActiveRecord::Schema.define(version: 20140110194016) do
15
15
 
16
- create_table "dummy_products", :force => true do |t|
16
+ create_table "dummy_products", force: true do |t|
17
17
  t.string "currency"
18
18
  t.integer "price_cents"
19
- t.datetime "created_at", :null => false
20
- t.datetime "updated_at", :null => false
19
+ t.datetime "created_at"
20
+ t.datetime "updated_at"
21
21
  end
22
22
 
23
- create_table "items", :force => true do |t|
24
- end
25
-
26
- create_table "products", :force => true do |t|
23
+ create_table "products", force: true do |t|
27
24
  t.integer "price_cents"
28
25
  t.integer "discount"
29
- t.datetime "created_at", :null => false
30
- t.datetime "updated_at", :null => false
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
31
28
  t.integer "bonus_cents"
32
29
  t.integer "optional_price_cents"
33
- t.integer "sale_price_amount", :default => 0, :null => false
30
+ t.integer "sale_price_amount", default: 0, null: false
34
31
  t.string "sale_price_currency_code"
35
32
  t.integer "price_in_a_range_cents"
33
+ t.integer "validates_method_amount_cents"
36
34
  end
37
35
 
38
- create_table "services", :force => true do |t|
36
+ create_table "services", force: true do |t|
39
37
  t.integer "charge_cents"
40
38
  t.integer "discount_cents"
41
- t.datetime "created_at", :null => false
42
- t.datetime "updated_at", :null => false
39
+ t.datetime "created_at"
40
+ t.datetime "updated_at"
43
41
  end
44
42
 
45
- create_table "transactions", :force => true do |t|
43
+ create_table "transactions", force: true do |t|
46
44
  t.integer "amount_cents"
47
45
  t.integer "tax_cents"
48
46
  t.string "currency"
49
- t.datetime "created_at", :null => false
50
- t.datetime "updated_at", :null => false
47
+ t.datetime "created_at"
48
+ t.datetime "updated_at"
51
49
  end
52
50
 
53
51
  end
@@ -1,5 +1,5 @@
1
1
  CREATE TABLE "dummy_products" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "currency" varchar(255), "price_cents" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
2
- CREATE TABLE "products" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "price_cents" integer, "discount" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "bonus_cents" integer, "optional_price_cents" integer, "price_in_a_range_cents" integer);
2
+ CREATE TABLE "products" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "price_cents" integer, "discount" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "bonus_cents" integer, "optional_price_cents" integer, "sale_price_amount" integer DEFAULT 0 NOT NULL, "sale_price_currency_code" varchar(255), "price_in_a_range_cents" integer);
3
3
  CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL);
4
4
  CREATE TABLE "services" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "charge_cents" integer, "discount_cents" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
5
5
  CREATE TABLE "transactions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "amount_cents" integer, "tax_cents" integer, "currency" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
@@ -16,4 +16,6 @@ INSERT INTO schema_migrations (version) VALUES ('20120528210103');
16
16
 
17
17
  INSERT INTO schema_migrations (version) VALUES ('20120607210247');
18
18
 
19
+ INSERT INTO schema_migrations (version) VALUES ('20120712202655');
20
+
19
21
  INSERT INTO schema_migrations (version) VALUES ('20130124023419');
@@ -10,6 +10,7 @@ if defined?(Mongoid) && ::Mongoid::VERSION =~ /^3(.*)/
10
10
  let!(:priceable_from_hash_with_indifferent_access) {
11
11
  Priceable.create(:price => {:cents=>100, :currency_iso=>"EUR"}.with_indifferent_access)
12
12
  }
13
+ let(:priceable_from_string_with_hyphen) { Priceable.create(:price => '1-2 EUR' )}
13
14
  let(:priceable_with_infinite_precision) { Priceable.create(:price => Money.new(BigDecimal.new('100.1'), 'EUR')) }
14
15
  let(:priceable_with_hash_field) {
15
16
  Priceable.create(:price_hash => {
@@ -34,6 +35,21 @@ if defined?(Mongoid) && ::Mongoid::VERSION =~ /^3(.*)/
34
35
  priceable_from_string.price.currency.should == Money::Currency.find('EUR')
35
36
  end
36
37
 
38
+ context "when MoneyRails.raise_error_on_money_parsing is true" do
39
+ before { MoneyRails.raise_error_on_money_parsing = true }
40
+ after { MoneyRails.raise_error_on_money_parsing = false }
41
+
42
+ it "raises exception if the mongoized value is a String with a hyphen" do
43
+ expect { priceable_from_string_with_hyphen }.to raise_error
44
+ end
45
+ end
46
+
47
+ context "when MoneyRails.raise_error_on_money_parsing is false" do
48
+ it "does not mongoizes correctly a String with hyphen in its middle" do
49
+ priceable_from_string_with_hyphen.price.should == nil
50
+ end
51
+ end
52
+
37
53
  it "mongoizes correctly a hash of cents and currency" do
38
54
  priceable_from_hash.price.cents.should == 100
39
55
  priceable_from_hash.price.currency.should == Money::Currency.find('EUR')
@@ -7,6 +7,7 @@ if defined?(Mongoid) && ::Mongoid::VERSION =~ /^2(.*)/
7
7
  let(:priceable_from_num) { Priceable.create(:price => 1) }
8
8
  let(:priceable_from_string) { Priceable.create(:price => '1 EUR' )}
9
9
  let(:priceable_with_infinite_precision) { Priceable.create(:price => Money.new(BigDecimal.new('100.1'), 'EUR')) }
10
+ let(:priceable_from_string_with_hyphen) { Priceable.create(:price => '1-2 EUR' )}
10
11
 
11
12
  context "serialize" do
12
13
  it "serializes correctly a Money object to a hash of cents and currency" do
@@ -38,6 +39,21 @@ if defined?(Mongoid) && ::Mongoid::VERSION =~ /^2(.*)/
38
39
  priceable_with_infinite_precision.price.currency.should == Money::Currency.find('EUR')
39
40
  end
40
41
  end
42
+
43
+ context "when MoneyRails.raise_error_on_money_parsing is true" do
44
+ before { MoneyRails.raise_error_on_money_parsing = true }
45
+ after { MoneyRails.raise_error_on_money_parsing = false }
46
+
47
+ it "raises exception if the mongoized value is a String with a hyphen" do
48
+ expect { priceable_from_string_with_hyphen }.to raise_error
49
+ end
50
+ end
51
+
52
+ context "when MoneyRails.raise_error_on_money_parsing is false" do
53
+ it "does not mongoizes correctly a String with hyphen in its middle" do
54
+ priceable_from_string_with_hyphen.price.should == nil
55
+ end
56
+ end
41
57
  end
42
58
 
43
59
  context "deserialize" do
@@ -1,5 +1,4 @@
1
1
  ENV["RAILS_ENV"] = 'test'
2
-
3
2
  # Require dummy Rails app
4
3
  require File.expand_path("../../spec/dummy/config/environment", __FILE__)
5
4
 
@@ -11,6 +10,11 @@ require 'rspec/autorun'
11
10
  # in spec/support/ and its subdirectories.
12
11
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
13
12
 
13
+ # Silence warnings
14
+ if Money.respond_to?(:silence_core_extensions_deprecations=)
15
+ Money.silence_core_extensions_deprecations = true
16
+ end
17
+
14
18
  RSpec.configure do |config|
15
19
  # If true, the base class of anonymous controllers will be inferred
16
20
  # automatically. This will be the default behavior in future versions of
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.9.0
4
+ version: 0.10.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: 2013-12-31 00:00:00.000000000 Z
14
+ date: 2014-04-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: money
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: 6.0.0
23
+ version: 6.1.1
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,7 +28,23 @@ dependencies:
28
28
  requirements:
29
29
  - - ~>
30
30
  - !ruby/object:Gem::Version
31
- version: 6.0.0
31
+ version: 6.1.1
32
+ - !ruby/object:Gem::Dependency
33
+ name: monetize
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: 0.3.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.3.0
32
48
  - !ruby/object:Gem::Dependency
33
49
  name: activesupport
34
50
  requirement: !ruby/object:Gem::Requirement
@@ -119,77 +135,78 @@ files:
119
135
  - lib/money-rails.rb
120
136
  - lib/generators/templates/money.rb
121
137
  - lib/generators/money_rails/initializer_generator.rb
122
- - lib/money-rails/helpers/action_view_extension.rb
123
- - lib/money-rails/version.rb
124
- - lib/money-rails/money.rb
125
- - lib/money-rails/active_record/monetizable.rb
126
- - lib/money-rails/active_record/migration_extensions/schema_statements.rb
127
- - lib/money-rails/active_record/migration_extensions/options_extractor.rb
128
- - lib/money-rails/active_record/migration_extensions/table.rb
129
- - lib/money-rails/hooks.rb
130
- - lib/money-rails/mongoid/money.rb
131
- - lib/money-rails/mongoid/two.rb
132
138
  - lib/money-rails/railtie.rb
133
- - lib/money-rails/configuration.rb
139
+ - lib/money-rails/active_model/validator.rb
140
+ - lib/money-rails/helpers/action_view_extension.rb
134
141
  - lib/money-rails/test_helpers.rb
135
142
  - lib/money-rails/engine.rb
136
- - lib/money-rails/active_model/validator.rb
137
- - spec/spec_helper.rb
138
- - spec/helpers/form_helper_spec.rb
143
+ - lib/money-rails/mongoid/two.rb
144
+ - lib/money-rails/mongoid/money.rb
145
+ - lib/money-rails/hooks.rb
146
+ - lib/money-rails/configuration.rb
147
+ - lib/money-rails/active_record/migration_extensions/options_extractor.rb
148
+ - lib/money-rails/active_record/migration_extensions/schema_statements.rb
149
+ - lib/money-rails/active_record/migration_extensions/table.rb
150
+ - lib/money-rails/active_record/monetizable.rb
151
+ - lib/money-rails/money.rb
152
+ - lib/money-rails/version.rb
139
153
  - spec/helpers/action_view_extension_spec.rb
140
- - spec/configuration_spec.rb
154
+ - spec/helpers/form_helper_spec.rb
141
155
  - spec/support/database_cleaner.rb
142
- - spec/active_record/migration_extensions/schema_statements_spec.rb
143
- - spec/active_record/migration_extensions/table_spec.rb
144
- - spec/active_record/monetizable_spec.rb
145
- - spec/mongoid/three_spec.rb
156
+ - spec/spec_helper.rb
146
157
  - spec/mongoid/two_spec.rb
147
- - spec/dummy/public/404.html
148
- - spec/dummy/public/500.html
149
- - spec/dummy/public/422.html
150
- - spec/dummy/public/favicon.ico
151
- - spec/dummy/app/helpers/application_helper.rb
152
- - spec/dummy/app/models/product.rb
153
- - spec/dummy/app/models/dummy_product.rb
154
- - spec/dummy/app/models/service.rb
155
- - spec/dummy/app/models/transaction.rb
156
- - spec/dummy/app/models/priceable.rb
157
- - spec/dummy/app/controllers/application_controller.rb
158
- - spec/dummy/app/assets/javascripts/application.js
159
- - spec/dummy/app/assets/stylesheets/application.css
160
- - spec/dummy/app/views/layouts/application.html.erb
161
- - spec/dummy/Rakefile
158
+ - spec/mongoid/three_spec.rb
159
+ - spec/dummy/db/schema.rb
160
+ - spec/dummy/db/migrate/20120528181002_create_transactions.rb
161
+ - spec/dummy/db/migrate/20120607210247_add_column_that_allows_nil.rb
162
+ - spec/dummy/db/migrate/20130124023419_add_price_in_a_range_cents_to_products.rb
163
+ - spec/dummy/db/migrate/20120712202655_add_sale_price_cents_to_product.rb
164
+ - spec/dummy/db/migrate/20120402080348_add_bonus_cents_to_product.rb
165
+ - spec/dummy/db/migrate/20120528210103_create_dummy_products.rb
166
+ - spec/dummy/db/migrate/20120524052716_create_services.rb
167
+ - spec/dummy/db/migrate/20120331190108_create_products.rb
168
+ - spec/dummy/db/migrate/20140110194016_add_validates_method_amount_cents_to_products.rb
169
+ - spec/dummy/db/structure.sql
162
170
  - spec/dummy/config/environment.rb
163
- - spec/dummy/config/locales/en-GB.yml
164
- - spec/dummy/config/locales/en.yml
171
+ - spec/dummy/config/boot.rb
172
+ - spec/dummy/config/mongoid.yml
165
173
  - spec/dummy/config/application.rb
166
- - spec/dummy/config/initializers/money.rb
167
- - spec/dummy/config/initializers/backtrace_silencers.rb
174
+ - spec/dummy/config/locales/en.yml
175
+ - spec/dummy/config/locales/en-GB.yml
168
176
  - spec/dummy/config/initializers/secret_token.rb
177
+ - spec/dummy/config/initializers/backtrace_silencers.rb
178
+ - spec/dummy/config/initializers/wrap_parameters.rb
169
179
  - spec/dummy/config/initializers/session_store.rb
170
- - spec/dummy/config/initializers/mime_types.rb
180
+ - spec/dummy/config/initializers/money.rb
171
181
  - spec/dummy/config/initializers/inflections.rb
172
- - spec/dummy/config/initializers/wrap_parameters.rb
173
- - spec/dummy/config/mongoid.yml
182
+ - spec/dummy/config/initializers/mime_types.rb
183
+ - spec/dummy/config/database.yml
174
184
  - spec/dummy/config/routes.rb
175
- - spec/dummy/config/boot.rb
176
185
  - spec/dummy/config/environments/development.rb
177
186
  - spec/dummy/config/environments/production.rb
178
187
  - spec/dummy/config/environments/test.rb
179
- - spec/dummy/config/database.yml
188
+ - spec/dummy/app/helpers/application_helper.rb
189
+ - spec/dummy/app/models/transaction.rb
190
+ - spec/dummy/app/models/dummy_product.rb
191
+ - spec/dummy/app/models/product.rb
192
+ - spec/dummy/app/models/priceable.rb
193
+ - spec/dummy/app/models/service.rb
194
+ - spec/dummy/app/assets/stylesheets/application.css
195
+ - spec/dummy/app/assets/javascripts/application.js
196
+ - spec/dummy/app/views/layouts/application.html.erb
197
+ - spec/dummy/app/controllers/application_controller.rb
180
198
  - spec/dummy/script/rails
181
- - spec/dummy/db/schema.rb
182
- - spec/dummy/db/migrate/20120524052716_create_services.rb
183
- - spec/dummy/db/migrate/20120528210103_create_dummy_products.rb
184
- - spec/dummy/db/migrate/20120331190108_create_products.rb
185
- - spec/dummy/db/migrate/20120402080348_add_bonus_cents_to_product.rb
186
- - spec/dummy/db/migrate/20120528181002_create_transactions.rb
187
- - spec/dummy/db/migrate/20120607210247_add_column_that_allows_nil.rb
188
- - spec/dummy/db/migrate/20120712202655_add_sale_price_cents_to_product.rb
189
- - spec/dummy/db/migrate/20130124023419_add_price_in_a_range_cents_to_products.rb
190
- - spec/dummy/db/structure.sql
191
199
  - spec/dummy/config.ru
200
+ - spec/dummy/public/404.html
201
+ - spec/dummy/public/500.html
202
+ - spec/dummy/public/favicon.ico
203
+ - spec/dummy/public/422.html
204
+ - spec/dummy/Rakefile
192
205
  - spec/dummy/README.rdoc
206
+ - spec/active_record/monetizable_spec.rb
207
+ - spec/active_record/migration_extensions/table_spec.rb
208
+ - spec/active_record/migration_extensions/schema_statements_spec.rb
209
+ - spec/configuration_spec.rb
193
210
  - spec/test_helpers_spec.rb
194
211
  - config/locales/money.en.yml
195
212
  - CHANGELOG.md
@@ -223,61 +240,61 @@ signing_key:
223
240
  specification_version: 3
224
241
  summary: Money gem integration with Rails
225
242
  test_files:
226
- - spec/spec_helper.rb
227
- - spec/helpers/form_helper_spec.rb
228
243
  - spec/helpers/action_view_extension_spec.rb
229
- - spec/configuration_spec.rb
244
+ - spec/helpers/form_helper_spec.rb
230
245
  - spec/support/database_cleaner.rb
231
- - spec/active_record/migration_extensions/schema_statements_spec.rb
232
- - spec/active_record/migration_extensions/table_spec.rb
233
- - spec/active_record/monetizable_spec.rb
234
- - spec/mongoid/three_spec.rb
246
+ - spec/spec_helper.rb
235
247
  - spec/mongoid/two_spec.rb
236
- - spec/dummy/public/404.html
237
- - spec/dummy/public/500.html
238
- - spec/dummy/public/422.html
239
- - spec/dummy/public/favicon.ico
240
- - spec/dummy/app/helpers/application_helper.rb
241
- - spec/dummy/app/models/product.rb
242
- - spec/dummy/app/models/dummy_product.rb
243
- - spec/dummy/app/models/service.rb
244
- - spec/dummy/app/models/transaction.rb
245
- - spec/dummy/app/models/priceable.rb
246
- - spec/dummy/app/controllers/application_controller.rb
247
- - spec/dummy/app/assets/javascripts/application.js
248
- - spec/dummy/app/assets/stylesheets/application.css
249
- - spec/dummy/app/views/layouts/application.html.erb
250
- - spec/dummy/Rakefile
248
+ - spec/mongoid/three_spec.rb
249
+ - spec/dummy/db/schema.rb
250
+ - spec/dummy/db/migrate/20120528181002_create_transactions.rb
251
+ - spec/dummy/db/migrate/20120607210247_add_column_that_allows_nil.rb
252
+ - spec/dummy/db/migrate/20130124023419_add_price_in_a_range_cents_to_products.rb
253
+ - spec/dummy/db/migrate/20120712202655_add_sale_price_cents_to_product.rb
254
+ - spec/dummy/db/migrate/20120402080348_add_bonus_cents_to_product.rb
255
+ - spec/dummy/db/migrate/20120528210103_create_dummy_products.rb
256
+ - spec/dummy/db/migrate/20120524052716_create_services.rb
257
+ - spec/dummy/db/migrate/20120331190108_create_products.rb
258
+ - spec/dummy/db/migrate/20140110194016_add_validates_method_amount_cents_to_products.rb
259
+ - spec/dummy/db/structure.sql
251
260
  - spec/dummy/config/environment.rb
252
- - spec/dummy/config/locales/en-GB.yml
253
- - spec/dummy/config/locales/en.yml
261
+ - spec/dummy/config/boot.rb
262
+ - spec/dummy/config/mongoid.yml
254
263
  - spec/dummy/config/application.rb
255
- - spec/dummy/config/initializers/money.rb
256
- - spec/dummy/config/initializers/backtrace_silencers.rb
264
+ - spec/dummy/config/locales/en.yml
265
+ - spec/dummy/config/locales/en-GB.yml
257
266
  - spec/dummy/config/initializers/secret_token.rb
267
+ - spec/dummy/config/initializers/backtrace_silencers.rb
268
+ - spec/dummy/config/initializers/wrap_parameters.rb
258
269
  - spec/dummy/config/initializers/session_store.rb
259
- - spec/dummy/config/initializers/mime_types.rb
270
+ - spec/dummy/config/initializers/money.rb
260
271
  - spec/dummy/config/initializers/inflections.rb
261
- - spec/dummy/config/initializers/wrap_parameters.rb
262
- - spec/dummy/config/mongoid.yml
272
+ - spec/dummy/config/initializers/mime_types.rb
273
+ - spec/dummy/config/database.yml
263
274
  - spec/dummy/config/routes.rb
264
- - spec/dummy/config/boot.rb
265
275
  - spec/dummy/config/environments/development.rb
266
276
  - spec/dummy/config/environments/production.rb
267
277
  - spec/dummy/config/environments/test.rb
268
- - spec/dummy/config/database.yml
278
+ - spec/dummy/app/helpers/application_helper.rb
279
+ - spec/dummy/app/models/transaction.rb
280
+ - spec/dummy/app/models/dummy_product.rb
281
+ - spec/dummy/app/models/product.rb
282
+ - spec/dummy/app/models/priceable.rb
283
+ - spec/dummy/app/models/service.rb
284
+ - spec/dummy/app/assets/stylesheets/application.css
285
+ - spec/dummy/app/assets/javascripts/application.js
286
+ - spec/dummy/app/views/layouts/application.html.erb
287
+ - spec/dummy/app/controllers/application_controller.rb
269
288
  - spec/dummy/script/rails
270
- - spec/dummy/db/schema.rb
271
- - spec/dummy/db/migrate/20120524052716_create_services.rb
272
- - spec/dummy/db/migrate/20120528210103_create_dummy_products.rb
273
- - spec/dummy/db/migrate/20120331190108_create_products.rb
274
- - spec/dummy/db/migrate/20120402080348_add_bonus_cents_to_product.rb
275
- - spec/dummy/db/migrate/20120528181002_create_transactions.rb
276
- - spec/dummy/db/migrate/20120607210247_add_column_that_allows_nil.rb
277
- - spec/dummy/db/migrate/20120712202655_add_sale_price_cents_to_product.rb
278
- - spec/dummy/db/migrate/20130124023419_add_price_in_a_range_cents_to_products.rb
279
- - spec/dummy/db/structure.sql
280
289
  - spec/dummy/config.ru
290
+ - spec/dummy/public/404.html
291
+ - spec/dummy/public/500.html
292
+ - spec/dummy/public/favicon.ico
293
+ - spec/dummy/public/422.html
294
+ - spec/dummy/Rakefile
281
295
  - spec/dummy/README.rdoc
296
+ - spec/active_record/monetizable_spec.rb
297
+ - spec/active_record/migration_extensions/table_spec.rb
298
+ - spec/active_record/migration_extensions/schema_statements_spec.rb
299
+ - spec/configuration_spec.rb
282
300
  - spec/test_helpers_spec.rb
283
- has_rdoc: