Commit 6ee9e57f authored by Aakriti Gupta's avatar Aakriti Gupta

Use media_type instead of content_type that is going to be deprecated

> DEPRECATION WARNING: Rails 6.1 will return
Content-Type header without modification. If you
want just the MIME type, please use `#media_type`
 instead. (called from block (4 levels) in <main>
 at gitlab/ee/spec/requests/git_http_geo_spec.rb:57)
parent aa23cea5
...@@ -19,7 +19,7 @@ RSpec.describe Boards::ListsController do ...@@ -19,7 +19,7 @@ RSpec.describe Boards::ListsController do
read_board_list user: user, board: board read_board_list user: user, board: board
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
it 'returns a list of board lists' do it 'returns a list of board lists' do
......
...@@ -22,7 +22,7 @@ RSpec.describe Boards::MilestonesController do ...@@ -22,7 +22,7 @@ RSpec.describe Boards::MilestonesController do
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(json_response).to all(match_schema('entities/milestone', dir: 'ee')) expect(json_response).to all(match_schema('entities/milestone', dir: 'ee'))
expect(json_response.size).to eq(1) expect(json_response.size).to eq(1)
end end
......
...@@ -25,7 +25,7 @@ RSpec.describe Boards::UsersController do ...@@ -25,7 +25,7 @@ RSpec.describe Boards::UsersController do
format: :json format: :json
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response).to all(match_schema('entities/user')) expect(json_response).to all(match_schema('entities/user'))
expect(json_response.length).to eq 2 expect(json_response.length).to eq 2
end end
......
...@@ -38,7 +38,7 @@ RSpec.describe Groups::BoardsController do ...@@ -38,7 +38,7 @@ RSpec.describe Groups::BoardsController do
list_boards format: :json list_boards format: :json
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
end end
end end
......
...@@ -281,7 +281,7 @@ RSpec.describe Groups::EpicsController do ...@@ -281,7 +281,7 @@ RSpec.describe Groups::EpicsController do
group.add_developer(user) group.add_developer(user)
show_epic show_epic
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
expect(response).to render_template 'groups/epics/show' expect(response).to render_template 'groups/epics/show'
end end
...@@ -302,7 +302,7 @@ RSpec.describe Groups::EpicsController do ...@@ -302,7 +302,7 @@ RSpec.describe Groups::EpicsController do
show_epic show_epic
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
...@@ -329,7 +329,7 @@ RSpec.describe Groups::EpicsController do ...@@ -329,7 +329,7 @@ RSpec.describe Groups::EpicsController do
show_epic(:json) show_epic(:json)
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
end end
end end
...@@ -413,7 +413,7 @@ RSpec.describe Groups::EpicsController do ...@@ -413,7 +413,7 @@ RSpec.describe Groups::EpicsController do
group.add_developer(user) group.add_developer(user)
subject subject
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response).to include('title_text', 'title', 'description', 'description_text') expect(json_response).to include('title_text', 'title', 'description', 'description_text')
end end
......
...@@ -110,7 +110,7 @@ RSpec.describe Projects::BoardsController do ...@@ -110,7 +110,7 @@ RSpec.describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
create_board name: 'Backend' create_board name: 'Backend'
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -187,7 +187,7 @@ RSpec.describe Projects::BoardsController do ...@@ -187,7 +187,7 @@ RSpec.describe Projects::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
update_board board, update_params update_board board, update_params
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -54,7 +54,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do ...@@ -54,7 +54,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
it 'returns an OK response with JSON data' do it 'returns an OK response with JSON data' do
is_expected.to have_gitlab_http_status(:ok) is_expected.to have_gitlab_http_status(:ok)
expect(response.content_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response).to include('ShowAllRefs' => true) expect(json_response).to include('ShowAllRefs' => true)
end end
end end
...@@ -70,7 +70,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do ...@@ -70,7 +70,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
it 'returns an OK response with binary data' do it 'returns an OK response with binary data' do
is_expected.to have_gitlab_http_status(:ok) is_expected.to have_gitlab_http_status(:ok)
expect(response.content_type).to eq('application/octet-stream') expect(response.media_type).to eq('application/octet-stream')
end end
end end
end end
...@@ -87,7 +87,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do ...@@ -87,7 +87,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
it 'returns a redirect response' do it 'returns a redirect response' do
is_expected.to have_gitlab_http_status(:redirect) is_expected.to have_gitlab_http_status(:redirect)
expect(response.content_type).to eq('text/html') expect(response.media_type).to eq('text/html')
expect(response.headers['Location']).to eq(redirect_url) expect(response.headers['Location']).to eq(redirect_url)
end end
end end
......
...@@ -34,10 +34,10 @@ RSpec.shared_examples 'redirects to last visited board' do ...@@ -34,10 +34,10 @@ RSpec.shared_examples 'redirects to last visited board' do
if parent.is_a?(Group) if parent.is_a?(Group)
expect(response).to render_template :index expect(response).to render_template :index
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
else else
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
expect(response).to have_gitlab_http_status(:found) expect(response).to have_gitlab_http_status(:found)
end end
end end
......
...@@ -341,7 +341,7 @@ RSpec.describe Admin::ClustersController do ...@@ -341,7 +341,7 @@ RSpec.describe Admin::ClustersController do
expect { post_create_aws }.not_to change { Clusters::Cluster.count } expect { post_create_aws }.not_to change { Clusters::Cluster.count }
expect(response).to have_gitlab_http_status(:unprocessable_entity) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(response.content_type).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(response.body).to include('is invalid') expect(response.body).to include('is invalid')
end end
end end
......
...@@ -22,7 +22,7 @@ RSpec.describe Boards::ListsController do ...@@ -22,7 +22,7 @@ RSpec.describe Boards::ListsController do
read_board_list user: user, board: board read_board_list user: user, board: board
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
it 'returns a list of board lists' do it 'returns a list of board lists' do
......
...@@ -21,7 +21,7 @@ RSpec.describe Groups::BoardsController do ...@@ -21,7 +21,7 @@ RSpec.describe Groups::BoardsController do
list_boards list_boards
expect(response).to render_template :index expect(response).to render_template :index
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
context 'with unauthorized user' do context 'with unauthorized user' do
...@@ -36,7 +36,7 @@ RSpec.describe Groups::BoardsController do ...@@ -36,7 +36,7 @@ RSpec.describe Groups::BoardsController do
list_boards list_boards
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
...@@ -52,7 +52,7 @@ RSpec.describe Groups::BoardsController do ...@@ -52,7 +52,7 @@ RSpec.describe Groups::BoardsController do
list_boards list_boards
expect(response).to render_template :index expect(response).to render_template :index
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
end end
...@@ -81,7 +81,7 @@ RSpec.describe Groups::BoardsController do ...@@ -81,7 +81,7 @@ RSpec.describe Groups::BoardsController do
list_boards format: :json list_boards format: :json
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
end end
end end
...@@ -103,7 +103,7 @@ RSpec.describe Groups::BoardsController do ...@@ -103,7 +103,7 @@ RSpec.describe Groups::BoardsController do
expect { read_board board: board }.to change(BoardGroupRecentVisit, :count).by(1) expect { read_board board: board }.to change(BoardGroupRecentVisit, :count).by(1)
expect(response).to render_template :show expect(response).to render_template :show
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
context 'with unauthorized user' do context 'with unauthorized user' do
...@@ -118,7 +118,7 @@ RSpec.describe Groups::BoardsController do ...@@ -118,7 +118,7 @@ RSpec.describe Groups::BoardsController do
read_board board: board read_board board: board
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
...@@ -131,7 +131,7 @@ RSpec.describe Groups::BoardsController do ...@@ -131,7 +131,7 @@ RSpec.describe Groups::BoardsController do
expect { read_board board: board }.to change(BoardGroupRecentVisit, :count).by(0) expect { read_board board: board }.to change(BoardGroupRecentVisit, :count).by(0)
expect(response).to render_template :show expect(response).to render_template :show
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
end end
...@@ -157,7 +157,7 @@ RSpec.describe Groups::BoardsController do ...@@ -157,7 +157,7 @@ RSpec.describe Groups::BoardsController do
read_board board: board, format: :json read_board board: board, format: :json
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
end end
end end
......
...@@ -476,7 +476,7 @@ RSpec.describe Groups::ClustersController do ...@@ -476,7 +476,7 @@ RSpec.describe Groups::ClustersController do
expect { post_create_aws }.not_to change { Clusters::Cluster.count } expect { post_create_aws }.not_to change { Clusters::Cluster.count }
expect(response).to have_gitlab_http_status(:unprocessable_entity) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(response.content_type).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(response.body).to include('is invalid') expect(response.body).to include('is invalid')
end end
end end
......
...@@ -177,7 +177,7 @@ RSpec.describe Groups::MilestonesController do ...@@ -177,7 +177,7 @@ RSpec.describe Groups::MilestonesController do
expect(milestones.count).to eq(3) expect(milestones.count).to eq(3)
expect(milestones.collect { |m| m['title'] }).to match_array(['same name', 'same name', 'group milestone']) expect(milestones.collect { |m| m['title'] }).to match_array(['same name', 'same name', 'group milestone'])
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
context 'with subgroup milestones' do context 'with subgroup milestones' do
......
...@@ -28,7 +28,7 @@ RSpec.describe Groups::ReleasesController do ...@@ -28,7 +28,7 @@ RSpec.describe Groups::ReleasesController do
end end
it 'returns an application/json content_type' do it 'returns an application/json content_type' do
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
it 'returns OK' do it 'returns OK' do
......
...@@ -34,14 +34,14 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -34,14 +34,14 @@ RSpec.describe HealthCheckController, :request_store do
get :index get :index
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq 'text/plain' expect(response.media_type).to eq 'text/plain'
end end
it 'supports passing the token in query params' do it 'supports passing the token in query params' do
get :index, params: { token: token } get :index, params: { token: token }
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq 'text/plain' expect(response.media_type).to eq 'text/plain'
end end
end end
end end
...@@ -55,14 +55,14 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -55,14 +55,14 @@ RSpec.describe HealthCheckController, :request_store do
get :index get :index
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq 'text/plain' expect(response.media_type).to eq 'text/plain'
end end
it 'supports successful json response' do it 'supports successful json response' do
get :index, format: :json get :index, format: :json
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['healthy']).to be true expect(json_response['healthy']).to be true
end end
...@@ -70,7 +70,7 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -70,7 +70,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, format: :xml get :index, format: :xml
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq 'application/xml' expect(response.media_type).to eq 'application/xml'
expect(xml_response['healthy']).to be true expect(xml_response['healthy']).to be true
end end
...@@ -78,7 +78,7 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -78,7 +78,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, params: { checks: 'email' }, format: :json get :index, params: { checks: 'email' }, format: :json
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['healthy']).to be true expect(json_response['healthy']).to be true
end end
end end
...@@ -102,7 +102,7 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -102,7 +102,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index get :index
expect(response).to have_gitlab_http_status(:internal_server_error) expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'text/plain' expect(response.media_type).to eq 'text/plain'
expect(response.body).to include('The server is on fire') expect(response.body).to include('The server is on fire')
end end
...@@ -110,7 +110,7 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -110,7 +110,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, format: :json get :index, format: :json
expect(response).to have_gitlab_http_status(:internal_server_error) expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['healthy']).to be false expect(json_response['healthy']).to be false
expect(json_response['message']).to include('The server is on fire') expect(json_response['message']).to include('The server is on fire')
end end
...@@ -119,7 +119,7 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -119,7 +119,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, format: :xml get :index, format: :xml
expect(response).to have_gitlab_http_status(:internal_server_error) expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/xml' expect(response.media_type).to eq 'application/xml'
expect(xml_response['healthy']).to be false expect(xml_response['healthy']).to be false
expect(xml_response['message']).to include('The server is on fire') expect(xml_response['message']).to include('The server is on fire')
end end
...@@ -128,7 +128,7 @@ RSpec.describe HealthCheckController, :request_store do ...@@ -128,7 +128,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, params: { checks: 'email' }, format: :json get :index, params: { checks: 'email' }, format: :json
expect(response).to have_gitlab_http_status(:internal_server_error) expect(response).to have_gitlab_http_status(:internal_server_error)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['healthy']).to be false expect(json_response['healthy']).to be false
expect(json_response['message']).to include('Email is on fire') expect(json_response['message']).to include('Email is on fire')
end end
......
...@@ -44,7 +44,7 @@ RSpec.describe Profiles::KeysController do ...@@ -44,7 +44,7 @@ RSpec.describe Profiles::KeysController do
end end
it "responds with text/plain content type" do it "responds with text/plain content type" do
get :get_keys, params: { username: user.username } get :get_keys, params: { username: user.username }
expect(response.content_type).to eq("text/plain") expect(response.media_type).to eq("text/plain")
end end
end end
...@@ -84,7 +84,7 @@ RSpec.describe Profiles::KeysController do ...@@ -84,7 +84,7 @@ RSpec.describe Profiles::KeysController do
it "responds with text/plain content type" do it "responds with text/plain content type" do
get :get_keys, params: { username: user.username } get :get_keys, params: { username: user.username }
expect(response.content_type).to eq("text/plain") expect(response.media_type).to eq("text/plain")
end end
end end
...@@ -119,7 +119,7 @@ RSpec.describe Profiles::KeysController do ...@@ -119,7 +119,7 @@ RSpec.describe Profiles::KeysController do
it "responds with text/plain content type" do it "responds with text/plain content type" do
get :get_keys, params: { username: user.username } get :get_keys, params: { username: user.username }
expect(response.content_type).to eq("text/plain") expect(response.media_type).to eq("text/plain")
end end
end end
end end
......
...@@ -27,7 +27,7 @@ RSpec.describe Projects::BoardsController do ...@@ -27,7 +27,7 @@ RSpec.describe Projects::BoardsController do
list_boards list_boards
expect(response).to render_template :index expect(response).to render_template :index
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
context 'with unauthorized user' do context 'with unauthorized user' do
...@@ -41,7 +41,7 @@ RSpec.describe Projects::BoardsController do ...@@ -41,7 +41,7 @@ RSpec.describe Projects::BoardsController do
list_boards list_boards
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
...@@ -57,7 +57,7 @@ RSpec.describe Projects::BoardsController do ...@@ -57,7 +57,7 @@ RSpec.describe Projects::BoardsController do
list_boards list_boards
expect(response).to render_template :index expect(response).to render_template :index
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
end end
...@@ -85,7 +85,7 @@ RSpec.describe Projects::BoardsController do ...@@ -85,7 +85,7 @@ RSpec.describe Projects::BoardsController do
list_boards format: :json list_boards format: :json
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
end end
end end
...@@ -127,7 +127,7 @@ RSpec.describe Projects::BoardsController do ...@@ -127,7 +127,7 @@ RSpec.describe Projects::BoardsController do
expect { read_board board: board }.to change(BoardProjectRecentVisit, :count).by(1) expect { read_board board: board }.to change(BoardProjectRecentVisit, :count).by(1)
expect(response).to render_template :show expect(response).to render_template :show
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
context 'with unauthorized user' do context 'with unauthorized user' do
...@@ -141,7 +141,7 @@ RSpec.describe Projects::BoardsController do ...@@ -141,7 +141,7 @@ RSpec.describe Projects::BoardsController do
read_board board: board read_board board: board
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
...@@ -154,7 +154,7 @@ RSpec.describe Projects::BoardsController do ...@@ -154,7 +154,7 @@ RSpec.describe Projects::BoardsController do
expect { read_board board: board }.to change(BoardProjectRecentVisit, :count).by(0) expect { read_board board: board }.to change(BoardProjectRecentVisit, :count).by(0)
expect(response).to render_template :show expect(response).to render_template :show
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
end end
end end
...@@ -179,7 +179,7 @@ RSpec.describe Projects::BoardsController do ...@@ -179,7 +179,7 @@ RSpec.describe Projects::BoardsController do
read_board board: board, format: :json read_board board: board, format: :json
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
end end
end end
......
...@@ -82,7 +82,7 @@ RSpec.describe Projects::Ci::LintsController do ...@@ -82,7 +82,7 @@ RSpec.describe Projects::Ci::LintsController do
end end
it 'renders json' do it 'renders json' do
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(parsed_body).to include('errors', 'warnings', 'jobs', 'valid') expect(parsed_body).to include('errors', 'warnings', 'jobs', 'valid')
expect(parsed_body).to match_schema('entities/lint_result_entity') expect(parsed_body).to match_schema('entities/lint_result_entity')
end end
......
...@@ -500,7 +500,7 @@ RSpec.describe Projects::ClustersController do ...@@ -500,7 +500,7 @@ RSpec.describe Projects::ClustersController do
expect { post_create_aws }.not_to change { Clusters::Cluster.count } expect { post_create_aws }.not_to change { Clusters::Cluster.count }
expect(response).to have_gitlab_http_status(:unprocessable_entity) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(response.content_type).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(response.body).to include('is invalid') expect(response.body).to include('is invalid')
end end
end end
......
...@@ -80,7 +80,7 @@ RSpec.describe Projects::CommitsController do ...@@ -80,7 +80,7 @@ RSpec.describe Projects::CommitsController do
it "renders as atom" do it "renders as atom" do
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq('application/atom+xml') expect(response.media_type).to eq('application/atom+xml')
end end
it 'renders summary with type=html' do it 'renders summary with type=html' do
...@@ -105,7 +105,7 @@ RSpec.describe Projects::CommitsController do ...@@ -105,7 +105,7 @@ RSpec.describe Projects::CommitsController do
it "renders as HTML" do it "renders as HTML" do
expect(response).to be_successful expect(response).to be_successful
expect(response.content_type).to eq('text/html') expect(response.media_type).to eq('text/html')
end end
end end
end end
......
...@@ -33,14 +33,14 @@ RSpec.describe Projects::MilestonesController do ...@@ -33,14 +33,14 @@ RSpec.describe Projects::MilestonesController do
view_milestone view_milestone
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
it 'returns milestone json' do it 'returns milestone json' do
view_milestone format: :json view_milestone format: :json
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
end end
...@@ -189,7 +189,7 @@ RSpec.describe Projects::MilestonesController do ...@@ -189,7 +189,7 @@ RSpec.describe Projects::MilestonesController do
get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['html']).not_to include(label.title) expect(json_response['html']).not_to include(label.title)
end end
...@@ -200,7 +200,7 @@ RSpec.describe Projects::MilestonesController do ...@@ -200,7 +200,7 @@ RSpec.describe Projects::MilestonesController do
get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json get :labels, params: { namespace_id: group.id, project_id: project.id, id: milestone.iid }, format: :json
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['html']).to include(label.title) expect(json_response['html']).to include(label.title)
end end
...@@ -262,7 +262,7 @@ RSpec.describe Projects::MilestonesController do ...@@ -262,7 +262,7 @@ RSpec.describe Projects::MilestonesController do
get :participants, params: params get :participants, params: params
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['html']).to include(issue_assignee.name) expect(json_response['html']).to include(issue_assignee.name)
end end
end end
...@@ -277,7 +277,7 @@ RSpec.describe Projects::MilestonesController do ...@@ -277,7 +277,7 @@ RSpec.describe Projects::MilestonesController do
get :participants, params: params get :participants, params: params
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
expect(json_response['html']).not_to include(issue_assignee.name) expect(json_response['html']).not_to include(issue_assignee.name)
end end
end end
......
...@@ -83,7 +83,7 @@ RSpec.describe Projects::ReleasesController do ...@@ -83,7 +83,7 @@ RSpec.describe Projects::ReleasesController do
let(:format) { :html } let(:format) { :html }
it 'returns a text/html content_type' do it 'returns a text/html content_type' do
expect(response.content_type).to eq 'text/html' expect(response.media_type).to eq 'text/html'
end end
it_behaves_like 'common access controls' it_behaves_like 'common access controls'
...@@ -101,7 +101,7 @@ RSpec.describe Projects::ReleasesController do ...@@ -101,7 +101,7 @@ RSpec.describe Projects::ReleasesController do
let(:format) { :json } let(:format) { :json }
it 'returns an application/json content_type' do it 'returns an application/json content_type' do
expect(response.content_type).to eq 'application/json' expect(response.media_type).to eq 'application/json'
end end
it "returns the project's releases as JSON, ordered by released_at" do it "returns the project's releases as JSON, ordered by released_at" do
......
...@@ -264,7 +264,7 @@ RSpec.describe API::GroupImport do ...@@ -264,7 +264,7 @@ RSpec.describe API::GroupImport do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
it 'rejects requests that bypassed gitlab-workhorse' do it 'rejects requests that bypassed gitlab-workhorse' do
...@@ -285,7 +285,7 @@ RSpec.describe API::GroupImport do ...@@ -285,7 +285,7 @@ RSpec.describe API::GroupImport do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response).not_to have_key('TempPath') expect(json_response).not_to have_key('TempPath')
expect(json_response['RemoteObject']).to have_key('ID') expect(json_response['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL') expect(json_response['RemoteObject']).to have_key('GetURL')
...@@ -304,7 +304,7 @@ RSpec.describe API::GroupImport do ...@@ -304,7 +304,7 @@ RSpec.describe API::GroupImport do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(ImportExportUploader.workhorse_local_upload_path) expect(json_response['TempPath']).to eq(ImportExportUploader.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil expect(json_response['RemoteObject']).to be_nil
end end
......
...@@ -303,7 +303,7 @@ RSpec.describe API::ProjectImport do ...@@ -303,7 +303,7 @@ RSpec.describe API::ProjectImport do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(ImportExportUploader.workhorse_local_upload_path) expect(json_response['TempPath']).to eq(ImportExportUploader.workhorse_local_upload_path)
end end
...@@ -325,7 +325,7 @@ RSpec.describe API::ProjectImport do ...@@ -325,7 +325,7 @@ RSpec.describe API::ProjectImport do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response).not_to have_key('TempPath') expect(json_response).not_to have_key('TempPath')
expect(json_response['RemoteObject']).to have_key('ID') expect(json_response['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL') expect(json_response['RemoteObject']).to have_key('GetURL')
...@@ -344,7 +344,7 @@ RSpec.describe API::ProjectImport do ...@@ -344,7 +344,7 @@ RSpec.describe API::ProjectImport do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(ImportExportUploader.workhorse_local_upload_path) expect(json_response['TempPath']).to eq(ImportExportUploader.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil expect(json_response['RemoteObject']).to be_nil
end end
......
...@@ -10,7 +10,7 @@ RSpec.shared_examples 'handle uploads authorize request' do ...@@ -10,7 +10,7 @@ RSpec.shared_examples 'handle uploads authorize request' do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(uploader_class.workhorse_local_upload_path) expect(json_response['TempPath']).to eq(uploader_class.workhorse_local_upload_path)
end end
...@@ -30,7 +30,7 @@ RSpec.shared_examples 'handle uploads authorize request' do ...@@ -30,7 +30,7 @@ RSpec.shared_examples 'handle uploads authorize request' do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response).not_to have_key('TempPath') expect(json_response).not_to have_key('TempPath')
expect(json_response['RemoteObject']).to have_key('ID') expect(json_response['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL') expect(json_response['RemoteObject']).to have_key('GetURL')
...@@ -49,7 +49,7 @@ RSpec.shared_examples 'handle uploads authorize request' do ...@@ -49,7 +49,7 @@ RSpec.shared_examples 'handle uploads authorize request' do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(uploader_class.workhorse_local_upload_path) expect(json_response['TempPath']).to eq(uploader_class.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil expect(json_response['RemoteObject']).to be_nil
end end
......
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