Use DeserializeHelpers.deserialize_response
This commit is contained in:
parent
a8e6ac3dfd
commit
20288ff7e4
|
|
@ -16,7 +16,7 @@ RSpec.describe TeamsController, type: :controller do
|
||||||
|
|
||||||
it 'should return the correct team' do
|
it 'should return the correct team' do
|
||||||
get :show, params: { id: @team.to_param }
|
get :show, params: { id: @team.to_param }
|
||||||
body = ActiveModelSerializers::Deserialization.jsonapi_parse(JSON.parse(response.body))
|
body = deserialize_response response
|
||||||
expect(body[:name]).to eq(@team.name)
|
expect(body[:name]).to eq(@team.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -49,7 +49,7 @@ RSpec.describe TeamsController, type: :controller do
|
||||||
it 'renders a response with the updated team' do
|
it 'renders a response with the updated team' do
|
||||||
put :update, params: { id: @team.to_param }.merge(valid_update)
|
put :update, params: { id: @team.to_param }.merge(valid_update)
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
body = ActiveModelSerializers::Deserialization.jsonapi_parse(JSON.parse(response.body))
|
body = deserialize_response response
|
||||||
expect(body[:name]).to eq(valid_update[:data][:attributes][:name])
|
expect(body[:name]).to eq(valid_update[:data][:attributes][:name])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue