restpack_serializer 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b7353b8336e2522e29fd3f7d784cb3d0b7700aa
|
4
|
+
data.tar.gz: d82b914f3692048c54b3725f8909c40c469b4a0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e188183204596a3010a77922b7ce1bf7567dc5a2e9935f503bab9b10147f9cf5be77cdd678dead2ce697bfaefeb8f02641049329526af0a84a73efc035f5d40
|
7
|
+
data.tar.gz: f2da61ed3c6ec04db90bd9a5720e1d983f9a71c341d355e474f3849ec85e77fa0963b79177f8019397ccd8ab775a65b9d5987d12d4c10b865cffa783628c16b3
|
@@ -31,6 +31,33 @@ describe RestPack::Serializer do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
context "serializer inheritance" do
|
35
|
+
class BaseSerializer
|
36
|
+
include RestPack::Serializer
|
37
|
+
attributes :name
|
38
|
+
|
39
|
+
def name
|
40
|
+
"Ben"
|
41
|
+
end
|
42
|
+
|
43
|
+
def age
|
44
|
+
-2
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class DerivedSerializer < BaseSerializer
|
49
|
+
attributes :name, :age
|
50
|
+
|
51
|
+
def age
|
52
|
+
1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it ".as_json serializes" do
|
57
|
+
DerivedSerializer.as_json(person).should == { name: "Ben", age: 1 }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
34
61
|
class PersonSerializer
|
35
62
|
include RestPack::Serializer
|
36
63
|
attributes :id, :name, :description, :href, :admin_info, :string_keys
|