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