Commit 2efd3a0a authored by Thong Kuah's avatar Thong Kuah

Merge branch 'rc/update_gitlab_styles_with_changes' into 'master'

Rc/update gitlab styles with changes

See merge request gitlab-org/gitlab!21886
parents de2c9df1 7a7403b7
......@@ -299,3 +299,76 @@ Graphql/Descriptions:
RSpec/AnyInstanceOf:
Enabled: false
# Cops for upgrade to gitlab-styles 3.1.0
FactoryBot/FactoryClassName:
Enabled: false
FactoryBot/CreateList:
Enabled: false
Rails/SafeNavigationWithBlank:
Enabled: false
Rails/ApplicationController:
Enabled: false
Rails/ApplicationMailer:
Enabled: false
Rails/RakeEnvironment:
Enabled: false
Rails/HelperInstanceVariable:
Enabled: false
Rails/EnumHash:
Enabled: false
RSpec/ReceiveCounts:
Enabled: false
RSpec/ContextMethod:
Enabled: false
RSpec/ImplicitSubject:
Enabled: false
RSpec/LeakyConstantDeclaration:
Enabled: false
RSpec/EmptyLineAfterHook:
Enabled: false
RSpec/HooksBeforeExamples:
Enabled: false
RSpec/EmptyLineAfterExample:
Enabled: false
RSpec/Be:
Enabled: false
RSpec/DescribedClass:
Enabled: false
RSpec/SharedExamples:
Enabled: false
RSpec/EmptyLineAfterExampleGroup:
Enabled: false
RSpec/ReceiveNever:
Enabled: false
RSpec/MissingExampleGroupArgument:
Enabled: false
RSpec/UnspecifiedException:
Enabled: false
Style/MultilineWhenThen:
Enabled: false
Style/FloatDivision:
Enabled: false
\ No newline at end of file
......@@ -366,11 +366,11 @@ group :development, :test do
gem 'spring', '~> 2.0.0'
gem 'spring-commands-rspec', '~> 1.0.4'
gem 'gitlab-styles', '~> 2.7', require: false
gem 'gitlab-styles', '~> 3.1.0', require: false
# Pin these dependencies, otherwise a new rule could break the CI pipelines
gem 'rubocop', '~> 0.69.0'
gem 'rubocop-performance', '~> 1.1.0'
gem 'rubocop-rspec', '~> 1.22.1'
gem 'rubocop', '~> 0.74.0'
gem 'rubocop-performance', '~> 1.4.1'
gem 'rubocop-rspec', '~> 1.37.0'
gem 'scss_lint', '~> 0.56.0', require: false
gem 'haml_lint', '~> 0.34.0', require: false
......
......@@ -379,11 +379,12 @@ GEM
gitlab-puma (>= 2.7, < 5)
gitlab-sidekiq-fetcher (0.5.2)
sidekiq (~> 5)
gitlab-styles (2.8.0)
rubocop (~> 0.69.0)
gitlab-styles (3.1.0)
rubocop (~> 0.74.0)
rubocop-gitlab-security (~> 0.1.0)
rubocop-performance (~> 1.1.0)
rubocop-rspec (~> 1.19)
rubocop-performance (~> 1.4.1)
rubocop-rails (~> 2.0)
rubocop-rspec (~> 1.36)
gitlab_chronic_duration (0.10.6.2)
numerizer (~> 0.2)
gitlab_omniauth-ldap (2.1.1)
......@@ -519,7 +520,7 @@ GEM
jaeger-client (0.10.0)
opentracing (~> 0.3)
thrift
jaro_winkler (1.5.3)
jaro_winkler (1.5.4)
jira-ruby (1.7.1)
activesupport
atlassian-jwt
......@@ -726,8 +727,8 @@ GEM
rubypants (~> 0.2)
orm_adapter (0.5.0)
os (1.0.0)
parallel (1.17.0)
parser (2.6.3.0)
parallel (1.19.1)
parser (2.6.5.0)
ast (~> 2.4.0)
parslet (1.8.2)
peek (1.1.0)
......@@ -904,7 +905,7 @@ GEM
pg
rails
sqlite3
rubocop (0.69.0)
rubocop (0.74.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.6)
......@@ -913,10 +914,13 @@ GEM
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-gitlab-security (0.1.1)
rubocop (>= 0.51)
rubocop-performance (1.1.0)
rubocop (>= 0.67.0)
rubocop-rspec (1.22.2)
rubocop (>= 0.52.1)
rubocop-performance (1.4.1)
rubocop (>= 0.71.0)
rubocop-rails (2.4.0)
rack (>= 1.1)
rubocop (>= 0.72.0)
rubocop-rspec (1.37.0)
rubocop (>= 0.68.1)
ruby-enum (0.7.2)
i18n
ruby-fogbugz (0.2.1)
......@@ -1207,7 +1211,7 @@ DEPENDENCIES
gitlab-puma (~> 4.3.1.gitlab.2)
gitlab-puma_worker_killer (~> 0.1.1.gitlab.1)
gitlab-sidekiq-fetcher (= 0.5.2)
gitlab-styles (~> 2.7)
gitlab-styles (~> 3.1.0)
gitlab_chronic_duration (~> 0.10.6.2)
gitlab_omniauth-ldap (~> 2.1.1)
gon (~> 6.2)
......@@ -1318,9 +1322,9 @@ DEPENDENCIES
rspec-set (~> 0.1.3)
rspec_junit_formatter
rspec_profiling (~> 0.0.5)
rubocop (~> 0.69.0)
rubocop-performance (~> 1.1.0)
rubocop-rspec (~> 1.22.1)
rubocop (~> 0.74.0)
rubocop-performance (~> 1.4.1)
rubocop-rspec (~> 1.37.0)
ruby-fogbugz (~> 0.2.1)
ruby-prof (~> 1.0.0)
ruby-progressbar
......
# frozen_string_literal: true
class Admin::SystemInfoController < Admin::ApplicationController
EXCLUDED_MOUNT_OPTIONS = [
'nobrowse',
'read-only',
'ro'
EXCLUDED_MOUNT_OPTIONS = %w[
nobrowse
read-only
ro
].freeze
EXCLUDED_MOUNT_TYPES = [
......
......@@ -31,7 +31,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
# Extend the standard message generation to accept our custom exception
def failure_message
exception = request.env["omniauth.error"]
error = exception.error_reason if exception.respond_to?(:error_reason)
error = exception.error_reason if exception.respond_to?(:error_reason)
error ||= exception.error if exception.respond_to?(:error)
error ||= exception.message if exception.respond_to?(:message)
error ||= request.env["omniauth.error.type"].to_s
......
......@@ -7,8 +7,8 @@ class Projects::StarrersController < Projects::ApplicationController
@starrers = UsersStarProjectsFinder.new(@project, params, current_user: @current_user).execute
@sort = params[:sort].presence || sort_value_name
@starrers = @starrers.preload_users.sort_by_attribute(@sort).page(params[:page])
@public_count = @project.starrers.with_public_profile.size
@total_count = @project.starrers.size
@public_count = @project.starrers.with_public_profile.size
@total_count = @project.starrers.size
@private_count = @total_count - @public_count
end
......
......@@ -35,7 +35,7 @@ module DashboardHelper
tag.p(aria: { label: label }) do
concat(link_or_title)
concat(tag.span(class: ['light', 'float-right']) do
concat(tag.span(class: %w[light float-right]) do
boolean_to_icon(enabled)
end)
......
......@@ -127,7 +127,7 @@ module SnippetsHelper
return unless attrs = snippet_badge_attributes(snippet)
css_class, text = attrs
tag.span(class: ['badge', 'badge-gray']) do
tag.span(class: %w[badge badge-gray]) do
concat(tag.i(class: ['fa', css_class]))
concat(' ')
concat(text)
......
......@@ -234,7 +234,7 @@ module Gitlab
credentials: true,
headers: :any,
methods: :any,
expose: ['Link', 'X-Total', 'X-Total-Pages', 'X-Per-Page', 'X-Page', 'X-Next-Page', 'X-Prev-Page']
expose: %w[Link X-Total X-Total-Pages X-Per-Page X-Page X-Next-Page X-Prev-Page]
end
# Cross-origin requests must not have the session cookie available
......@@ -244,7 +244,7 @@ module Gitlab
credentials: false,
headers: :any,
methods: :any,
expose: ['Link', 'X-Total', 'X-Total-Pages', 'X-Per-Page', 'X-Page', 'X-Next-Page', 'X-Prev-Page']
expose: %w[Link X-Total X-Total-Pages X-Per-Page X-Page X-Next-Page X-Prev-Page]
end
end
......
......@@ -162,8 +162,8 @@ Settings.gitlab['default_projects_limit'] ||= 100000
Settings.gitlab['default_branch_protection'] ||= 2
Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
Settings.gitlab['default_theme'] = Gitlab::Themes::APPLICATION_DEFAULT if Settings.gitlab['default_theme'].nil?
Settings.gitlab['host'] ||= ENV['GITLAB_HOST'] || 'localhost'
Settings.gitlab['ssh_host'] ||= Settings.gitlab.host
Settings.gitlab['host'] ||= ENV['GITLAB_HOST'] || 'localhost'
Settings.gitlab['ssh_host'] ||= Settings.gitlab.host
Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
Settings.gitlab['port'] ||= ENV['GITLAB_PORT'] || (Settings.gitlab.https ? 443 : 80)
Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || ''
......@@ -176,10 +176,10 @@ Settings.gitlab['email_display_name'] ||= ENV['GITLAB_EMAIL_DISPLAY_NAME'] || 'G
Settings.gitlab['email_reply_to'] ||= ENV['GITLAB_EMAIL_REPLY_TO'] || "noreply@#{Settings.gitlab.host}"
Settings.gitlab['email_subject_suffix'] ||= ENV['GITLAB_EMAIL_SUBJECT_SUFFIX'] || ""
Settings.gitlab['email_smime'] = SmimeSignatureSettings.parse(Settings.gitlab['email_smime'])
Settings.gitlab['base_url'] ||= Settings.__send__(:build_base_gitlab_url)
Settings.gitlab['url'] ||= Settings.__send__(:build_gitlab_url)
Settings.gitlab['user'] ||= 'git'
Settings.gitlab['user_home'] ||= begin
Settings.gitlab['base_url'] ||= Settings.__send__(:build_base_gitlab_url)
Settings.gitlab['url'] ||= Settings.__send__(:build_gitlab_url)
Settings.gitlab['user'] ||= 'git'
Settings.gitlab['user_home'] ||= begin
Etc.getpwnam(Settings.gitlab['user']).dir
rescue ArgumentError # no user configured
'/home/' + Settings.gitlab['user']
......@@ -257,13 +257,13 @@ Settings.artifacts['object_store'] = ObjectStoreSettings.parse(Settings.artifact
# Registry
#
Settings['registry'] ||= Settingslogic.new({})
Settings.registry['enabled'] ||= false
Settings.registry['host'] ||= "example.com"
Settings.registry['port'] ||= nil
Settings.registry['api_url'] ||= "http://localhost:5000/"
Settings.registry['key'] ||= nil
Settings.registry['issuer'] ||= nil
Settings.registry['host_port'] ||= [Settings.registry['host'], Settings.registry['port']].compact.join(':')
Settings.registry['enabled'] ||= false
Settings.registry['host'] ||= "example.com"
Settings.registry['port'] ||= nil
Settings.registry['api_url'] ||= "http://localhost:5000/"
Settings.registry['key'] ||= nil
Settings.registry['issuer'] ||= nil
Settings.registry['host_port'] ||= [Settings.registry['host'], Settings.registry['port']].compact.join(':')
Settings.registry['path'] = Settings.absolute(Settings.registry['path'] || File.join(Settings.shared['path'], 'registry'))
Settings.registry['notifications'] ||= []
......@@ -284,13 +284,13 @@ Settings.pages['enabled'] = false if Settings.pages['enabled'].nil?
Settings.pages['access_control'] = false if Settings.pages['access_control'].nil?
Settings.pages['path'] = Settings.absolute(Settings.pages['path'] || File.join(Settings.shared['path'], "pages"))
Settings.pages['https'] = false if Settings.pages['https'].nil?
Settings.pages['host'] ||= "example.com"
Settings.pages['port'] ||= Settings.pages.https ? 443 : 80
Settings.pages['protocol'] ||= Settings.pages.https ? "https" : "http"
Settings.pages['url'] ||= Settings.__send__(:build_pages_url)
Settings.pages['external_http'] ||= false unless Settings.pages['external_http'].present?
Settings.pages['external_https'] ||= false unless Settings.pages['external_https'].present?
Settings.pages['artifacts_server'] ||= Settings.pages['enabled'] if Settings.pages['artifacts_server'].nil?
Settings.pages['host'] ||= "example.com"
Settings.pages['port'] ||= Settings.pages.https ? 443 : 80
Settings.pages['protocol'] ||= Settings.pages.https ? "https" : "http"
Settings.pages['url'] ||= Settings.__send__(:build_pages_url)
Settings.pages['external_http'] ||= false unless Settings.pages['external_http'].present?
Settings.pages['external_https'] ||= false unless Settings.pages['external_https'].present?
Settings.pages['artifacts_server'] ||= Settings.pages['enabled'] if Settings.pages['artifacts_server'].nil?
Settings.pages['secret_file'] ||= Rails.root.join('.gitlab_pages_secret')
#
......@@ -590,7 +590,7 @@ end
# Backup
#
Settings['backup'] ||= Settingslogic.new({})
Settings.backup['keep_time'] ||= 0
Settings.backup['keep_time'] ||= 0
Settings.backup['pg_schema'] = nil
Settings.backup['path'] = Settings.absolute(Settings.backup['path'] || "tmp/backups/")
Settings.backup['archive_permissions'] ||= 0600
......
......@@ -45,7 +45,6 @@ namespace :admin do
scope(path: 'groups/*id',
controller: :groups,
constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do
scope(as: :group) do
put :members_update
get :edit, action: :edit
......@@ -90,7 +89,6 @@ namespace :admin do
path: '/',
constraints: { id: Gitlab::PathRegex.project_route_regex },
only: [:show, :destroy]) do
member do
put :transfer
post :repository_check
......
......@@ -29,7 +29,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
constraints: { project_id: Gitlab::PathRegex.project_route_regex },
module: :projects,
as: :project) do
# Begin of the /-/ scope.
# Use this scope for all new project routes.
scope '-' do
......
......@@ -15,7 +15,6 @@ class AdjournedGroupDeletionWorker
.with_deletion_schedule
.find_each(batch_size: 100) # rubocop: disable CodeReuse/ActiveRecord
.with_index do |group, index|
deletion_schedule = group.deletion_schedule
delay = index * INTERVAL
......
......@@ -12,7 +12,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
constraints: { project_id: Gitlab::PathRegex.project_route_regex },
module: :projects,
as: :project) do
# Begin of the /-/ scope.
# Use this scope for all new project routes.
scope '-' do
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe RoutableActions do
controller(::ApplicationController) do
include RoutableActions # rubocop:disable RSpec/DescribedClass
include RoutableActions
before_action :routable
......
......@@ -67,8 +67,8 @@ describe Gitlab::Ci::Reports::LicenseScanning::License do
['LGPL-2.1', 'LGPL-2.1'],
%w[MIT MIT],
['Mozilla Public License 2.0', 'MPL-2.0'],
['MS-PL', 'MS-PL'],
['MS-RL', 'MS-RL'],
%w[MS-PL MS-PL],
%w[MS-RL MS-RL],
['New BSD', 'BSD-3-Clause'],
['Python Software Foundation License', 'Python-2.0'],
%w[ruby Ruby],
......
......@@ -342,13 +342,13 @@ describe "Git HTTP requests (Geo)", :geo do
context 'when gl_id is provided via HTTP headers' do
context 'but is invalid' do
where(:geo_gl_id) do
[
'key-999',
'key-1',
'key-999',
'junk',
'junk-1',
'kkey-1'
%w[
key-999
key-1
key-999
junk
junk-1
kkey-1
]
end
......
......@@ -15,11 +15,11 @@ describe Boards::ListService do
end
it 'returns boards ordered by name' do
board_names = ['a-board', 'B-board', 'c-board'].shuffle
board_names = %w[a-board B-board c-board].shuffle
boards.each_with_index { |board, i| board.update_column(:name, board_names[i]) }
stub_licensed_features(multiple_group_issue_boards: true)
expect(service.execute.pluck(:name)).to eq(['a-board', 'B-board', 'c-board'])
expect(service.execute.pluck(:name)).to eq(%w[a-board B-board c-board])
end
end
end
......
......@@ -558,7 +558,7 @@ describe EE::NotificationService, :mailer do
# User to be participant by default
# This user does not contain any record in notification settings table
# It should be treated with a :participating notification_level
@u_lazy_participant = create(:user, username: 'lazy-participant')
@u_lazy_participant = create(:user, username: 'lazy-participant')
@u_guest_watcher = create_user_with_notification(:watch, 'guest_watching', group)
@u_guest_custom = create_user_with_notification(:custom, 'guest_custom', group)
......@@ -700,7 +700,7 @@ describe EE::NotificationService, :mailer do
# User to be participant by default
# This user does not contain any record in notification settings table
# It should be treated with a :participating notification_level
@u_lazy_participant = create(:user, username: 'lazy-participant')
@u_lazy_participant = create(:user, username: 'lazy-participant')
@u_guest_watcher = create_user_with_notification(:watch, 'guest_watching')
@u_guest_custom = create_user_with_notification(:custom, 'guest_custom')
......
......@@ -27,7 +27,6 @@ module API
":id/#{awardable_string}/:#{awardable_id_string}/award_emoji",
":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji"
].each do |endpoint|
desc 'Get a list of project +awardable+ award emoji' do
detail 'This feature was introduced in 8.9'
success Entities::AwardEmoji
......
......@@ -11,7 +11,6 @@ module Gitlab
# So we chose a way to use ::Ci::Build directly and we don't change the `archive!` method until 11.1
::Ci::Build.finished.without_archived_trace
.where(id: start_id..stop_id).find_each do |build|
build.trace.archive!
rescue => e
Rails.logger.error "Failed to archive live trace. id: #{build.id} message: #{e.message}" # rubocop:disable Gitlab/RailsLogger
......
......@@ -10,7 +10,7 @@ module Gitlab
def initialize(user:, shared:, project:)
@path = File.join(shared.export_path, 'project.json')
@user = user
@shared = shared
@shared = shared
@project = project
end
......
......@@ -36,7 +36,7 @@ module Gitlab
end
def relative_path(path)
path.gsub(%r{^#{Rails.root.to_s}/?}, '')
path.gsub(%r{^#{Rails.root}/?}, '')
end
def values_for(event)
......
......@@ -18,7 +18,7 @@ module Gitlab
end
def relative_path
@relative_path ||= @file.gsub(%r{^#{Rails.root.to_s}/?}, '')
@relative_path ||= @file.gsub(%r{^#{Rails.root}/?}, '')
end
def to_param
......
......@@ -45,7 +45,7 @@ module Gitlab
require 'rblineprof'
retval = nil
samples = lineprof(/^#{Rails.root.to_s}/) { retval = yield }
samples = lineprof(/^#{Rails.root}/) { retval = yield }
file_samples = aggregate_rblineprof(samples)
......
......@@ -206,7 +206,6 @@ module Gitlab
.by_type(:JiraService)
.includes(:jira_tracker_data)
.find_in_batches(batch_size: BATCH_SIZE) do |services|
counts = services.group_by do |service|
# TODO: Simplify as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
service_url = service.data_fields&.url || (service.properties && service.properties['url'])
......
......@@ -9,7 +9,6 @@ namespace :gitlab do
LfsObject.with_files_stored_locally
.find_each(batch_size: 10) do |lfs_object|
lfs_object.file.migrate!(LfsObjectUploader::Store::REMOTE)
logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to object storage")
......@@ -24,7 +23,6 @@ namespace :gitlab do
LfsObject.with_files_stored_remotely
.find_each(batch_size: 10) do |lfs_object|
lfs_object.file.migrate!(LfsObjectUploader::Store::LOCAL)
logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to local storage")
......
......@@ -153,7 +153,7 @@ module QA
# The git cli produces the 'warning: redirecting to..' output
# internally.
expect(push.output).to match(/warning: redirecting to #{absolute_path}/)
expect(push.output).to match(/Locking support detected on remote "#{location.uri.to_s}"/)
expect(push.output).to match(/Locking support detected on remote "#{location.uri}"/)
# Validate git push worked and new content is visible
Page::Project::Show.perform do |show|
......
......@@ -168,7 +168,7 @@ module QA
ssh_uri = project.repository_ssh_location.git_uri.to_s.gsub(%r{ssh://}, '')
expect(push.output).to match(%r{We'll help you by proxying this.*request to the primary:.*#{ssh_uri}}m)
expect(push.output).to match(/Locking support detected on remote "#{location.uri.to_s}"/)
expect(push.output).to match(/Locking support detected on remote "#{location.uri}"/)
# Validate git push worked and new content is visible
Page::Project::Show.perform do |show|
......
......@@ -10,7 +10,7 @@ describe ConfirmEmailWarning do
controller(ApplicationController) do
# `described_class` is not available in this context
include ConfirmEmailWarning # rubocop:disable RSpec/DescribedClass
include ConfirmEmailWarning
def index
head :ok
......
......@@ -22,7 +22,7 @@ describe ControllerWithCrossProjectAccessCheck do
describe '#requires_cross_project_access' do
controller(ApplicationController) do
# `described_class` is not available in this context
include ControllerWithCrossProjectAccessCheck # rubocop:disable RSpec/DescribedClass
include ControllerWithCrossProjectAccessCheck
requires_cross_project_access :index, show: false,
unless: -> { unless_condition },
......@@ -81,7 +81,7 @@ describe ControllerWithCrossProjectAccessCheck do
describe '#skip_cross_project_access_check' do
controller(ApplicationController) do
# `described_class` is not available in this context
include ControllerWithCrossProjectAccessCheck # rubocop:disable RSpec/DescribedClass
include ControllerWithCrossProjectAccessCheck
requires_cross_project_access
......
......@@ -8,7 +8,7 @@ describe GroupTree do
controller(ApplicationController) do
# `described_class` is not available in this context
include GroupTree # rubocop:disable RSpec/DescribedClass
include GroupTree
def index
render_group_tree GroupsFinder.new(current_user).execute
......
......@@ -7,7 +7,7 @@ describe LfsRequest do
controller(Projects::GitHttpClientController) do
# `described_class` is not available in this context
include LfsRequest # rubocop:disable RSpec/DescribedClass
include LfsRequest
def show
storage_project
......
......@@ -16,7 +16,7 @@ describe MetricsDashboard do
end
controller(::ApplicationController) do
include MetricsDashboard # rubocop:disable RSpec/DescribedClass
include MetricsDashboard
end
let(:json_response) do
......
......@@ -9,7 +9,7 @@ describe RendersCommits do
controller(ApplicationController) do
# `described_class` is not available in this context
include RendersCommits # rubocop:disable RSpec/DescribedClass
include RendersCommits
def index
@merge_request = MergeRequest.find(params[:id])
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe RoutableActions do
controller(::ApplicationController) do
include RoutableActions # rubocop:disable RSpec/DescribedClass
include RoutableActions
before_action :routable
......
......@@ -17,7 +17,7 @@ describe SourcegraphGon do
let(:project) { internal_project }
controller(ApplicationController) do
include SourcegraphGon # rubocop:disable RSpec/DescribedClass
include SourcegraphGon
def index
head :ok
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe StaticObjectExternalStorage do
controller(Projects::ApplicationController) do
include StaticObjectExternalStorage # rubocop:disable RSpec/DescribedClass
include StaticObjectExternalStorage
before_action :redirect_to_external_storage, if: :static_objects_external_storage_enabled?
......
......@@ -591,7 +591,7 @@ describe Projects::BranchesController do
params: {
namespace_id: project.namespace,
project_id: project,
names: ['fix', 'add-pdf-file', 'branch-merged']
names: %w[fix add-pdf-file branch-merged]
}
expect(response).to have_gitlab_http_status(200)
......@@ -639,7 +639,7 @@ describe Projects::BranchesController do
params: {
namespace_id: project.namespace,
project_id: project,
names: ['fix', 'add-pdf-file', 'branch-merged']
names: %w[fix add-pdf-file branch-merged]
}
expect(response).to have_gitlab_http_status(200)
......
......@@ -50,7 +50,7 @@ describe 'Projects > Snippets > Create Snippet', :js do
wait_for_requests
link = find('a.no-attachment-icon img[alt="banana_sample"]')['src']
expect(link).to match(%r{/#{Regexp.escape(project.full_path) }/uploads/\h{32}/banana_sample\.gif\z})
expect(link).to match(%r{/#{Regexp.escape(project.full_path)}/uploads/\h{32}/banana_sample\.gif\z})
end
it 'creates a snippet when all required fields are filled in after validation failing' do
......@@ -72,7 +72,7 @@ describe 'Projects > Snippets > Create Snippet', :js do
expect(page).to have_selector('strong')
end
link = find('a.no-attachment-icon img[alt="banana_sample"]')['src']
expect(link).to match(%r{/#{Regexp.escape(project.full_path) }/uploads/\h{32}/banana_sample\.gif\z})
expect(link).to match(%r{/#{Regexp.escape(project.full_path)}/uploads/\h{32}/banana_sample\.gif\z})
end
end
......
......@@ -66,7 +66,7 @@ describe BranchesFinder do
end
it 'filters branches by provided names' do
branches_finder = described_class.new(repository, { names: ['fix', 'csv', 'lfs', 'does-not-exist'] })
branches_finder = described_class.new(repository, { names: %w[fix csv lfs does-not-exist] })
result = branches_finder.execute
......
......@@ -219,7 +219,7 @@ describe TodosFinder do
end
it "sorts by priority" do
project_2 = create(:project)
project_2 = create(:project)
label_1 = create(:label, title: 'label_1', project: project, priority: 1)
label_2 = create(:label, title: 'label_2', project: project, priority: 2)
......
......@@ -332,13 +332,13 @@ describe ProjectsHelper do
end
it 'returns image tag for member avatar' do
expect(helper).to receive(:image_tag).with(expected, { width: 16, class: ["avatar", "avatar-inline", "s16"], alt: "", "data-src" => anything })
expect(helper).to receive(:image_tag).with(expected, { width: 16, class: %w[avatar avatar-inline s16], alt: "", "data-src" => anything })
helper.link_to_member_avatar(user)
end
it 'returns image tag with avatar class' do
expect(helper).to receive(:image_tag).with(expected, { width: 16, class: ["avatar", "avatar-inline", "s16", "any-avatar-class"], alt: "", "data-src" => anything })
expect(helper).to receive(:image_tag).with(expected, { width: 16, class: %w[avatar avatar-inline s16 any-avatar-class], alt: "", "data-src" => anything })
helper.link_to_member_avatar(user, avatar_class: "any-avatar-class")
end
......
......@@ -100,7 +100,7 @@ describe ExpandVariables do
end
with_them do
subject { ExpandVariables.expand(value, variables) } # rubocop:disable RSpec/DescribedClass
subject { ExpandVariables.expand(value, variables) }
it { is_expected.to eq(result) }
end
......
......@@ -481,7 +481,6 @@ module Gitlab
['../sample.adoc', 'doc/sample.adoc', 'relative path to a file up one directory'],
['../../sample.adoc', 'sample.adoc', 'relative path for a file up multiple directories']
].each do |include_path_, file_path_, desc|
context "the file is specified by #{desc}" do
let(:include_path) { include_path_ }
let(:file_path) { file_path_ }
......
......@@ -31,13 +31,13 @@ describe Gitlab::Ci::Config::Entry::Cache do
it_behaves_like 'hash key value'
context 'with files' do
let(:key) { { files: ['a-file', 'other-file'] } }
let(:key) { { files: %w[a-file other-file] } }
it_behaves_like 'hash key value'
end
context 'with files and prefix' do
let(:key) { { files: ['a-file', 'other-file'], prefix: 'prefix-value' } }
let(:key) { { files: %w[a-file other-file], prefix: 'prefix-value' } }
it_behaves_like 'hash key value'
end
......@@ -55,7 +55,7 @@ describe Gitlab::Ci::Config::Entry::Cache do
it { is_expected.to be_valid }
context 'with files' do
let(:key) { { files: ['a-file', 'other-file'] } }
let(:key) { { files: %w[a-file other-file] } }
it { is_expected.to be_valid }
end
......
......@@ -6,12 +6,12 @@ shared_examples 'renames child namespaces' do |type|
it 'renames namespaces' do
rename_namespaces = double
expect(described_class::RenameNamespaces)
.to receive(:new).with(['first-path', 'second-path'], subject)
.to receive(:new).with(%w[first-path second-path], subject)
.and_return(rename_namespaces)
expect(rename_namespaces).to receive(:rename_namespaces)
.with(type: :child)
subject.rename_wildcard_paths(['first-path', 'second-path'])
subject.rename_wildcard_paths(%w[first-path second-path])
end
end
......
......@@ -54,7 +54,7 @@ describe Gitlab::Experimentation do
describe '#experiment_enabled?' do
context 'cookie is not present' do
it 'calls Gitlab::Experimentation.enabled_for_user? with the name of the experiment and an experimentation_subject_index of nil' do
expect(Gitlab::Experimentation).to receive(:enabled_for_user?).with(:test_experiment, nil) # rubocop:disable RSpec/DescribedClass
expect(Gitlab::Experimentation).to receive(:enabled_for_user?).with(:test_experiment, nil)
controller.experiment_enabled?(:test_experiment)
end
end
......@@ -67,7 +67,7 @@ describe Gitlab::Experimentation do
it 'calls Gitlab::Experimentation.enabled_for_user? with the name of the experiment and an experimentation_subject_index of the modulo 100 of the hex value of the uuid' do
# 'abcd1234'.hex % 100 = 76
expect(Gitlab::Experimentation).to receive(:enabled_for_user?).with(:test_experiment, 76) # rubocop:disable RSpec/DescribedClass
expect(Gitlab::Experimentation).to receive(:enabled_for_user?).with(:test_experiment, 76)
controller.experiment_enabled?(:test_experiment)
end
end
......
......@@ -12,7 +12,7 @@ describe Gitlab::GitalyClient::BlobService do
describe '#get_new_lfs_pointers' do
let(:revision) { 'master' }
let(:limit) { 5 }
let(:not_in) { ['branch-a', 'branch-b'] }
let(:not_in) { %w[branch-a branch-b] }
let(:expected_params) do
{ revision: revision, limit: limit, not_in_refs: not_in, not_in_all: false }
end
......
......@@ -69,7 +69,7 @@ describe Gitlab::GitalyClient::RemoteService do
describe '#update_remote_mirror' do
let(:ref_name) { 'remote_mirror_1' }
let(:only_branches_matching) { ['my-branch', 'master'] }
let(:only_branches_matching) { %w[my-branch master] }
let(:ssh_key) { 'KEY' }
let(:known_hosts) { 'KNOWN HOSTS' }
......
......@@ -15,13 +15,13 @@ describe Gitlab::PhabricatorImport::Conduit::User do
it 'calls the api with the correct params' do
expected_params = {
constraints: { phids: ['phid-1', 'phid-2'] }
constraints: { phids: %w[phid-1 phid-2] }
}
expect(fake_client).to receive(:get).with('user.search',
params: expected_params)
user_client.users(['phid-1', 'phid-2'])
user_client.users(%w[phid-1 phid-2])
end
it 'returns an array of parsed responses' do
......@@ -43,7 +43,7 @@ describe Gitlab::PhabricatorImport::Conduit::User do
expect(fake_client).to receive(:get).with('user.search',
params: second_params).once
user_client.users(['phid-1', 'phid-2'])
user_client.users(%w[phid-1 phid-2])
end
end
end
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe Gitlab::PhabricatorImport::UserFinder, :clean_gitlab_redis_cache do
let(:project) { create(:project, namespace: create(:group)) }
subject(:finder) { described_class.new(project, ['first-phid', 'second-phid']) }
subject(:finder) { described_class.new(project, %w[first-phid second-phid]) }
before do
project.namespace.add_developer(existing_user)
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe Gitlab::QuickActions::Dsl do
before :all do
DummyClass = Struct.new(:project) do
include Gitlab::QuickActions::Dsl # rubocop:disable RSpec/DescribedClass
include Gitlab::QuickActions::Dsl
desc 'A command with no args'
command :no_args, :none do
......
......@@ -110,7 +110,7 @@ RSpec.describe Quality::HelmClient do
end
context 'with multiple release names' do
let(:release_name) { ['my-release', 'my-release-2'] }
let(:release_name) { %w[my-release my-release-2] }
it 'raises an error if the Helm command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
......
......@@ -46,7 +46,7 @@ RSpec.describe Quality::KubernetesClient do
end
context 'with multiple releases' do
let(:release_name) { ['my-release', 'my-release-2'] }
let(:release_name) { %w[my-release my-release-2] }
it 'raises an error if the Kubernetes command fails' do
expect(Gitlab::Popen).to receive(:popen_with_detail)
......
......@@ -139,7 +139,7 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_shared_state do
redis = double(:redis)
expect(Gitlab::Redis::SharedState).to receive(:with).and_yield(redis)
sessions = ['session-a', 'session-b']
sessions = %w[session-a session-b]
mget_responses = sessions.map { |session| [Marshal.dump(session)]}
expect(redis).to receive(:mget).twice.and_return(*mget_responses)
......
......@@ -384,7 +384,7 @@ describe MergeRequest do
end
it 'returns target branches sort by updated at desc' do
expect(described_class.recent_target_branches).to match_array(['feature', 'merge-test', 'fix'])
expect(described_class.recent_target_branches).to match_array(%w[feature merge-test fix])
end
end
......
......@@ -115,7 +115,7 @@ describe API::Wikis do
end
[:title, :content, :format].each do |part|
it "it updates with wiki with missing #{part}" do
it "updates with wiki with missing #{part}" do
payload.delete(part)
put(api(url, user), params: payload)
......
......@@ -2707,7 +2707,7 @@ describe NotificationService, :mailer do
# User to be participant by default
# This user does not contain any record in notification settings table
# It should be treated with a :participating notification_level
@u_lazy_participant = create(:user, username: 'lazy-participant')
@u_lazy_participant = create(:user, username: 'lazy-participant')
@u_guest_watcher = create_user_with_notification(:watch, 'guest_watching')
@u_guest_custom = create_user_with_notification(:custom, 'guest_custom')
......
......@@ -297,11 +297,11 @@ shared_examples 'thread comments' do |resource_name|
find("#{form_selector} .note-textarea").send_keys('a')
end
it "should show a 'Comment & reopen #{resource_name}' button" do
it "shows a 'Comment & reopen #{resource_name}' button" do
expect(find("#{form_selector} .js-note-target-reopen")).to have_content "Comment & reopen #{resource_name}"
end
it "should show a 'Start thread & reopen #{resource_name}' button when 'Start thread' is selected" do
it "shows a 'Start thread & reopen #{resource_name}' button when 'Start thread' is selected" do
find(toggle_selector).click
find("#{menu_selector} li", match: :first)
......
......@@ -154,7 +154,6 @@ module TestEnv
install_dir: gitaly_dir,
version: Gitlab::GitalyClient.expected_server_version,
task: "gitlab:gitaly:install[#{install_gitaly_args}]") do
Gitlab::SetupHelper.create_gitaly_configuration(gitaly_dir, { 'default' => repos_path }, force: true)
start_gitaly(gitaly_dir)
end
......
......@@ -11,7 +11,7 @@ describe 'projects/commit/branches.html.haml' do
context 'when branches and tags are available' do
before do
assign(:branches, ['master', 'test-branch'])
assign(:branches, %w[master test-branch])
assign(:branches_limit_exceeded, false)
assign(:tags, ['tag1'])
assign(:tags_limit_exceeded, false)
......@@ -35,7 +35,7 @@ describe 'projects/commit/branches.html.haml' do
context 'when branches are available but no tags' do
before do
assign(:branches, ['master', 'test-branch'])
assign(:branches, %w[master test-branch])
assign(:branches_limit_exceeded, false)
assign(:tags, [])
assign(:tags_limit_exceeded, true)
......
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