From ebda34b3d3662215718068b91c895ce5159d7cd3 Mon Sep 17 00:00:00 2001 From: Lucas Hosseini Date: Wed, 20 Apr 2016 03:08:54 +0200 Subject: [PATCH] Fix tests to comply with the JSON API spec. --- test/adapter/json_api/has_many_test.rb | 5 +++-- test/adapter/json_api/has_one_test.rb | 5 +++-- test/fixtures/poro.rb | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/adapter/json_api/has_many_test.rb b/test/adapter/json_api/has_many_test.rb index 4c391eb43..db75d35c5 100644 --- a/test/adapter/json_api/has_many_test.rb +++ b/test/adapter/json_api/has_many_test.rb @@ -131,8 +131,9 @@ def test_has_many_with_virtual_value id: '1', type: 'virtual-values', relationships: { - maker: { data: { id: 1 } }, - reviews: { data: [{ id: 1 }, { id: 2 }] } + maker: { data: { type: 'makers', id: '1' } }, + reviews: { data: [{ type: 'reviews', id: '1' }, + { type: 'reviews', id: '2' }] } } } }, adapter.serializable_hash) diff --git a/test/adapter/json_api/has_one_test.rb b/test/adapter/json_api/has_one_test.rb index e0ea4cd76..eb505a0de 100644 --- a/test/adapter/json_api/has_one_test.rb +++ b/test/adapter/json_api/has_one_test.rb @@ -65,8 +65,9 @@ def test_has_one_with_virtual_value id: '1', type: 'virtual-values', relationships: { - maker: { data: { id: 1 } }, - reviews: { data: [{ id: 1 }, { id: 2 }] } + maker: { data: { type: 'makers', id: '1' } }, + reviews: { data: [{ type: 'reviews', id: '1' }, + { type: 'reviews', id: '2' }] } } } } diff --git a/test/fixtures/poro.rb b/test/fixtures/poro.rb index 9689e615a..cfcc0ede5 100644 --- a/test/fixtures/poro.rb +++ b/test/fixtures/poro.rb @@ -227,8 +227,9 @@ def json_key VirtualValueSerializer = Class.new(ActiveModel::Serializer) do attributes :id - has_many :reviews, virtual_value: [{ id: 1 }, { id: 2 }] - has_one :maker, virtual_value: { id: 1 } + has_many :reviews, virtual_value: [{ type: 'reviews', id: '1' }, + { type: 'reviews', id: '2' }] + has_one :maker, virtual_value: { type: 'makers', id: '1' } def reviews end