Commit 3de560ca authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ag-fix-mdeia-type-warning' into 'master'

Fix deprecation warning about Content-Type header in Rails 6.1

See merge request gitlab-org/gitlab!47965
parents d3c93ccd 6ee9e57f
......@@ -19,7 +19,7 @@ RSpec.describe Boards::ListsController do
read_board_list user: user, board: board
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
it 'returns a list of board lists' do
......
......@@ -22,7 +22,7 @@ RSpec.describe Boards::MilestonesController do
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.size).to eq(1)
end
......
......@@ -25,7 +25,7 @@ RSpec.describe Boards::UsersController do
format: :json
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.length).to eq 2
end
......
......@@ -38,7 +38,7 @@ RSpec.describe Groups::BoardsController do
list_boards format: :json
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
......
......@@ -281,7 +281,7 @@ RSpec.describe Groups::EpicsController do
group.add_developer(user)
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'
end
......@@ -302,7 +302,7 @@ RSpec.describe Groups::EpicsController do
show_epic
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
......@@ -329,7 +329,7 @@ RSpec.describe Groups::EpicsController do
show_epic(:json)
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
......@@ -413,7 +413,7 @@ RSpec.describe Groups::EpicsController do
group.add_developer(user)
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')
end
......
......@@ -110,7 +110,7 @@ RSpec.describe Projects::BoardsController do
it 'returns a not found 404 response' do
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)
end
end
......@@ -187,7 +187,7 @@ RSpec.describe Projects::BoardsController do
it 'returns a not found 404 response' do
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)
end
end
......
......@@ -54,7 +54,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
it 'returns an OK response with JSON data' do
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)
end
end
......@@ -70,7 +70,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
it 'returns an OK response with binary data' do
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
......@@ -87,7 +87,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
it 'returns a redirect response' do
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)
end
end
......
......@@ -34,10 +34,10 @@ RSpec.shared_examples 'redirects to last visited board' do
if parent.is_a?(Group)
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)
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)
end
end
......
......@@ -341,7 +341,7 @@ RSpec.describe Admin::ClustersController do
expect { post_create_aws }.not_to change { Clusters::Cluster.count }
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')
end
end
......
......@@ -22,7 +22,7 @@ RSpec.describe Boards::ListsController do
read_board_list user: user, board: board
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
it 'returns a list of board lists' do
......
......@@ -21,7 +21,7 @@ RSpec.describe Groups::BoardsController do
list_boards
expect(response).to render_template :index
expect(response.content_type).to eq 'text/html'
expect(response.media_type).to eq 'text/html'
end
context 'with unauthorized user' do
......@@ -36,7 +36,7 @@ RSpec.describe Groups::BoardsController do
list_boards
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
......@@ -52,7 +52,7 @@ RSpec.describe Groups::BoardsController do
list_boards
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
......@@ -81,7 +81,7 @@ RSpec.describe Groups::BoardsController do
list_boards format: :json
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
......@@ -103,7 +103,7 @@ RSpec.describe Groups::BoardsController do
expect { read_board board: board }.to change(BoardGroupRecentVisit, :count).by(1)
expect(response).to render_template :show
expect(response.content_type).to eq 'text/html'
expect(response.media_type).to eq 'text/html'
end
context 'with unauthorized user' do
......@@ -118,7 +118,7 @@ RSpec.describe Groups::BoardsController do
read_board board: board
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
......@@ -131,7 +131,7 @@ RSpec.describe Groups::BoardsController do
expect { read_board board: board }.to change(BoardGroupRecentVisit, :count).by(0)
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
......@@ -157,7 +157,7 @@ RSpec.describe Groups::BoardsController do
read_board board: board, format: :json
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
......
......@@ -476,7 +476,7 @@ RSpec.describe Groups::ClustersController do
expect { post_create_aws }.not_to change { Clusters::Cluster.count }
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')
end
end
......
......@@ -177,7 +177,7 @@ RSpec.describe Groups::MilestonesController do
expect(milestones.count).to eq(3)
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.content_type).to eq 'application/json'
expect(response.media_type).to eq 'application/json'
end
context 'with subgroup milestones' do
......
......@@ -28,7 +28,7 @@ RSpec.describe Groups::ReleasesController do
end
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
it 'returns OK' do
......
......@@ -34,14 +34,14 @@ RSpec.describe HealthCheckController, :request_store do
get :index
expect(response).to be_successful
expect(response.content_type).to eq 'text/plain'
expect(response.media_type).to eq 'text/plain'
end
it 'supports passing the token in query params' do
get :index, params: { token: token }
expect(response).to be_successful
expect(response.content_type).to eq 'text/plain'
expect(response.media_type).to eq 'text/plain'
end
end
end
......@@ -55,14 +55,14 @@ RSpec.describe HealthCheckController, :request_store do
get :index
expect(response).to be_successful
expect(response.content_type).to eq 'text/plain'
expect(response.media_type).to eq 'text/plain'
end
it 'supports successful json response' do
get :index, format: :json
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
end
......@@ -70,7 +70,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, format: :xml
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
end
......@@ -78,7 +78,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, params: { checks: 'email' }, format: :json
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
end
end
......@@ -102,7 +102,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index
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')
end
......@@ -110,7 +110,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, format: :json
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['message']).to include('The server is on fire')
end
......@@ -119,7 +119,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, format: :xml
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['message']).to include('The server is on fire')
end
......@@ -128,7 +128,7 @@ RSpec.describe HealthCheckController, :request_store do
get :index, params: { checks: 'email' }, format: :json
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['message']).to include('Email is on fire')
end
......
......@@ -44,7 +44,7 @@ RSpec.describe Profiles::KeysController do
end
it "responds with text/plain content type" do
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
......@@ -84,7 +84,7 @@ RSpec.describe Profiles::KeysController do
it "responds with text/plain content type" do
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
......@@ -119,7 +119,7 @@ RSpec.describe Profiles::KeysController do
it "responds with text/plain content type" do
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
......
......@@ -27,7 +27,7 @@ RSpec.describe Projects::BoardsController do
list_boards
expect(response).to render_template :index
expect(response.content_type).to eq 'text/html'
expect(response.media_type).to eq 'text/html'
end
context 'with unauthorized user' do
......@@ -41,7 +41,7 @@ RSpec.describe Projects::BoardsController do
list_boards
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
......@@ -57,7 +57,7 @@ RSpec.describe Projects::BoardsController do
list_boards
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
......@@ -85,7 +85,7 @@ RSpec.describe Projects::BoardsController do
list_boards format: :json
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
......@@ -127,7 +127,7 @@ RSpec.describe Projects::BoardsController do
expect { read_board board: board }.to change(BoardProjectRecentVisit, :count).by(1)
expect(response).to render_template :show
expect(response.content_type).to eq 'text/html'
expect(response.media_type).to eq 'text/html'
end
context 'with unauthorized user' do
......@@ -141,7 +141,7 @@ RSpec.describe Projects::BoardsController do
read_board board: board
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
......@@ -154,7 +154,7 @@ RSpec.describe Projects::BoardsController do
expect { read_board board: board }.to change(BoardProjectRecentVisit, :count).by(0)
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
......@@ -179,7 +179,7 @@ RSpec.describe Projects::BoardsController do
read_board board: board, format: :json
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
......
......@@ -82,7 +82,7 @@ RSpec.describe Projects::Ci::LintsController do
end
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 match_schema('entities/lint_result_entity')
end
......
......@@ -500,7 +500,7 @@ RSpec.describe Projects::ClustersController do
expect { post_create_aws }.not_to change { Clusters::Cluster.count }
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')
end
end
......
......@@ -80,7 +80,7 @@ RSpec.describe Projects::CommitsController do
it "renders as atom" do
expect(response).to be_successful
expect(response.content_type).to eq('application/atom+xml')
expect(response.media_type).to eq('application/atom+xml')
end
it 'renders summary with type=html' do
......@@ -105,7 +105,7 @@ RSpec.describe Projects::CommitsController do
it "renders as HTML" do
expect(response).to be_successful
expect(response.content_type).to eq('text/html')
expect(response.media_type).to eq('text/html')
end
end
end
......
......@@ -33,14 +33,14 @@ RSpec.describe Projects::MilestonesController do
view_milestone
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
it 'returns milestone json' do
view_milestone format: :json
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
......@@ -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
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)
end
......@@ -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
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)
end
......@@ -262,7 +262,7 @@ RSpec.describe Projects::MilestonesController do
get :participants, params: params
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)
end
end
......@@ -277,7 +277,7 @@ RSpec.describe Projects::MilestonesController do
get :participants, params: params
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)
end
end
......
......@@ -83,7 +83,7 @@ RSpec.describe Projects::ReleasesController do
let(:format) { :html }
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
it_behaves_like 'common access controls'
......@@ -101,7 +101,7 @@ RSpec.describe Projects::ReleasesController do
let(:format) { :json }
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
it "returns the project's releases as JSON, ordered by released_at" do
......
......@@ -264,7 +264,7 @@ RSpec.describe API::GroupImport do
subject
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
it 'rejects requests that bypassed gitlab-workhorse' do
......@@ -285,7 +285,7 @@ RSpec.describe API::GroupImport do
subject
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['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL')
......@@ -304,7 +304,7 @@ RSpec.describe API::GroupImport do
subject
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['RemoteObject']).to be_nil
end
......
......@@ -303,7 +303,7 @@ RSpec.describe API::ProjectImport do
subject
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)
end
......@@ -325,7 +325,7 @@ RSpec.describe API::ProjectImport do
subject
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['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL')
......@@ -344,7 +344,7 @@ RSpec.describe API::ProjectImport do
subject
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['RemoteObject']).to be_nil
end
......
......@@ -10,7 +10,7 @@ RSpec.shared_examples 'handle uploads authorize request' do
subject
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)
end
......@@ -30,7 +30,7 @@ RSpec.shared_examples 'handle uploads authorize request' do
subject
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['RemoteObject']).to have_key('ID')
expect(json_response['RemoteObject']).to have_key('GetURL')
......@@ -49,7 +49,7 @@ RSpec.shared_examples 'handle uploads authorize request' do
subject
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['RemoteObject']).to be_nil
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