Minor style improvements.

This commit is contained in:
Lucas Hosseini 2015-09-07 09:06:17 +02:00
parent ebb05959d3
commit 890003b305

View File

@ -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