value_object_ar 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/methods.rb +1 -1
- data/test/value_object_ar_test.rb +9 -6
- metadata +1 -1
data/lib/methods.rb
CHANGED
@@ -37,12 +37,8 @@ class CurrencyValueObject
|
|
37
37
|
|
38
38
|
end
|
39
39
|
|
40
|
-
class
|
41
|
-
|
40
|
+
class ActiveRecord::Mock
|
42
41
|
include ValueObjectAR::Methods
|
43
|
-
value_object :currency, CurrencyValueObject
|
44
|
-
|
45
|
-
# ActiveRecord behaviour below:
|
46
42
|
attr_accessor :attributes
|
47
43
|
|
48
44
|
def initialize(options={})
|
@@ -50,7 +46,14 @@ class Product
|
|
50
46
|
end
|
51
47
|
|
52
48
|
def attributes
|
53
|
-
@attributes ||= {
|
49
|
+
@attributes ||= {}
|
54
50
|
end
|
55
51
|
|
52
|
+
def currency=(value)
|
53
|
+
attributes['currency'] = value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Product < ActiveRecord::Mock
|
58
|
+
value_object :currency, CurrencyValueObject
|
56
59
|
end
|