From 03280712d3969b8e2de5119752c9b770c0f6f95c Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 16 Oct 2023 14:17:35 +0000 Subject: [PATCH] Fix RuboCop offenses due to r22343: Style/RedundantRegexpEscape, Layout/EmptyLinesAroundMethodBody, and Style/HashSyntax (#39181). git-svn-id: https://svn.redmine.org/redmine/trunk@22346 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/user_query.rb | 3 +-- test/integration/api_test/users_test.rb | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/user_query.rb b/app/models/user_query.rb index dbbb0eccb..cd3a5172b 100644 --- a/app/models/user_query.rb +++ b/app/models/user_query.rb @@ -176,7 +176,7 @@ class UserQuery < Query else # match = (operator == '~') match = !operator.start_with?('!') - matching_operator = operator.sub /^\!/, '' + matching_operator = operator.sub /^!/, '' name_sql = %w(login firstname lastname).map{|field| sql_for_field(:name, operator, value, User.table_name, field)} emails = EmailAddress.table_name @@ -191,6 +191,5 @@ class UserQuery < Query op = match ? " OR " : " AND " "(#{conditions.map{|s| "(#{s})"}.join(op)})" end - end end diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 5b52f6d3b..1a1682f32 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -83,21 +83,21 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end test "GET /users.json with legacy filter params" do - get '/users.json', :headers => credentials('admin'), params: { status: 3 } + get '/users.json', headers: credentials('admin'), params: { status: 3 } assert_response :success json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') users = User.where(status: 3) assert_equal users.size, json['users'].size - get '/users.json', :headers => credentials('admin'), params: { name: 'jsmith' } + get '/users.json', headers: credentials('admin'), params: { name: 'jsmith' } assert_response :success json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') assert_equal 1, json['users'].size assert_equal 2, json['users'][0]['id'] - get '/users.json', :headers => credentials('admin'), params: { group_id: '10' } + get '/users.json', headers: credentials('admin'), params: { group_id: '10' } assert_response :success json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') @@ -107,13 +107,13 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base # there should be an implicit filter for status = 1 User.where(id: [2, 8]).update_all status: 3 - get '/users.json', :headers => credentials('admin'), params: { name: 'jsmith' } + get '/users.json', headers: credentials('admin'), params: { name: 'jsmith' } assert_response :success json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') assert_equal 0, json['users'].size - get '/users.json', :headers => credentials('admin'), params: { group_id: '10' } + get '/users.json', headers: credentials('admin'), params: { group_id: '10' } assert_response :success json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') -- 2.39.5