mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Minor style improvements.
This commit is contained in:
parent
ebb05959d3
commit
890003b305
@ -28,8 +28,8 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def with_jsonapi_resource_type type
|
||||
old_type = ActiveModel::Serializer.config[:jsonapi_resource_type]
|
||||
ActiveModel::Serializer.config[:jsonapi_resource_type] = type
|
||||
old_type = ActiveModel::Serializer.config.jsonapi_resource_type
|
||||
ActiveModel::Serializer.config.jsonapi_resource_type = type
|
||||
yield
|
||||
ensure
|
||||
ActiveModel::Serializer.config.jsonapi_resource_type = old_type
|
||||
@ -38,7 +38,7 @@ module ActiveModel
|
||||
def test_config_plural
|
||||
with_adapter :json_api do
|
||||
with_jsonapi_resource_type :plural do
|
||||
hash = ActiveModel::SerializableResource.serialize(@comment).serializable_hash
|
||||
hash = ActiveModel::SerializableResource.new(@comment).serializable_hash
|
||||
assert_equal('comments', hash[:data][:type])
|
||||
end
|
||||
end
|
||||
@ -47,7 +47,7 @@ module ActiveModel
|
||||
def test_config_singular
|
||||
with_adapter :json_api do
|
||||
with_jsonapi_resource_type :singular do
|
||||
hash = ActiveModel::SerializableResource.serialize(@comment).serializable_hash
|
||||
hash = ActiveModel::SerializableResource.new(@comment).serializable_hash
|
||||
assert_equal('comment', hash[:data][:type])
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user