Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
580622bdb3
commit
abae8f34f3
71 changed files with 337 additions and 209 deletions
|
@ -1 +1 @@
|
|||
8.28.0
|
||||
8.29.0
|
||||
|
|
|
@ -259,7 +259,7 @@ export default {
|
|||
:data-clipboard-text="clipboardText"
|
||||
@click="showToast(clipboardText)"
|
||||
>
|
||||
{{ __('Generate link to chart') }}
|
||||
{{ __('Copy link to chart') }}
|
||||
</gl-dropdown-item>
|
||||
<gl-dropdown-item
|
||||
v-if="alertWidgetAvailable"
|
||||
|
|
|
@ -13,6 +13,7 @@ class Projects::PipelinesController < Projects::ApplicationController
|
|||
before_action do
|
||||
push_frontend_feature_flag(:junit_pipeline_view)
|
||||
end
|
||||
before_action :ensure_pipeline, only: [:show]
|
||||
|
||||
around_action :allow_gitaly_ref_name_caching, only: [:index, :show]
|
||||
|
||||
|
@ -214,6 +215,10 @@ class Projects::PipelinesController < Projects::ApplicationController
|
|||
params.require(:pipeline).permit(:ref, variables_attributes: %i[key variable_type secret_value])
|
||||
end
|
||||
|
||||
def ensure_pipeline
|
||||
render_404 unless pipeline
|
||||
end
|
||||
|
||||
# rubocop: disable CodeReuse/ActiveRecord
|
||||
def pipeline
|
||||
@pipeline ||= if params[:id].blank? && params[:latest]
|
||||
|
|
|
@ -919,7 +919,7 @@
|
|||
:urgency: :low
|
||||
:resource_boundary: :unknown
|
||||
:weight: 1
|
||||
:idempotent:
|
||||
:idempotent: true
|
||||
- :name: authorized_keys
|
||||
:feature_category: :source_code_management
|
||||
:has_external_dependencies:
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Namespaces
|
||||
class ScheduleAggregationWorker # rubocop:disable Scalability/IdempotentWorker
|
||||
class ScheduleAggregationWorker
|
||||
include ApplicationWorker
|
||||
|
||||
queue_namespace :update_namespace_statistics
|
||||
feature_category :source_code_management
|
||||
idempotent!
|
||||
|
||||
def perform(namespace_id)
|
||||
return unless aggregation_schedules_table_exists?
|
||||
|
|
|
@ -3,11 +3,21 @@
|
|||
class ProjectUpdateRepositoryStorageWorker # rubocop:disable Scalability/IdempotentWorker
|
||||
include ApplicationWorker
|
||||
|
||||
SameFilesystemError = Class.new(StandardError)
|
||||
|
||||
feature_category :gitaly
|
||||
|
||||
def perform(project_id, new_repository_storage_key)
|
||||
project = Project.find(project_id)
|
||||
|
||||
raise SameFilesystemError if same_filesystem?(project.repository.storage, new_repository_storage_key)
|
||||
|
||||
::Projects::UpdateRepositoryStorageService.new(project).execute(new_repository_storage_key)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def same_filesystem?(old_storage, new_storage)
|
||||
Gitlab::GitalyClient.filesystem_id(old_storage) == Gitlab::GitalyClient.filesystem_id(new_storage)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Prevent ProjectUpdateRepositoryStorageWorker from moving to same filesystem
|
||||
merge_request: 28469
|
||||
author:
|
||||
type: fixed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Change the link to chart copy text
|
||||
merge_request: 28371
|
||||
author:
|
||||
type: other
|
5
changelogs/unreleased/sh-handle-no-latest-pipeline.yml
Normal file
5
changelogs/unreleased/sh-handle-no-latest-pipeline.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Gracefully handle missing latest CI pipeline
|
||||
merge_request: 28263
|
||||
author:
|
||||
type: fixed
|
|
@ -543,7 +543,8 @@ expect(metrics.merged_at).to be_like_time(time)
|
|||
|
||||
#### `have_gitlab_http_status`
|
||||
|
||||
Prefer `have_gitlab_http_status` over `have_http_status` because the former
|
||||
Prefer `have_gitlab_http_status` over `have_http_status` and
|
||||
`expect(response.status).to` because the former
|
||||
could also show the response body whenever the status mismatched. This would
|
||||
be very useful whenever some tests start breaking and we would love to know
|
||||
why without editing the source and rerun the tests.
|
||||
|
|
|
@ -6,7 +6,8 @@ module Gitlab
|
|||
module SidekiqMiddleware
|
||||
module DuplicateJobs
|
||||
DROPPABLE_QUEUES = Set.new([
|
||||
Namespaces::RootStatisticsWorker.queue
|
||||
Namespaces::RootStatisticsWorker.queue,
|
||||
Namespaces::ScheduleAggregationWorker.queue
|
||||
]).freeze
|
||||
|
||||
def self.drop_duplicates?(queue_name)
|
||||
|
|
|
@ -5656,6 +5656,9 @@ msgstr ""
|
|||
msgid "Copy link"
|
||||
msgstr ""
|
||||
|
||||
msgid "Copy link to chart"
|
||||
msgstr ""
|
||||
|
||||
msgid "Copy personal access token"
|
||||
msgstr ""
|
||||
|
||||
|
@ -9141,9 +9144,6 @@ msgstr ""
|
|||
msgid "Generate key"
|
||||
msgstr ""
|
||||
|
||||
msgid "Generate link to chart"
|
||||
msgstr ""
|
||||
|
||||
msgid "Generate new export"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
"@babel/plugin-proposal-private-methods": "^7.8.3",
|
||||
"@babel/plugin-syntax-import-meta": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.4",
|
||||
"@gitlab/at.js": "^1.5.5",
|
||||
"@gitlab/svgs": "^1.116.0",
|
||||
"@gitlab/ui": "^10.1.2",
|
||||
"@gitlab/at.js": "1.5.5",
|
||||
"@gitlab/svgs": "1.116.0",
|
||||
"@gitlab/ui": "10.1.2",
|
||||
"@gitlab/visual-review-tools": "1.5.1",
|
||||
"@sentry/browser": "^5.10.2",
|
||||
"@sourcegraph/code-host-integration": "0.0.34",
|
||||
|
@ -145,7 +145,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.8.3",
|
||||
"@gitlab/eslint-plugin": "^2.0.0",
|
||||
"@gitlab/eslint-plugin": "2.0.0",
|
||||
"@vue/test-utils": "^1.0.0-beta.30",
|
||||
"axios-mock-adapter": "^1.15.0",
|
||||
"babel-jest": "^24.1.0",
|
||||
|
|
|
@ -15,39 +15,67 @@ module RuboCop
|
|||
# expect(response).to have_http_status(200)
|
||||
# expect(response).to have_http_status(:ok)
|
||||
# expect(response).to have_gitlab_http_status(200)
|
||||
# expect(response.status).to eq(200)
|
||||
# expect(response.status).not_to eq(200)
|
||||
#
|
||||
# # good
|
||||
# expect(response).to have_gitlab_http_status(:ok)
|
||||
# expect(response).not_to have_gitlab_http_status(:ok)
|
||||
#
|
||||
class HaveGitlabHttpStatus < RuboCop::Cop::Cop
|
||||
CODE_TO_SYMBOL = Rack::Utils::SYMBOL_TO_STATUS_CODE.invert
|
||||
|
||||
MSG_MATCHER_NAME =
|
||||
'Use `have_gitlab_http_status` instead of `have_http_status`.'
|
||||
'Prefer `have_gitlab_http_status` over `have_http_status`.'
|
||||
|
||||
MSG_STATUS =
|
||||
MSG_NUMERIC_STATUS =
|
||||
'Prefer named HTTP status `%{name}` over ' \
|
||||
'its numeric representation `%{code}`.'
|
||||
|
||||
MSG_UNKNOWN = 'HTTP status `%{code}` is unknown. ' \
|
||||
MSG_RESPONSE_STATUS =
|
||||
'Prefer `have_gitlab_http_status` matcher over ' \
|
||||
'`response.status`.'
|
||||
|
||||
MSG_UNKNOWN_STATUS = 'HTTP status `%{code}` is unknown. ' \
|
||||
'Please provide a valid one or disable this cop.'
|
||||
|
||||
MSG_DOCS_LINK = 'https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#have_gitlab_http_status'
|
||||
|
||||
REPLACEMENT = 'have_gitlab_http_status(%{arg})'
|
||||
|
||||
REPLACEMENT_RESPONSE_STATUS =
|
||||
'expect(response).%{expectation} have_gitlab_http_status(%{arg})'
|
||||
|
||||
def_node_matcher :have_http_status?, <<~PATTERN
|
||||
(
|
||||
send nil?
|
||||
{
|
||||
:have_http_status
|
||||
:have_gitlab_http_status
|
||||
}
|
||||
(send nil?
|
||||
{ :have_http_status :have_gitlab_http_status }
|
||||
_
|
||||
)
|
||||
PATTERN
|
||||
|
||||
def_node_matcher :response_status_eq?, <<~PATTERN
|
||||
(send
|
||||
(send nil? :expect
|
||||
(send
|
||||
(send nil? :response) :status)) ${ :to :not_to }
|
||||
(send nil? :eq
|
||||
(int $_)))
|
||||
PATTERN
|
||||
|
||||
def on_send(node)
|
||||
offense_for_matcher(node) || offense_for_response_status(node)
|
||||
end
|
||||
|
||||
def autocorrect(node)
|
||||
lambda do |corrector|
|
||||
replacement = replace_matcher(node) || replace_response_status(node)
|
||||
corrector.replace(node.source_range, replacement)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def offense_for_matcher(node)
|
||||
return unless have_http_status?(node)
|
||||
|
||||
offenses = [
|
||||
|
@ -57,16 +85,31 @@ module RuboCop
|
|||
|
||||
return if offenses.empty?
|
||||
|
||||
add_offense(node, message: message_for(offenses))
|
||||
add_offense(node, message: message_for(*offenses))
|
||||
end
|
||||
|
||||
def autocorrect(node)
|
||||
lambda do |corrector|
|
||||
corrector.replace(node.source_range, replacement(node))
|
||||
end
|
||||
def offense_for_response_status(node)
|
||||
return unless response_status_eq?(node)
|
||||
|
||||
add_offense(node, message: message_for(MSG_RESPONSE_STATUS))
|
||||
end
|
||||
|
||||
private
|
||||
def replace_matcher(node)
|
||||
return unless have_http_status?(node)
|
||||
|
||||
code = extract_numeric_code(node)
|
||||
arg = code_to_symbol(code) || argument(node).source
|
||||
|
||||
format(REPLACEMENT, arg: arg)
|
||||
end
|
||||
|
||||
def replace_response_status(node)
|
||||
expectation, code = response_status_eq?(node)
|
||||
return unless code
|
||||
|
||||
arg = code_to_symbol(code)
|
||||
format(REPLACEMENT_RESPONSE_STATUS, expectation: expectation, arg: arg)
|
||||
end
|
||||
|
||||
def offense_for_name(node)
|
||||
return if method_name(node) == :have_gitlab_http_status
|
||||
|
@ -79,22 +122,15 @@ module RuboCop
|
|||
return unless code
|
||||
|
||||
symbol = code_to_symbol(code)
|
||||
return format(MSG_UNKNOWN, code: code) unless symbol
|
||||
return format(MSG_UNKNOWN_STATUS, code: code) unless symbol
|
||||
|
||||
format(MSG_STATUS, name: symbol, code: code)
|
||||
format(MSG_NUMERIC_STATUS, name: symbol, code: code)
|
||||
end
|
||||
|
||||
def message_for(offenses)
|
||||
def message_for(*offenses)
|
||||
(offenses + [MSG_DOCS_LINK]).join(' ')
|
||||
end
|
||||
|
||||
def replacement(node)
|
||||
code = extract_numeric_code(node)
|
||||
arg = code_to_symbol(code) || argument(node).source
|
||||
|
||||
format(REPLACEMENT, arg: arg)
|
||||
end
|
||||
|
||||
def code_to_symbol(code)
|
||||
CODE_TO_SYMBOL[code]&.inspect
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Admin::ApplicationSettingsController do
|
|||
it 'returns 404' do
|
||||
get :usage_data, format: :html
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -37,7 +37,7 @@ describe Admin::ApplicationSettingsController do
|
|||
get :usage_data, format: :html
|
||||
|
||||
expect(response.body).to start_with('<span')
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'returns JSON data' do
|
||||
|
@ -46,7 +46,7 @@ describe Admin::ApplicationSettingsController do
|
|||
body = json_response
|
||||
expect(body["version"]).to eq(Gitlab::VERSION)
|
||||
expect(body).to include('counts')
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ describe Admin::ClustersController do
|
|||
|
||||
cluster = Clusters::Cluster.instance_type.first
|
||||
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(response.location).to eq(admin_cluster_path(cluster))
|
||||
expect(cluster).to be_aws
|
||||
expect(cluster).to be_kubernetes
|
||||
|
@ -277,7 +277,7 @@ describe Admin::ClustersController do
|
|||
it 'does not create a cluster' do
|
||||
expect { post_create_aws }.not_to change { Clusters::Cluster.count }
|
||||
|
||||
expect(response.status).to eq(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
expect(response.content_type).to eq('application/json')
|
||||
expect(response.body).to include('is invalid')
|
||||
end
|
||||
|
@ -389,7 +389,7 @@ describe Admin::ClustersController do
|
|||
it 'creates an Aws::Role record' do
|
||||
expect { go }.to change { Aws::Role.count }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
|
||||
role = Aws::Role.last
|
||||
expect(role.user).to eq admin
|
||||
|
@ -403,7 +403,7 @@ describe Admin::ClustersController do
|
|||
it 'does not create a record' do
|
||||
expect { go }.not_to change { Aws::Role.count }
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ describe AutocompleteController do
|
|||
it 'gives an array of users' do
|
||||
get :users, params: { todo_filter: true }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to be_kind_of(Array)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ describe LfsRequest do
|
|||
it 'returns 403' do
|
||||
get :show, params: { id: project.id }
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -57,7 +57,7 @@ describe LfsRequest do
|
|||
it 'returns 404' do
|
||||
get :show, params: { id: 'does not exist' }
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -67,7 +67,7 @@ describe LfsRequest do
|
|||
it 'returns 404' do
|
||||
get :show, params: { id: project.id }
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -68,7 +68,7 @@ describe Dashboard::TodosController do
|
|||
create(:todo, project: project, author: author, user: user, target: merge_request_2)
|
||||
|
||||
expect { get :index }.not_to exceed_query_limit(control)
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ describe GraphqlController do
|
|||
|
||||
post :execute
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
expect(response).to render_template('errors/access_denied')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -388,7 +388,7 @@ describe Groups::ClustersController do
|
|||
|
||||
cluster = group.clusters.first
|
||||
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(response.location).to eq(group_cluster_path(group, cluster))
|
||||
expect(cluster).to be_aws
|
||||
expect(cluster).to be_kubernetes
|
||||
|
@ -404,7 +404,7 @@ describe Groups::ClustersController do
|
|||
it 'does not create a cluster' do
|
||||
expect { post_create_aws }.not_to change { Clusters::Cluster.count }
|
||||
|
||||
expect(response.status).to eq(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
expect(response.content_type).to eq('application/json')
|
||||
expect(response.body).to include('is invalid')
|
||||
end
|
||||
|
@ -451,7 +451,7 @@ describe Groups::ClustersController do
|
|||
it 'creates an Aws::Role record' do
|
||||
expect { go }.to change { Aws::Role.count }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
|
||||
role = Aws::Role.last
|
||||
expect(role.user).to eq user
|
||||
|
@ -465,7 +465,7 @@ describe Groups::ClustersController do
|
|||
it 'does not create a record' do
|
||||
expect { go }.not_to change { Aws::Role.count }
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ describe GroupsController do
|
|||
get :new, params: { parent_id: group.id }
|
||||
|
||||
expect(response).not_to render_template(:new)
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -373,7 +373,7 @@ describe GroupsController do
|
|||
|
||||
delete :destroy, params: { id: group.to_param }
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe MetricsController, :request_store do
|
|||
it 'returns prometheus metrics' do
|
||||
get :index
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.body).to match(/^prometheus_counter 1$/)
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,7 @@ describe MetricsController, :request_store do
|
|||
it 'returns proper response' do
|
||||
get :index
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.body).to eq("# Metrics are disabled, see: http://test.host/help/administration/monitoring/prometheus/gitlab_metrics#gitlab-prometheus-metrics\n")
|
||||
end
|
||||
end
|
||||
|
@ -75,7 +75,7 @@ describe MetricsController, :request_store do
|
|||
it 'returns the expected error response' do
|
||||
get :index
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -50,7 +50,7 @@ describe NotificationSettingsController do
|
|||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(notification_setting.level).to eq("participating")
|
||||
expect(notification_setting.user_id).to eq(user.id)
|
||||
expect(notification_setting.source_id).to eq(project.id)
|
||||
|
@ -65,7 +65,7 @@ describe NotificationSettingsController do
|
|||
notification_setting: { level: :custom }.merge(custom_events)
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(notification_setting.level).to eq("custom")
|
||||
|
||||
custom_events.each do |event, value|
|
||||
|
@ -85,7 +85,7 @@ describe NotificationSettingsController do
|
|||
notification_setting: { level: :watch }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(notification_setting.level).to eq("watch")
|
||||
expect(notification_setting.user_id).to eq(user.id)
|
||||
expect(notification_setting.source_id).to eq(group.id)
|
||||
|
@ -100,7 +100,7 @@ describe NotificationSettingsController do
|
|||
notification_setting: { level: :custom }.merge(custom_events)
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(notification_setting.level).to eq("custom")
|
||||
|
||||
custom_events.each do |event, value|
|
||||
|
@ -157,7 +157,7 @@ describe NotificationSettingsController do
|
|||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
context 'and setting custom notification setting' do
|
||||
|
@ -176,7 +176,7 @@ describe NotificationSettingsController do
|
|||
notification_setting: { level: :participating, events: custom_events }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe Oauth::TokenInfoController do
|
|||
it 'responds with a 401' do
|
||||
get :show
|
||||
|
||||
expect(response.status).to eq 401
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
expect(JSON.parse(response.body)).to include('error' => 'invalid_request')
|
||||
end
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ RSpec.describe Oauth::TokenInfoController do
|
|||
it 'responds with the token info' do
|
||||
get :show, params: { access_token: access_token.token }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(JSON.parse(response.body)).to eq(
|
||||
'scope' => %w[api],
|
||||
'scopes' => %w[api],
|
||||
|
@ -39,7 +39,7 @@ RSpec.describe Oauth::TokenInfoController do
|
|||
it 'responds with a 401' do
|
||||
get :show, params: { access_token: 'unknown_token' }
|
||||
|
||||
expect(response.status).to eq 401
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
expect(JSON.parse(response.body)).to include('error' => 'invalid_request')
|
||||
end
|
||||
end
|
||||
|
@ -52,7 +52,7 @@ RSpec.describe Oauth::TokenInfoController do
|
|||
it 'responds with a 401' do
|
||||
get :show, params: { access_token: access_token.token }
|
||||
|
||||
expect(response.status).to eq 401
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
expect(JSON.parse(response.body)).to include('error' => 'invalid_request')
|
||||
end
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ RSpec.describe Oauth::TokenInfoController do
|
|||
it 'responds with a 401' do
|
||||
get :show, params: { access_token: access_token.token }
|
||||
|
||||
expect(response.status).to eq 401
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
expect(JSON.parse(response.body)).to include('error' => 'invalid_request')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -234,7 +234,7 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode:
|
|||
post 'auth0'
|
||||
|
||||
expect(request.env['warden']).not_to be_authenticated
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(controller).to set_flash[:alert].to('Wrong extern UID provided. Make sure Auth0 is configured correctly.')
|
||||
end
|
||||
end
|
||||
|
@ -249,7 +249,7 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode:
|
|||
post 'salesforce'
|
||||
|
||||
expect(request.env['warden']).not_to be_authenticated
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(controller).to set_flash[:alert].to('Email not verified. Please verify your email in Salesforce.')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ describe ProfilesController, :request_store do
|
|||
params: { user: { password: 'hello12345', password_confirmation: 'hello12345' } }
|
||||
end.not_to change { user.reload.encrypted_password }
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
user.reload
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(user.unconfirmed_email).to eq('john@gmail.com')
|
||||
end
|
||||
|
||||
|
@ -41,7 +41,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
user.reload
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(user.unconfirmed_email).to eq nil
|
||||
end
|
||||
|
||||
|
@ -58,7 +58,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
ldap_user.reload
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(ldap_user.unconfirmed_email).not_to eq('john@gmail.com')
|
||||
end
|
||||
|
||||
|
@ -75,7 +75,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
ldap_user.reload
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(ldap_user.unconfirmed_email).not_to eq('john@gmail.com')
|
||||
expect(ldap_user.name).not_to eq('John')
|
||||
expect(ldap_user.location).to eq('City, Country')
|
||||
|
@ -114,7 +114,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
user.reload
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(user.username).to eq(new_username)
|
||||
end
|
||||
|
||||
|
@ -127,7 +127,7 @@ describe ProfilesController, :request_store do
|
|||
},
|
||||
format: :json
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['message']).to eq(s_('Profiles|Username successfully changed'))
|
||||
end
|
||||
|
||||
|
@ -140,7 +140,7 @@ describe ProfilesController, :request_store do
|
|||
},
|
||||
format: :json
|
||||
|
||||
expect(response.status).to eq(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
expect(json_response['message']).to match(/Username change failed/)
|
||||
end
|
||||
|
||||
|
@ -162,7 +162,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
user.reload
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_username}/#{project.path}.git")).to be_truthy
|
||||
end
|
||||
end
|
||||
|
@ -180,7 +180,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
user.reload
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be_truthy
|
||||
expect(before_disk_path).to eq(project.disk_path)
|
||||
end
|
||||
|
|
|
@ -387,7 +387,7 @@ describe Projects::ClustersController do
|
|||
|
||||
cluster = project.clusters.first
|
||||
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(response.location).to eq(project_cluster_path(project, cluster))
|
||||
expect(cluster).to be_aws
|
||||
expect(cluster).to be_kubernetes
|
||||
|
@ -403,7 +403,7 @@ describe Projects::ClustersController do
|
|||
it 'does not create a cluster' do
|
||||
expect { post_create_aws }.not_to change { Clusters::Cluster.count }
|
||||
|
||||
expect(response.status).to eq(422)
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
expect(response.content_type).to eq('application/json')
|
||||
expect(response.body).to include('is invalid')
|
||||
end
|
||||
|
@ -450,7 +450,7 @@ describe Projects::ClustersController do
|
|||
it 'creates an Aws::Role record' do
|
||||
expect { go }.to change { Aws::Role.count }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
|
||||
role = Aws::Role.last
|
||||
expect(role.user).to eq user
|
||||
|
@ -464,7 +464,7 @@ describe Projects::ClustersController do
|
|||
it 'does not create a record' do
|
||||
expect { go }.not_to change { Aws::Role.count }
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(response).to have_gitlab_http_status(:unprocessable_entity)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ describe Projects::GroupLinksController do
|
|||
include_context 'link project to group'
|
||||
|
||||
it 'renders 404' do
|
||||
expect(response.status).to eq 404
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'does not share project with that group' do
|
||||
|
@ -73,7 +73,7 @@ describe Projects::GroupLinksController do
|
|||
include_context 'link project to group'
|
||||
|
||||
it 'renders 404' do
|
||||
expect(response.status).to eq 404
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'does not share project with that group' do
|
||||
|
|
|
@ -1557,7 +1557,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
post_rebase
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1572,7 +1572,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
post_rebase
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1583,7 +1583,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
post_rebase
|
||||
|
||||
expect(response.status).to eq(409)
|
||||
expect(response).to have_gitlab_http_status(:conflict)
|
||||
expect(json_response['merge_error']).to eq('Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later.')
|
||||
end
|
||||
end
|
||||
|
@ -1605,7 +1605,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
post_rebase
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1621,7 +1621,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
post_rebase
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1639,7 +1639,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'returns 200' do
|
||||
get :discussions, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
context 'highlight preloading' do
|
||||
|
|
|
@ -923,10 +923,18 @@ describe Projects::PipelinesController do
|
|||
end
|
||||
|
||||
context 'ref provided' do
|
||||
render_views
|
||||
|
||||
before do
|
||||
create(:ci_pipeline, ref: 'master', project: project)
|
||||
end
|
||||
|
||||
it 'shows a 404 if no pipeline exists' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: 'non-existence' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'shows the latest pipeline for the provided ref' do
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project, latest: true, ref: branch_secondary.name }
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ describe Projects::ProjectMembersController do
|
|||
end
|
||||
|
||||
it 'responds with not found' do
|
||||
expect(response.status).to eq 404
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -103,7 +103,7 @@ describe Projects::ProtectedBranchesController do
|
|||
it "prevents deletion of the protected branch rule" do
|
||||
delete(:destroy, params: base_params)
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ describe Projects::ReleasesController do
|
|||
it 'renders a 200' do
|
||||
get_index
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
context 'when the project is private' do
|
||||
|
@ -54,7 +54,7 @@ describe Projects::ReleasesController do
|
|||
|
||||
get_index
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -66,7 +66,7 @@ describe Projects::ReleasesController do
|
|||
|
||||
get_index
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ describe Projects::TemplatesController do
|
|||
it do
|
||||
get(:show, params: { namespace_id: project.namespace, template_type: 'issue', key: 'issue_template', project_id: project }, format: :json)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['name']).to eq('issue_template')
|
||||
expect(json_response['content']).to eq('issue content')
|
||||
end
|
||||
|
@ -25,7 +25,7 @@ describe Projects::TemplatesController do
|
|||
it do
|
||||
get(:show, params: { namespace_id: project.namespace, template_type: 'merge_request', key: 'merge_request_template', project_id: project }, format: :json)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['name']).to eq('merge_request_template')
|
||||
expect(json_response['content']).to eq('merge request content')
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ describe Projects::TemplatesController do
|
|||
it do
|
||||
get(:show, params: { namespace_id: project.namespace, template_type: 'issue', key: 'issue_template', project_id: project }, format: :json)
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ describe Projects::TemplatesController do
|
|||
it do
|
||||
get(:show, params: { namespace_id: project.namespace, template_type: 'merge_request', key: 'merge_request_template', project_id: project }, format: :json)
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -57,13 +57,13 @@ describe Projects::TemplatesController do
|
|||
it 'renders 404 when the format type is invalid' do
|
||||
get(:show, params: { namespace_id: project.namespace, template_type: 'issue', key: 'issue_template', project_id: project }, format: :html)
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'renders 404 when the key is unknown' do
|
||||
get(:show, params: { namespace_id: project.namespace, template_type: 'issue', key: 'unknown_template', project_id: project }, format: :json)
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ describe ProjectsController do
|
|||
|
||||
get :show, params: { namespace_id: project.namespace, id: project }
|
||||
|
||||
expect(response.status).to eq 404
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ describe RegistrationsController do
|
|||
|
||||
def expect_failure(message)
|
||||
expect(flash[:alert]).to eq(message)
|
||||
expect(response.status).to eq(303)
|
||||
expect(response).to have_gitlab_http_status(:see_other)
|
||||
expect(response).to redirect_to profile_account_path
|
||||
end
|
||||
|
||||
|
@ -348,7 +348,7 @@ describe RegistrationsController do
|
|||
|
||||
def expect_success
|
||||
expect(flash[:notice]).to eq s_('Profiles|Account scheduled for removal.')
|
||||
expect(response.status).to eq(303)
|
||||
expect(response).to have_gitlab_http_status(:see_other)
|
||||
expect(response).to redirect_to new_user_session_path
|
||||
end
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ describe Repositories::GitHttpController do
|
|||
it 'returns 403' do
|
||||
head :info_refs, params: params
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe Repositories::GitHttpController do
|
|||
|
||||
get :info_refs, params: params
|
||||
|
||||
expect(response.status).to eq(401)
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
end
|
||||
|
||||
context 'with authorized user' do
|
||||
|
@ -50,7 +50,7 @@ describe Repositories::GitHttpController do
|
|||
it 'returns 200' do
|
||||
get :info_refs, params: params
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'updates the user activity' do
|
||||
|
@ -72,7 +72,7 @@ describe Repositories::GitHttpController do
|
|||
|
||||
get :info_refs, params: params
|
||||
|
||||
expect(response.status).to eq(503)
|
||||
expect(response).to have_gitlab_http_status(:service_unavailable)
|
||||
end
|
||||
|
||||
it 'returns 503 with timeout error' do
|
||||
|
@ -80,7 +80,7 @@ describe Repositories::GitHttpController do
|
|||
|
||||
get :info_refs, params: params
|
||||
|
||||
expect(response.status).to eq(503)
|
||||
expect(response).to have_gitlab_http_status(:service_unavailable)
|
||||
expect(response.body).to eq 'Gitlab::GitAccess::TimeoutError'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -76,7 +76,7 @@ describe SentNotificationsController do
|
|||
end
|
||||
|
||||
it 'renders unsubscribe page' do
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template :unsubscribe
|
||||
end
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ describe SessionsController do
|
|||
it 'returns status 403' do
|
||||
post(:create, params: { user: user_params })
|
||||
|
||||
expect(response.status).to eq 403
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -720,7 +720,7 @@ describe SnippetsController do
|
|||
post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" })
|
||||
end.to change { personal_snippet.award_emoji.count }.from(0).to(1)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it "removes the already awarded emoji" do
|
||||
|
@ -730,7 +730,7 @@ describe SnippetsController do
|
|||
post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" })
|
||||
end.to change { personal_snippet.award_emoji.count }.from(1).to(0)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -341,7 +341,7 @@ describe('Panel Type component', () => {
|
|||
});
|
||||
|
||||
it('adds a copy button to the dropdown', () => {
|
||||
expect(findCopyLink().text()).toContain('Generate link to chart');
|
||||
expect(findCopyLink().text()).toContain('Copy link to chart');
|
||||
});
|
||||
|
||||
it('opens a toast on click', () => {
|
||||
|
|
|
@ -26,7 +26,7 @@ describe API::APIGuard::AdminModeMiddleware, :do_not_mock_admin_mode, :request_s
|
|||
|
||||
get api('/willfail')
|
||||
|
||||
expect(response.status).to eq(500)
|
||||
expect(response).to have_gitlab_http_status(:internal_server_error)
|
||||
expect(response.body).to include('oh noes!')
|
||||
|
||||
expect(Gitlab::Auth::CurrentUserMode.bypass_session_admin_id).to be_nil
|
||||
|
|
|
@ -17,7 +17,7 @@ describe API::Avatar do
|
|||
it 'returns the avatar url' do
|
||||
get api('/avatar'), params: { email: 'public@example.com' }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['avatar_url']).to eql("#{::Settings.gitlab.base_url}#{user.avatar.local_url}")
|
||||
end
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ describe API::Avatar do
|
|||
it 'returns the avatar url from Gravatar' do
|
||||
get api('/avatar'), params: { email: 'private@example.com' }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['avatar_url']).to eq('https://gravatar')
|
||||
end
|
||||
end
|
||||
|
@ -57,7 +57,7 @@ describe API::Avatar do
|
|||
it 'returns the avatar url from Gravatar' do
|
||||
get api('/avatar'), params: { email: 'public@example.com' }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['avatar_url']).to eq('https://gravatar')
|
||||
end
|
||||
end
|
||||
|
@ -74,7 +74,7 @@ describe API::Avatar do
|
|||
it 'returns the avatar url from Gravatar' do
|
||||
get api('/avatar'), params: { email: 'private@example.com' }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['avatar_url']).to eq('https://gravatar')
|
||||
end
|
||||
end
|
||||
|
@ -92,7 +92,7 @@ describe API::Avatar do
|
|||
it 'returns the avatar url' do
|
||||
get api('/avatar', user), params: { email: 'public@example.com' }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['avatar_url']).to eql("#{::Settings.gitlab.base_url}#{user.avatar.local_url}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -96,7 +96,7 @@ describe API::CommitStatuses do
|
|||
end
|
||||
|
||||
it 'returns empty array' do
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response).to be_empty
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ describe API::ContainerRegistryEvent do
|
|||
|
||||
expect(event).to have_received(:handle!).once
|
||||
expect(event).to have_received(:track!).once
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
it 'returns 401 error status when token is invalid' do
|
||||
|
@ -35,7 +35,7 @@ describe API::ContainerRegistryEvent do
|
|||
params: { events: events }.to_json,
|
||||
headers: registry_headers.merge('Authorization' => 'invalid_token')
|
||||
|
||||
expect(response.status).to eq 401
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ describe API::DeployKeys do
|
|||
it 'returns authentication error' do
|
||||
get api('/deploy_keys')
|
||||
|
||||
expect(response.status).to eq(401)
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ describe API::DeployKeys do
|
|||
it 'returns a 403 error' do
|
||||
get api('/deploy_keys', user)
|
||||
|
||||
expect(response.status).to eq(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe API::DeployKeys do
|
|||
it 'returns all deploy keys' do
|
||||
get api('/deploy_keys', admin)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.first['id']).to eq(deploy_keys_project.deploy_key.id)
|
||||
|
|
|
@ -98,7 +98,7 @@ describe API::GroupLabels do
|
|||
color: '#FFAABB'
|
||||
}
|
||||
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(json_response['name']).to eq('Foo & Bar')
|
||||
expect(json_response['color']).to eq('#FFAABB')
|
||||
expect(json_response['description']).to be_nil
|
||||
|
|
|
@ -217,7 +217,7 @@ describe API::Internal::Base do
|
|||
it "finds the key" do
|
||||
get(api('/internal/authorized_keys'), params: { fingerprint: key.fingerprint, secret_token: secret_token })
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response["key"]).to eq(key.key)
|
||||
end
|
||||
end
|
||||
|
@ -226,7 +226,7 @@ describe API::Internal::Base do
|
|||
it "returns 404" do
|
||||
get(api('/internal/authorized_keys'), params: { fingerprint: "no:t-:va:li:d0", secret_token: secret_token })
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -234,7 +234,7 @@ describe API::Internal::Base do
|
|||
it "returns 404" do
|
||||
get(api('/internal/authorized_keys'), params: { fingerprint: "#{key.fingerprint[0..5]}%", secret_token: secret_token })
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -242,20 +242,20 @@ describe API::Internal::Base do
|
|||
it "finds the key" do
|
||||
get(api('/internal/authorized_keys'), params: { key: key.key.split[1], secret_token: secret_token })
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response["key"]).to eq(key.key)
|
||||
end
|
||||
|
||||
it "returns 404 with a partial key" do
|
||||
get(api('/internal/authorized_keys'), params: { key: key.key.split[1][0...-3], secret_token: secret_token })
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it "returns 404 with an not valid base64 string" do
|
||||
get(api('/internal/authorized_keys'), params: { key: "whatever!", secret_token: secret_token })
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -812,7 +812,7 @@ describe API::Internal::Base do
|
|||
project.add_developer(user)
|
||||
push(key, project, 'web')
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['status']).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
|
@ -244,7 +244,7 @@ describe API::Issues do
|
|||
title: 'new issue',
|
||||
labels: 'label, label?, label&foo, ?, &'
|
||||
}
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(json_response['labels']).to include 'label'
|
||||
expect(json_response['labels']).to include 'label?'
|
||||
expect(json_response['labels']).to include 'label&foo'
|
||||
|
@ -258,7 +258,7 @@ describe API::Issues do
|
|||
title: 'new issue',
|
||||
labels: ['label', 'label?', 'label&foo, ?, &']
|
||||
}
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(json_response['labels']).to include 'label'
|
||||
expect(json_response['labels']).to include 'label?'
|
||||
expect(json_response['labels']).to include 'label&foo'
|
||||
|
|
|
@ -43,7 +43,7 @@ describe API::Labels do
|
|||
it "returns 200 if a priority is added (#{route_type} route)" do
|
||||
put_labels_api(route_type, user, spec_params, priority: 3)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['name']).to eq(label1.name)
|
||||
expect(json_response['priority']).to eq(3)
|
||||
end
|
||||
|
@ -103,7 +103,7 @@ describe API::Labels do
|
|||
it "returns 200 if priority is changed (#{route_type} route)" do
|
||||
put_labels_api(route_type, user, spec_params, priority: 10)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['id']).to eq(expected_response_label_id)
|
||||
expect(json_response['priority']).to eq(10)
|
||||
end
|
||||
|
@ -124,7 +124,7 @@ describe API::Labels do
|
|||
put api("/projects/#{project.id}/labels", user),
|
||||
params: request_params
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['id']).to eq(expected_response_label_id)
|
||||
expect(json_response['priority']).to be_nil
|
||||
end
|
||||
|
@ -144,7 +144,7 @@ describe API::Labels do
|
|||
put api("/projects/#{project.id}/labels/#{label_id}", user),
|
||||
params: request_params
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['id']).to eq(expected_response_label_id)
|
||||
expect(json_response['priority']).to be_nil
|
||||
end
|
||||
|
@ -321,7 +321,7 @@ describe API::Labels do
|
|||
color: '#FFAABB'
|
||||
}
|
||||
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(json_response['name']).to eq('Foo & Bar')
|
||||
expect(json_response['color']).to eq('#FFAABB')
|
||||
expect(json_response['description']).to be_nil
|
||||
|
@ -336,7 +336,7 @@ describe API::Labels do
|
|||
priority: 3
|
||||
}
|
||||
|
||||
expect(response.status).to eq(201)
|
||||
expect(response).to have_gitlab_http_status(:created)
|
||||
expect(json_response['name']).to eq('Foo & Bar')
|
||||
expect(json_response['color']).to eq('#FFAABB')
|
||||
expect(json_response['description']).to be_nil
|
||||
|
|
|
@ -18,7 +18,7 @@ describe API::MergeRequestDiffs, 'MergeRequestDiffs' do
|
|||
get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/versions", user)
|
||||
merge_request_diff = merge_request.merge_request_diffs.last
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.size).to eq(merge_request.merge_request_diffs.size)
|
||||
|
@ -43,7 +43,7 @@ describe API::MergeRequestDiffs, 'MergeRequestDiffs' do
|
|||
it 'returns a 200 for a valid merge request' do
|
||||
get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/versions/#{merge_request_diff.id}", user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['id']).to eq(merge_request_diff.id)
|
||||
expect(json_response['head_commit_sha']).to eq(merge_request_diff.head_commit_sha)
|
||||
expect(json_response['diffs'].size).to eq(merge_request_diff.diffs.size)
|
||||
|
|
|
@ -2164,7 +2164,7 @@ describe API::MergeRequests do
|
|||
labels: 'label, label?, label&foo, ?, &'
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['labels']).to include 'label'
|
||||
expect(json_response['labels']).to include 'label?'
|
||||
expect(json_response['labels']).to include 'label&foo'
|
||||
|
@ -2179,7 +2179,7 @@ describe API::MergeRequests do
|
|||
labels: ['label', 'label?', 'label&foo, ?, &', '1, 2', 3, 4]
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['labels']).to include 'label'
|
||||
expect(json_response['labels']).to include 'label?'
|
||||
expect(json_response['labels']).to include 'label&foo'
|
||||
|
@ -2198,7 +2198,7 @@ describe API::MergeRequests do
|
|||
labels: ''
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['labels']).to eq []
|
||||
end
|
||||
|
||||
|
@ -2210,7 +2210,7 @@ describe API::MergeRequests do
|
|||
}.to_json,
|
||||
headers: { 'Content-Type' => 'application/json' }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['labels']).to eq []
|
||||
end
|
||||
|
||||
|
@ -2221,7 +2221,7 @@ describe API::MergeRequests do
|
|||
labels: []
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['labels']).to eq []
|
||||
end
|
||||
|
||||
|
@ -2232,7 +2232,7 @@ describe API::MergeRequests do
|
|||
labels: ['']
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['labels']).to eq []
|
||||
end
|
||||
|
||||
|
@ -2243,7 +2243,7 @@ describe API::MergeRequests do
|
|||
labels: ['', '', '']
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['labels']).to eq []
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ describe API::Notes do
|
|||
end
|
||||
|
||||
it 'responds with resource not found error' do
|
||||
expect(response.status).to eq 404
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'does not create new note' do
|
||||
|
|
|
@ -190,7 +190,7 @@ describe API::Projects do
|
|||
it 'includes the project labels as the tag_list' do
|
||||
get api('/projects', user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.first.keys).to include('tag_list')
|
||||
|
@ -199,7 +199,7 @@ describe API::Projects do
|
|||
it 'includes open_issues_count' do
|
||||
get api('/projects', user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.first.keys).to include('open_issues_count')
|
||||
|
@ -220,7 +220,7 @@ describe API::Projects do
|
|||
|
||||
get api('/projects', user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.find { |hash| hash['id'] == project.id }.keys).not_to include('open_issues_count')
|
||||
|
@ -232,7 +232,7 @@ describe API::Projects do
|
|||
|
||||
get api('/projects?with_issues_enabled=true', user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.map { |p| p['id'] }).not_to include(project.id)
|
||||
|
@ -281,7 +281,7 @@ describe API::Projects do
|
|||
it 'includes open_issues_count' do
|
||||
get api('/projects', user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.first.keys).to include('open_issues_count')
|
||||
|
@ -293,7 +293,7 @@ describe API::Projects do
|
|||
|
||||
get api('/projects', user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.find { |hash| hash['id'] == project.id }.keys).not_to include('open_issues_count')
|
||||
|
@ -568,7 +568,7 @@ describe API::Projects do
|
|||
|
||||
get api('/projects?with_issues_enabled=true', user2)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.map { |p| p['id'] }).not_to include(project.id)
|
||||
|
|
|
@ -48,7 +48,7 @@ describe API::Repositories do
|
|||
it 'returns recursive project paths tree' do
|
||||
get api("#{route}?recursive=1", current_user)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to be_an Array
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response[4]['name']).to eq('html')
|
||||
|
|
|
@ -1102,7 +1102,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'returns that operation conflicts' do
|
||||
expect(response.status).to eq(409)
|
||||
expect(response).to have_gitlab_http_status(:conflict)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1185,7 +1185,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
|
||||
context 'when request is valid' do
|
||||
it 'gets correct response' do
|
||||
expect(response.status).to eq 202
|
||||
expect(response).to have_gitlab_http_status(:accepted)
|
||||
expect(job.reload.trace.raw).to eq 'BUILD TRACE appended'
|
||||
expect(response.header).to have_key 'Range'
|
||||
expect(response.header).to have_key 'Job-Status'
|
||||
|
@ -1242,7 +1242,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'responds with forbidden' do
|
||||
expect(response.status).to eq(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'has valid trace' do
|
||||
expect(response.status).to eq(202)
|
||||
expect(response).to have_gitlab_http_status(:accepted)
|
||||
expect(job.reload.trace.raw).to eq 'BUILD TRACE appended appended'
|
||||
end
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'returns Forbidden ' do
|
||||
expect(response.status).to eq(403)
|
||||
expect(response).to have_gitlab_http_status(:forbidden)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1287,7 +1287,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'returns an error' do
|
||||
expect(response.status).to eq(416)
|
||||
expect(response).to have_gitlab_http_status(:range_not_satisfiable)
|
||||
expect(response.header['Range']).to eq('0-0')
|
||||
end
|
||||
end
|
||||
|
@ -1298,7 +1298,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'succeeds with updating trace' do
|
||||
expect(response.status).to eq(202)
|
||||
expect(response).to have_gitlab_http_status(:accepted)
|
||||
expect(job.reload.trace.raw).to eq 'BUILD TRACE appended appended hello'
|
||||
end
|
||||
end
|
||||
|
@ -1313,7 +1313,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'returns that operation conflicts' do
|
||||
expect(response.status).to eq(409)
|
||||
expect(response).to have_gitlab_http_status(:conflict)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1336,7 +1336,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
it 'returns X-GitLab-Trace-Update-Interval as 3' do
|
||||
patch_the_trace
|
||||
|
||||
expect(response.status).to eq 202
|
||||
expect(response).to have_gitlab_http_status(:accepted)
|
||||
expect(response.header['X-GitLab-Trace-Update-Interval']).to eq('3')
|
||||
end
|
||||
end
|
||||
|
@ -1345,7 +1345,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
it 'returns X-GitLab-Trace-Update-Interval as 30' do
|
||||
patch_the_trace
|
||||
|
||||
expect(response.status).to eq 202
|
||||
expect(response).to have_gitlab_http_status(:accepted)
|
||||
expect(response.header['X-GitLab-Trace-Update-Interval']).to eq('30')
|
||||
end
|
||||
end
|
||||
|
@ -1358,7 +1358,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
it 'does not return X-GitLab-Trace-Update-Interval header' do
|
||||
patch_the_trace
|
||||
|
||||
expect(response.status).to eq 202
|
||||
expect(response).to have_gitlab_http_status(:accepted)
|
||||
expect(response.header).not_to have_key 'X-GitLab-Trace-Update-Interval'
|
||||
end
|
||||
end
|
||||
|
@ -1370,7 +1370,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
it 'gets correct response' do
|
||||
expect(response.status).to eq 202
|
||||
expect(response).to have_gitlab_http_status(:accepted)
|
||||
expect(job.reload.trace.raw).to eq 'BUILD TRACE appended'
|
||||
expect(response.header).to have_key 'Range'
|
||||
expect(response.header).to have_key 'Job-Status'
|
||||
|
@ -1381,7 +1381,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
let(:headers_with_range) { headers.merge({ 'Content-Range' => '15-20/6' }) }
|
||||
|
||||
it 'gets 416 error response with range headers' do
|
||||
expect(response.status).to eq 416
|
||||
expect(response).to have_gitlab_http_status(:range_not_satisfiable)
|
||||
expect(response.header).to have_key 'Range'
|
||||
expect(response.header['Range']).to eq '0-11'
|
||||
end
|
||||
|
@ -1391,7 +1391,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
let(:headers_with_range) { headers.merge({ 'Content-Range' => '8-20/13' }) }
|
||||
|
||||
it 'gets 416 error response with range headers' do
|
||||
expect(response.status).to eq 416
|
||||
expect(response).to have_gitlab_http_status(:range_not_satisfiable)
|
||||
expect(response.header).to have_key 'Range'
|
||||
expect(response.header['Range']).to eq '0-11'
|
||||
end
|
||||
|
@ -1400,13 +1400,13 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
|
|||
context 'when Content-Range header is missing' do
|
||||
let(:headers_with_range) { headers }
|
||||
|
||||
it { expect(response.status).to eq 400 }
|
||||
it { expect(response).to have_gitlab_http_status(:bad_request) }
|
||||
end
|
||||
|
||||
context 'when job has been errased' do
|
||||
let(:job) { create(:ci_build, runner_id: runner.id, erased_at: Time.now) }
|
||||
|
||||
it { expect(response.status).to eq 403 }
|
||||
it { expect(response).to have_gitlab_http_status(:forbidden) }
|
||||
end
|
||||
|
||||
def patch_the_trace(content = ' appended', request_headers = nil)
|
||||
|
|
|
@ -81,15 +81,15 @@ describe API::Services do
|
|||
end
|
||||
|
||||
if required_attributes.empty?
|
||||
expected_code = 200
|
||||
expected_code = :ok
|
||||
else
|
||||
attrs.delete(required_attributes.sample)
|
||||
expected_code = 400
|
||||
expected_code = :bad_request
|
||||
end
|
||||
|
||||
put api("/projects/#{project.id}/services/#{dashed_service}", user), params: attrs
|
||||
|
||||
expect(response.status).to eq(expected_code)
|
||||
expect(response).to have_gitlab_http_status(expected_code)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ describe API::UserCounts do
|
|||
it 'returns authentication error' do
|
||||
get api('/user_counts')
|
||||
|
||||
expect(response.status).to eq(401)
|
||||
expect(response).to have_gitlab_http_status(:unauthorized)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ describe API::UserCounts do
|
|||
it 'returns open counts for current user' do
|
||||
get api('/user_counts', user)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to be_a Hash
|
||||
expect(json_response['merge_requests']).to eq(1)
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ describe API::UserCounts do
|
|||
|
||||
get api('/user_counts', user)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response).to be_a Hash
|
||||
expect(json_response['merge_requests']).to eq(2)
|
||||
end
|
||||
|
|
|
@ -832,7 +832,7 @@ describe API::Users, :do_not_mock_admin_mode do
|
|||
it "updates external status" do
|
||||
put api("/users/#{user.id}", admin), params: { external: true }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response['external']).to eq(true)
|
||||
expect(user.reload.external?).to be_truthy
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ describe HealthController do
|
|||
it 'responds with resource not found' do
|
||||
subject
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ describe HealthController do
|
|||
it 'responds with health checks data' do
|
||||
subject
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.body).to eq('GitLab OK')
|
||||
end
|
||||
end
|
||||
|
@ -95,7 +95,7 @@ describe HealthController do
|
|||
expect(json_response['master_check']).to contain_exactly(
|
||||
{ 'status' => 'failed', 'message' => 'unexpected Master check result: false' })
|
||||
|
||||
expect(response.status).to eq(503)
|
||||
expect(response).to have_gitlab_http_status(:service_unavailable)
|
||||
expect(response.headers['X-GitLab-Custom-Error']).to eq(1)
|
||||
end
|
||||
end
|
||||
|
@ -126,7 +126,7 @@ describe HealthController do
|
|||
expect(json_response['redis_check']).to contain_exactly(
|
||||
{ 'status' => 'failed', 'message' => 'check error' })
|
||||
|
||||
expect(response.status).to eq(503)
|
||||
expect(response).to have_gitlab_http_status(:service_unavailable)
|
||||
expect(response.headers['X-GitLab-Custom-Error']).to eq(1)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ describe 'merge requests discussions' do
|
|||
it 'returns 200' do
|
||||
send_request
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
# https://docs.gitlab.com/ee/development/query_recorder.html#use-request-specs-instead-of-controller-specs
|
||||
|
|
|
@ -59,6 +59,8 @@ describe RuboCop::Cop::RSpec::HaveGitlabHttpStatus do
|
|||
'have_http_status(var)' | 'have_gitlab_http_status(var)'
|
||||
'have_http_status(:success)' | 'have_gitlab_http_status(:success)'
|
||||
'have_http_status(:invalid)' | 'have_gitlab_http_status(:invalid)'
|
||||
'expect(response.status).to eq(200)' | 'expect(response).to have_gitlab_http_status(:ok)'
|
||||
'expect(response.status).not_to eq(200)' | 'expect(response).not_to have_gitlab_http_status(:ok)'
|
||||
end
|
||||
|
||||
with_them do
|
||||
|
@ -90,7 +92,23 @@ describe RuboCop::Cop::RSpec::HaveGitlabHttpStatus do
|
|||
'have_http_status(200, arg)',
|
||||
'have_gitlab_http_status',
|
||||
'have_gitlab_http_status { }',
|
||||
'have_gitlab_http_status(200, arg)'
|
||||
'have_gitlab_http_status(200, arg)',
|
||||
'expect(response.status).to eq(arg)',
|
||||
'expect(response.status).to eq(:ok)',
|
||||
'expect(response.status).to some_matcher(200)',
|
||||
'expect(response.status).not_to eq(arg)',
|
||||
'expect(response.status).not_to eq(:ok)',
|
||||
'expect(response.status).not_to some_matcher(200)',
|
||||
'expect(result.status).to eq(200)',
|
||||
'expect(result.status).not_to eq(200)',
|
||||
<<~CODE,
|
||||
response = some_assignment
|
||||
expect(response.status).to eq(200)
|
||||
CODE
|
||||
<<~CODE
|
||||
response = some_assignment
|
||||
expect(response.status).not_to eq(200)
|
||||
CODE
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ RSpec.shared_examples 'authenticates sessionless user' do |path, format, params|
|
|||
|
||||
get path, params: default_params.merge(feed_token: 'token')
|
||||
|
||||
expect(response.status).not_to eq 200
|
||||
expect(response).not_to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -103,6 +103,6 @@ RSpec.shared_examples 'authenticates sessionless user' do |path, format, params|
|
|||
|
||||
get path, params: default_params.merge(private_token: 'token')
|
||||
|
||||
expect(response.status).not_to eq(200)
|
||||
expect(response).not_to have_gitlab_http_status(:ok)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ RSpec.shared_examples 'update invalid issuable' do |klass|
|
|||
|
||||
put :update, params: params
|
||||
|
||||
expect(response.status).to eq(409)
|
||||
expect(response).to have_gitlab_http_status(:conflict)
|
||||
expect(json_response).to have_key('errors')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ RSpec.shared_examples 'handle uploads' do
|
|||
context 'when a user is not authorized to upload a file' do
|
||||
it 'returns 404 status' do
|
||||
post :create, params: params.merge(file: jpg), format: :json
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -319,7 +319,7 @@ RSpec.shared_examples 'handle uploads authorize' do
|
|||
it 'returns 404 status' do
|
||||
post_authorize
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ RSpec.shared_examples 'group and project milestones' do |route_definition|
|
|||
it 'returns a milestone by iids array' do
|
||||
get api("#{route}?iids=#{closed_milestone.iid}", user)
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to include_pagination_headers
|
||||
expect(json_response.size).to eq(1)
|
||||
expect(json_response.size).to eq(1)
|
||||
|
|
|
@ -25,7 +25,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
|
|||
|
||||
get api("/#{parent_type}/#{parent_id}/#{noteable_type}/#{noteable[id_name]}/notes", user)
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
||||
context '2 notes with equal created_at' do
|
||||
|
|
|
@ -54,6 +54,17 @@ describe Namespaces::ScheduleAggregationWorker, '#perform', :clean_gitlab_redis_
|
|||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'an idempotent worker' do
|
||||
let(:job_args) { [group.id] }
|
||||
|
||||
it 'creates a single aggregation schedule' do
|
||||
expect { worker.perform(*job_args) }
|
||||
.to change { Namespace::AggregationSchedule.count }.by(1)
|
||||
expect { worker.perform(*job_args) }
|
||||
.not_to change { Namespace::AggregationSchedule.count }
|
||||
end
|
||||
end
|
||||
|
||||
def stub_aggregation_schedule_statistics
|
||||
# Namespace::Aggregations are deleted by
|
||||
# Namespace::AggregationSchedule::schedule_root_storage_statistics,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require 'securerandom'
|
||||
|
||||
describe ProjectUpdateRepositoryStorageWorker do
|
||||
let(:project) { create(:project, :repository) }
|
||||
|
@ -8,12 +9,33 @@ describe ProjectUpdateRepositoryStorageWorker do
|
|||
subject { described_class.new }
|
||||
|
||||
describe "#perform" do
|
||||
it "calls the update repository storage service" do
|
||||
expect_next_instance_of(Projects::UpdateRepositoryStorageService) do |instance|
|
||||
expect(instance).to receive(:execute).with('new_storage')
|
||||
context 'when source and target repositories are on different filesystems' do
|
||||
before do
|
||||
allow(Gitlab::GitalyClient).to receive(:filesystem_id).with('default').and_call_original
|
||||
allow(Gitlab::GitalyClient).to receive(:filesystem_id).with('new_storage').and_return(SecureRandom.uuid)
|
||||
end
|
||||
|
||||
subject.perform(project.id, 'new_storage')
|
||||
it "calls the update repository storage service" do
|
||||
expect_next_instance_of(Projects::UpdateRepositoryStorageService) do |instance|
|
||||
expect(instance).to receive(:execute).with('new_storage')
|
||||
end
|
||||
|
||||
subject.perform(project.id, 'new_storage')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when source and target repositories are on the same filesystems' do
|
||||
let(:filesystem_id) { SecureRandom.uuid }
|
||||
|
||||
before do
|
||||
allow(Gitlab::GitalyClient).to receive(:filesystem_id).and_return(filesystem_id)
|
||||
end
|
||||
|
||||
it 'raises an error' do
|
||||
expect_any_instance_of(::Projects::UpdateRepositoryStorageService).not_to receive(:new)
|
||||
|
||||
expect { subject.perform(project.id, 'new_storage') }.to raise_error(ProjectUpdateRepositoryStorageWorker::SameFilesystemError)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -761,12 +761,12 @@
|
|||
exec-sh "^0.3.2"
|
||||
minimist "^1.2.0"
|
||||
|
||||
"@gitlab/at.js@^1.5.5":
|
||||
"@gitlab/at.js@1.5.5":
|
||||
version "1.5.5"
|
||||
resolved "https://registry.yarnpkg.com/@gitlab/at.js/-/at.js-1.5.5.tgz#5f6bfe6baaef360daa9b038fa78798d7a6a916b4"
|
||||
integrity sha512-282Dn3SPVsUHVDhMsXgfnv+Rzog0uxecjttxGRQvxh25es1+xvkGQFsvJfkSKJ3X1kHVkSjKf+Tt5Rra+Jhp9g==
|
||||
|
||||
"@gitlab/eslint-plugin@^2.0.0":
|
||||
"@gitlab/eslint-plugin@2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@gitlab/eslint-plugin/-/eslint-plugin-2.0.0.tgz#4eedd16cf95cf82dc359c1b220d4f5a08361df9c"
|
||||
integrity sha512-ctmsGnCuokhfh/5goLdz3NdBIUpwTMkx/17QxxutxkWW7yOGMPIY8Na+WhjnUSdst8Wjwzexc+snbh5NMs8H/A==
|
||||
|
@ -781,12 +781,12 @@
|
|||
eslint-plugin-vue "^6.2.1"
|
||||
vue-eslint-parser "^7.0.0"
|
||||
|
||||
"@gitlab/svgs@^1.116.0":
|
||||
"@gitlab/svgs@1.116.0":
|
||||
version "1.116.0"
|
||||
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.116.0.tgz#a3c89f950bb256c2e109444c9a85fecdd261292c"
|
||||
integrity sha512-sZLn3acu0IyrSnZRU1rE3UjxF6FlwvBNfjKQgn0qclxdbe8Ya6cGNVq4aGdCEkHwvb9rFpKbfHBujVgVKNkxSA==
|
||||
|
||||
"@gitlab/ui@^10.1.2":
|
||||
"@gitlab/ui@10.1.2":
|
||||
version "10.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-10.1.2.tgz#027f86f69ef08fb90cab5c69545adf37e20c6ceb"
|
||||
integrity sha512-xTvLIHrBqvvvHLVPMGdktBv3hNL7FPGPSFbAC3IURrVa/9FIJbzkIYFGlUIbLu/QX1i0CJN+MLmyHhLtzhKgtA==
|
||||
|
|
Loading…
Reference in a new issue