Commit d2edfc9e authored by James Lopez's avatar James Lopez

Merge branch '10io-fix-rails-6-warnings-on-nuget-api-specs' into 'master'

Fix rails 6 content type deprecation warnings

See merge request gitlab-org/gitlab!24680
parents 57be66b9 3c62d869
......@@ -482,7 +482,7 @@ describe API::ConanPackages do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
end
......@@ -498,7 +498,7 @@ describe API::ConanPackages do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
end
......@@ -513,7 +513,7 @@ describe API::ConanPackages do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
it 'denies download when not enough permissions' do
......@@ -688,7 +688,7 @@ describe API::ConanPackages 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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
it 'rejects request without a valid token' do
......@@ -725,7 +725,7 @@ describe API::ConanPackages 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 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')
......@@ -744,7 +744,7 @@ describe API::ConanPackages 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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(::Packages::PackageFileUploader.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil
end
......
......@@ -114,14 +114,14 @@ describe API::NpmPackages do
get_file_with_token(package_file)
expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
it 'returns the file with a job token' do
get_file_with_job_token(package_file)
expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
it 'denies download with no token' do
......@@ -138,7 +138,7 @@ describe API::NpmPackages do
subject
expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
it_behaves_like 'a gitlab tracking event', described_class.name, 'pull_package'
......@@ -514,7 +514,7 @@ describe API::NpmPackages do
def expect_a_valid_package_response
expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq('application/json')
expect(response.media_type).to eq('application/json')
expect(response).to match_response_schema('public_api/v4/packages/npm_package', dir: 'ee')
expect(json_response['name']).to eq(package.name)
expect(json_response['versions'][package.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee')
......
......@@ -10,7 +10,7 @@ describe 'Git HTTP requests' do
it do
download(path, env) do |response|
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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
end
end
......@@ -19,7 +19,7 @@ describe 'Git HTTP requests' do
it do
upload(path, env) do |response|
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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
end
end
......
......@@ -49,7 +49,7 @@ RSpec.shared_examples 'process nuget service index request' do |user_type, statu
it 'returns a valid json response' do
subject
expect(response.content_type.to_s).to eq('application/json')
expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema('public_api/v4/packages/nuget/service_index', dir: 'ee')
expect(json_response).to be_a(Hash)
end
......@@ -66,7 +66,7 @@ RSpec.shared_examples 'returning nuget metadata json response with json schema'
it 'returns a valid json response' do
subject
expect(response.content_type.to_s).to eq('application/json')
expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema(json_schema, dir: 'ee')
expect(json_response).to be_a(Hash)
end
......@@ -135,7 +135,7 @@ RSpec.shared_examples 'process nuget workhorse authorization' do |user_type, sta
it 'has the proper content type' do
subject
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
context 'with a request that bypassed gitlab-workhorse' do
......@@ -227,7 +227,7 @@ RSpec.shared_examples 'process nuget download versions request' do |user_type, s
it 'returns a valid json response' do
subject
expect(response.content_type.to_s).to eq('application/json')
expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema('public_api/v4/packages/nuget/download_versions', dir: 'ee')
expect(json_response).to be_a(Hash)
expect(json_response['versions']).to match_array(packages.map(&:version).sort)
......@@ -270,7 +270,7 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st
it 'returns a valid package archive' do
subject
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
context 'with invalid format' do
......@@ -287,7 +287,7 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st
it 'returns a valid package archive' do
subject
expect(response.content_type.to_s).to eq('application/octet-stream')
expect(response.media_type).to eq('application/octet-stream')
end
end
end
......
......@@ -22,7 +22,7 @@ RSpec.shared_examples 'returns package tags' do |user_type|
it 'returns a valid json response' do
subject
expect(response.content_type.to_s).to eq('application/json')
expect(response.media_type).to eq('application/json')
expect(json_response).to be_a(Hash)
end
......
......@@ -1462,7 +1462,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
subject
expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(JobArtifactUploader.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil
end
......@@ -1482,7 +1482,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
subject
expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(response.media_type).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')
......@@ -1558,7 +1558,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
authorize_artifacts_with_token_in_headers
expect(response).to have_gitlab_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).not_to be_nil
end
......
......@@ -92,7 +92,7 @@ describe 'Git HTTP requests' do
it 'allows pulls' do
download(path, env) do |response|
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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
end
end
......@@ -101,7 +101,7 @@ describe 'Git HTTP requests' do
it 'allows pushes', :sidekiq_might_not_need_inline do
upload(path, env) do |response|
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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
end
end
......@@ -509,7 +509,7 @@ describe 'Git HTTP requests' do
download(path, env) do
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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
end
......@@ -518,7 +518,7 @@ describe 'Git HTTP requests' do
upload(path, env) do
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 eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end
end
......
......@@ -907,7 +907,7 @@ describe 'Git LFS API and storage' do
it_behaves_like 'LFS http 200 response'
it 'uses the gitlab-workhorse content type' do
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
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