Test serialized relationship data

This commit is contained in:
Matt-Yorkley
2021-10-11 14:46:36 +01:00
committed by Maikel Linke
parent 46f9d3ef81
commit 028d02ccca

View File

@@ -108,6 +108,20 @@ describe "Customers", type: :request do
expect(json_error_detail).to eq "The resource you were looking for could not be found."
end
end
describe "related records" do
it "serializes the enterprise relationship" do
expected_enterprise_data = {
"data" => {
"id" => customer1.enterprise_id.to_s,
"type" => "enterprise"
}
}
get "/api/v1/customers/#{customer1.id}"
expect(json_response[:data][:relationships][:enterprise]).to eq(expected_enterprise_data)
end
end
end
put "Update customer" do