money-rails 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f8394a529d516a0e9f099291bdf744f6381b1b3
4
- data.tar.gz: cde8c42671d4fee5881b3dce193d810e6aa8bc0a
3
+ metadata.gz: 039411253785e557d6b22b2ce90af40767ab9826
4
+ data.tar.gz: c2cbf81f1876b426f9706d93e28ed76d0fd1511e
5
5
  SHA512:
6
- metadata.gz: 2cddc738c762f65dd0461852a040220d4bb4bd4016f2551871ed4b0069c6788dd4a899287670c169bb2e8809b6de6888e63fc0e0d9da8453309e53f9698c7fa8
7
- data.tar.gz: ae99bf3bd2db13636253c3613e099f6de115b5a3f8768cbe5ea505ea77392cbf927e957ed56a836a8bce247970d8d88d8cbb8e92f71035e64a9c9664dd08eb4b
6
+ metadata.gz: d941f2078bbff98816829f488d9c0603b0c8715b7d4fa810e2f4d45c60765f5e4e0a64a7e2d723cbf62624b110bf8d2248067a2d4e09de75e7abb248ce90c82e
7
+ data.tar.gz: 732c397e937951ba6b557a4d9bd4b4e83b5860dfd24093c576cba5afdc5e1b30a0906f70f12140f77da4205ee72e04d2efb2b270f4859ff3fb07233b5615cf23
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler'
5
+ require 'bundler/gem_tasks'
5
6
 
6
7
  begin
7
8
  Bundler.setup(:default, :development)
@@ -6,7 +6,7 @@ module MoneyRails
6
6
  @record = record
7
7
  @attr = attr
8
8
 
9
- subunit_attr = @record.class.monetized_attributes[@attr.to_sym]
9
+ subunit_attr = @record.class.monetized_attributes[@attr.to_s]
10
10
 
11
11
  # WARNING: Currently this is only defined in ActiveRecord extension!
12
12
  before_type_cast = :"#{@attr}_money_before_type_cast"
@@ -1,3 +1,3 @@
1
1
  module MoneyRails
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
3
3
  end
@@ -2,10 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  class Sub < Product; end
4
4
 
5
- class SubProduct < Product
6
- monetize :special_price_cents
7
- end
8
-
9
5
  if defined? ActiveRecord
10
6
  describe MoneyRails::ActiveRecord::Monetizable do
11
7
  describe "monetize" do
@@ -22,12 +18,28 @@ if defined? ActiveRecord
22
18
  Service.create(:charge_cents => 2000, :discount_cents => 120)
23
19
  end
24
20
 
25
- it "should be inherited by subclasses" do
26
- expect(Sub.monetized_attributes).to eq(Product.monetized_attributes)
27
- end
21
+ context 'monetized_attributes' do
28
22
 
29
- it "should be inherited by subclasses with new monetized attribute" do
30
- expect(SubProduct.monetized_attributes).to eq(Product.monetized_attributes.merge(special_price: "special_price_cents"))
23
+ class InheritedMonetizeProduct < Product
24
+ monetize :special_price_cents
25
+ end
26
+
27
+ it "should be inherited by subclasses" do
28
+ assert_monetized_attributes(Sub.monetized_attributes, Product.monetized_attributes)
29
+ end
30
+
31
+ it "should be inherited by subclasses with new monetized attribute" do
32
+ assert_monetized_attributes(InheritedMonetizeProduct.monetized_attributes, Product.monetized_attributes.merge(special_price: "special_price_cents"))
33
+ end
34
+
35
+ def assert_monetized_attributes(monetized_attributes, expected_attributes)
36
+ expect(monetized_attributes).to include expected_attributes
37
+ expect(expected_attributes).to include monetized_attributes
38
+ expect(monetized_attributes.size).to eql expected_attributes.size
39
+ monetized_attributes.keys.each do |key|
40
+ expect(key.is_a? String).to be_truthy
41
+ end
42
+ end
31
43
  end
32
44
 
33
45
  it "attaches a Money object to model field" do
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: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Loupasakis
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-19 00:00:00.000000000 Z
13
+ date: 2015-04-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: money