Commit 8d0604b3 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '336754-ruby3-prep' into 'master'

Prepare Ruby 3 support

See merge request gitlab-org/gitlab!68531
parents 9d3bc148 7ebadfe3
......@@ -83,7 +83,7 @@ module Clusters
project_id: clusterable.id
}
model.sanitize_sql_array([Arel.sql(order), values])
Arel.sql(model.sanitize_sql_array([Arel.sql(order), values]))
end
def group_clusters_base_query
......
......@@ -15,10 +15,10 @@ class AddVerificationToMergeRequestDiffRegistry < ActiveRecord::Migration[6.0]
add_column_unless_exists :verification_failure, :string, limit: 255 # rubocop:disable Migration/PreventStrings because https://gitlab.com/gitlab-org/gitlab/-/issues/323806
end
def add_column_unless_exists(column, *args)
return if column_exists?(:merge_request_diff_registry, column)
def add_column_unless_exists(column_name, type, **options)
return if column_exists?(:merge_request_diff_registry, column_name)
add_column REGISTRY, column, *args
add_column REGISTRY, column_name, type, **options
end
def down
......
......@@ -88,11 +88,15 @@ module Gitlab
end
def build_attributes
@attributes_finder.included_attributes.each(&method(:add_permitted_attributes))
@attributes_finder.included_attributes.each do |model_name, attributes|
add_permitted_attributes(model_name, attributes)
end
end
def build_methods
@attributes_finder.methods.each(&method(:add_permitted_attributes))
@attributes_finder.methods.each do |model_name, attributes|
add_permitted_attributes(model_name, attributes)
end
end
def add_permitted_attributes(model_name, attributes)
......
......@@ -61,7 +61,9 @@ module Gitlab
# the configuration yaml file too.
# Finally, it updates each attribute in the newly imported project/group.
def create_relations!
relations.each(&method(:process_relation!))
relations.each do |relation_key, relation_definition|
process_relation!(relation_key, relation_definition)
end
end
def process_relation!(relation_key, relation_definition)
......
......@@ -6,7 +6,8 @@ module Gitlab
original_record_timestamps = model.record_timestamps
model.record_timestamps = false
if block.arity.abs == 1
# negative arity means arguments are optional
if block.arity == 1 || block.arity < 0
block.call(model)
else
block.call
......
......@@ -111,7 +111,7 @@ namespace :gitlab do
desc 'GitLab | GraphQL | Generate GraphQL docs'
task compile_docs: [:environment, :enable_feature_flags] do
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, render_options)
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, **render_options)
renderer.write
......@@ -120,7 +120,7 @@ namespace :gitlab do
desc 'GitLab | GraphQL | Check if GraphQL docs are up to date'
task check_docs: [:environment, :enable_feature_flags] do
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, render_options)
renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, **render_options)
doc = File.read(Rails.root.join(OUTPUT_DIR, 'index.md'))
......
......@@ -2,6 +2,7 @@
# frozen_string_literal: true
require 'set'
require 'fileutils'
class String
def red
......
......@@ -13,7 +13,7 @@ RSpec.describe UpdateMinimumPasswordLength do
before do
stub_const('ApplicationSetting::DEFAULT_MINIMUM_PASSWORD_LENGTH', 10)
allow(Devise.password_length).to receive(:min).and_return(12)
allow(Devise).to receive(:password_length).and_return(12..20)
end
it 'correctly migrates minimum_password_length' do
......
......@@ -857,12 +857,8 @@ RSpec.describe User do
end
context 'maximum value' do
before do
allow(Devise.password_length).to receive(:max).and_return(201)
end
it 'is determined by the current value of `Devise.password_length.max`' do
expect(password_length.max).to eq(201)
expect(password_length.max).to eq(Devise.password_length.max)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment