Commit 69397d55 authored by Robert Schilling's avatar Robert Schilling

Assert response body

parent f3abd18c
...@@ -35,6 +35,16 @@ describe API::Todos, api: true do ...@@ -35,6 +35,16 @@ describe API::Todos, api: true do
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(3) expect(json_response.length).to eq(3)
expect(json_response[0]['id']).to eq(pending_3.id)
expect(json_response[0]['project']).to be_a Hash
expect(json_response[0]['author']).to be_a Hash
expect(json_response[0]['target_id']).to be_present
expect(json_response[0]['target_type']).to be_present
expect(json_response[0]['target_reference']).to be_present
expect(json_response[0]['target_url']).to be_present
expect(json_response[0]['body']).to be_present
expect(json_response[0]['state']).to eq('pending')
expect(json_response[0]['created_at']).to be_present
end end
context 'and using the author filter' do context 'and using the author filter' do
...@@ -69,7 +79,6 @@ describe API::Todos, api: true do ...@@ -69,7 +79,6 @@ describe API::Todos, api: true do
context 'and using the project filter' do context 'and using the project filter' do
it 'filters based on project_id param' do it 'filters based on project_id param' do
project_2.team << [john_doe, :developer]
get api('/todos', john_doe), { project_id: project_2.id } get api('/todos', john_doe), { project_id: project_2.id }
expect(response.status).to eq(200) expect(response.status).to eq(200)
...@@ -113,6 +122,8 @@ describe API::Todos, api: true do ...@@ -113,6 +122,8 @@ describe API::Todos, api: true do
delete api('/todos', john_doe) delete api('/todos', john_doe)
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(json_response).to be_an Array
expect(json_response.length).to eq(3)
expect(pending_1.reload).to be_done expect(pending_1.reload).to be_done
expect(pending_2.reload).to be_done expect(pending_2.reload).to be_done
expect(pending_3.reload).to be_done expect(pending_3.reload).to be_done
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment