@@ -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'
@@ -175,7 +176,7 @@ def test_model_alternate
175176 def test_class_attributes
176177 attrs = CatResource . _attributes
177178 assert_kind_of ( Hash , attrs )
178- assert_equal ( attrs . keys . size , 3 )
179+ assert_equal ( attrs . keys . size , 4 )
179180 end
180181
181182 def test_class_relationships
@@ -255,14 +256,14 @@ def test_updatable_fields_does_not_include_id
255256 # TODO: Please remove after `updateable_fields` is removed
256257 def test_updateable_fields_delegates_to_updatable_fields_with_deprecation
257258 ActiveSupport ::Deprecation . silence do
258- assert_empty ( CatResource . updateable_fields ( nil ) - [ :mother , :father , :name , :breed ] )
259+ assert_empty ( CatResource . updateable_fields ( nil ) - [ :mother , :father , :name , :breed , :kind ] )
259260 end
260261 end
261262
262263 # TODO: Please remove after `createable_fields` is removed
263264 def test_createable_fields_delegates_to_creatable_fields_with_deprecation
264265 ActiveSupport ::Deprecation . silence do
265- assert_empty ( CatResource . createable_fields ( nil ) - [ :mother , :father , :name , :breed , :id ] )
266+ assert_empty ( CatResource . createable_fields ( nil ) - [ :mother , :father , :name , :breed , :id , :kind ] )
266267 end
267268 end
268269
0 commit comments