20846: Update kwargs usage for ruby 3.
authorTom Clegg <tom@curii.com>
Tue, 24 Oct 2023 15:42:38 +0000 (11:42 -0400)
committerTom Clegg <tom@curii.com>
Fri, 27 Oct 2023 19:20:40 +0000 (15:20 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/api/app/models/container.rb
services/api/test/test_helper.rb

index ca43fde5a90d67aef3c263fafe6e827292b05271..ee338b81ffedad646854cd4b55998937551ffa59 100644 (file)
@@ -319,7 +319,7 @@ class Container < ArvadosModel
         resolved_runtime_constraints.delete('cuda')
       ].uniq
     end
-    reusable_runtime_constraints = hash_product(runtime_constraint_variations)
+    reusable_runtime_constraints = hash_product(**runtime_constraint_variations)
                                      .map { |v| resolved_runtime_constraints.merge(v) }
 
     candidates = candidates.where_serialized(:runtime_constraints, reusable_runtime_constraints, md5: true, multivalue: true)
index 08696a99835e61865033a1222636fc905525f7de..e907367446a9d676c4e965b845991de8fbe425dd 100644 (file)
@@ -179,21 +179,21 @@ class ActionController::TestCase
   end
 
   [:get, :post, :put, :patch, :delete].each do |method|
-    define_method method do |action, *args|
+    define_method method do |action, **args|
       check_counter action
       # After Rails 5.0 upgrade, some params don't get properly serialized.
       # One case are filters: [['attr', 'op', 'val']] become [['attr'], ['op'], ['val']]
       # if not passed upstream as a JSON string.
-      if args[0].is_a?(Hash) && args[0][:params].is_a?(Hash)
-        args[0][:params].each do |key, _|
+      if args[:params].is_a?(Hash)
+        args[:params].each do |key, _|
           next if key == :exclude_script_versions # Job Reuse tests
           # Keys could be: :filters, :where, etc
-          if [Array, Hash].include?(args[0][:params][key].class)
-            args[0][:params][key] = SafeJSON.dump(args[0][:params][key])
+          if [Array, Hash].include?(args[:params][key].class)
+            args[:params][key] = SafeJSON.dump(args[:params][key])
           end
         end
       end
-      super action, *args
+      super action, **args
     end
   end