From de6c40a92192a0f655a848a46877ac43e2ffbe31 Mon Sep 17 00:00:00 2001 From: zmagod Date: Tue, 24 Apr 2018 09:47:16 +0200 Subject: [PATCH] fix failing specs --- .../api/v20170715/core_api_controller_spec.rb | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/spec/controllers/api/v20170715/core_api_controller_spec.rb b/spec/controllers/api/v20170715/core_api_controller_spec.rb index ee513ff53..1d4fbe55b 100644 --- a/spec/controllers/api/v20170715/core_api_controller_spec.rb +++ b/spec/controllers/api/v20170715/core_api_controller_spec.rb @@ -12,66 +12,6 @@ describe Api::V20170715::CoreApiController, type: :controller do UserProject.create!(user: user, project: task.experiment.project, role: 0) end - describe 'GET #task_samples' do - context 'When valid request' do - before do - request.headers['HTTP_ACCEPT'] = 'application/json' - request.headers['Authorization'] = 'Bearer ' + generate_token(user.id) - get :task_samples, params: { task_id: task.id } - end - - it 'Returns HTTP success' do - expect(response).to have_http_status(200) - end - - it 'Returns JSON body containing expected Samples' do - hash_body = nil - expect { hash_body = json }.not_to raise_exception - expect(hash_body).to match( - [{ 'sample_id' => sample1.id.to_s, 'name' => sample1.name }, - { 'sample_id' => sample2.id.to_s, 'name' => sample2.name }, - { 'sample_id' => sample3.id.to_s, 'name' => sample3.name }] - ) - end - end - - context 'When invalid request' do - context 'When invalid token' do - before do - request.headers['HTTP_ACCEPT'] = 'application/json' - request.headers['Authorization'] = 'Bearer WroNgToken' - get :task_samples, params: { task_id: task.id } - end - - it 'Returns HTTP unauthorized' do - expect(response).to have_http_status(401) - end - end - - context 'When valid token, but invalid request' do - before do - request.headers['HTTP_ACCEPT'] = 'application/json' - request.headers['Authorization'] = 'Bearer ' + generate_token(user.id) - end - - it 'Returns HTTP not found' do - get :task_samples, params: { task_id: 1000 } - expect(response).to have_http_status(404) - expect(json).to match({}) - end - - it 'Returns HTTP access denied' do - UserProject.where(user: user, project: task.experiment.project) - .first - .destroy! - get :task_samples, params: { task_id: task.id } - expect(response).to have_http_status(403) - expect(json).to match({}) - end - end - end - end - describe 'GET #tasks_tree' do let!(:user_team) { create :user_team, team: team, user: user } context 'When valid request' do