File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ def inherited(subclass)
118
118
subclass . cachable_relationships_to_serialize = cachable_relationships_to_serialize . dup if cachable_relationships_to_serialize . present?
119
119
subclass . uncachable_relationships_to_serialize = uncachable_relationships_to_serialize . dup if uncachable_relationships_to_serialize . present?
120
120
subclass . transform_method = transform_method
121
+ subclass . pluralized_type = pluralized_type
121
122
subclass . cache_length = cache_length
122
123
subclass . race_condition_ttl = race_condition_ttl
123
124
subclass . data_links = data_links . dup if data_links . present?
Original file line number Diff line number Diff line change @@ -95,13 +95,23 @@ class EmployeeSerializer < UserSerializer
95
95
has_one :account
96
96
end
97
97
98
+ class LegacyUserSerializer < UserSerializer
99
+ pluralize_type true
100
+ end
101
+
102
+ class LegacyEmployeeSerializer < LegacyUserSerializer
103
+ attributes :location
104
+ attributes :compensation
105
+
106
+ has_one :account
107
+ end
108
+
98
109
it 'sets the correct record type' do
99
110
expect ( EmployeeSerializer . reflected_record_type ) . to eq :employee
100
111
expect ( EmployeeSerializer . record_type ) . to eq :employee
101
112
end
102
113
103
114
context 'when testing inheritance of attributes' do
104
-
105
115
it 'includes parent attributes' do
106
116
subclass_attributes = EmployeeSerializer . attributes_to_serialize
107
117
superclass_attributes = UserSerializer . attributes_to_serialize
@@ -157,12 +167,15 @@ class EmployeeSerializer < UserSerializer
157
167
end
158
168
end
159
169
160
- context 'when test inheritence of other attributes' do
161
-
162
- it 'inherits the tranform method' do
170
+ context 'when testing inheritence of other attributes' do
171
+ it 'inherits the transform method' do
163
172
EmployeeSerializer
164
173
expect ( UserSerializer . transform_method ) . to eq EmployeeSerializer . transform_method
165
174
end
166
175
176
+ it 'inherits pluralized_type' do
177
+ LegacyEmployeeSerializer
178
+ expect ( LegacyUserSerializer . pluralized_type ) . to eq LegacyEmployeeSerializer . pluralized_type
179
+ end
167
180
end
168
181
end
You can’t perform that action at this time.
0 commit comments