diff options
-rw-r--r-- | spec/requests/api/todos_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/requests/api/todos_spec.rb b/spec/requests/api/todos_spec.rb index 147028ba1c9..1960db59c99 100644 --- a/spec/requests/api/todos_spec.rb +++ b/spec/requests/api/todos_spec.rb @@ -35,6 +35,16 @@ describe API::Todos, api: true do expect(response.status).to eq(200) expect(json_response).to be_an Array 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 context 'and using the author filter' do @@ -69,7 +79,6 @@ describe API::Todos, api: true do context 'and using the project filter' 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 } expect(response.status).to eq(200) @@ -113,6 +122,8 @@ describe API::Todos, api: true do delete api('/todos', john_doe) 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_2.reload).to be_done expect(pending_3.reload).to be_done |