@@ -33,6 +33,7 @@ class NoMatchAbstractResource < JSONAPI::Resource
3333class CatResource < JSONAPI ::Resource
3434 attribute :name
3535 attribute :breed
36+ attribute :kind , :delegate => :breed
3637
3738 has_one :mother , class_name : 'Cat'
3839 has_one :father , class_name : 'Cat'
@@ -173,7 +174,7 @@ def test_model_alternate
173174 def test_class_attributes
174175 attrs = CatResource . _attributes
175176 assert_kind_of ( Hash , attrs )
176- assert_equal ( attrs . keys . size , 3 )
177+ assert_equal ( attrs . keys . size , 4 )
177178 end
178179
179180 def test_class_relationships
@@ -253,14 +254,14 @@ def test_updatable_fields_does_not_include_id
253254 # TODO: Please remove after `updateable_fields` is removed
254255 def test_updateable_fields_delegates_to_updatable_fields_with_deprecation
255256 ActiveSupport ::Deprecation . silence do
256- assert_empty ( CatResource . updateable_fields ( nil ) - [ :mother , :father , :name , :breed ] )
257+ assert_empty ( CatResource . updateable_fields ( nil ) - [ :mother , :father , :name , :breed , :kind ] )
257258 end
258259 end
259260
260261 # TODO: Please remove after `createable_fields` is removed
261262 def test_createable_fields_delegates_to_creatable_fields_with_deprecation
262263 ActiveSupport ::Deprecation . silence do
263- assert_empty ( CatResource . createable_fields ( nil ) - [ :mother , :father , :name , :breed , :id ] )
264+ assert_empty ( CatResource . createable_fields ( nil ) - [ :mother , :father , :name , :breed , :id , :kind ] )
264265 end
265266 end
266267
0 commit comments