Merge branch '21383-misc-fixes'. Refs #21383
[arvados.git] / services / api / test / test_helper.rb
index ee7dac4cd90099bb1d9b9fe17a9a781baaee5f1c..0255d8907da1ad7ee0e036509c9a19b693bdfe9c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-require 'update_permissions'
+require_relative '../lib/update_permissions'
 
 ENV["RAILS_ENV"] = "test"
 unless ENV["NO_COVERAGE_TEST"]
@@ -25,7 +25,6 @@ unless ENV["NO_COVERAGE_TEST"]
     SimpleCov.start do
       add_filter '/test/'
       add_filter 'initializers/secret_token'
-      add_filter 'initializers/omniauth'
     end
   rescue Exception => e
     $stderr.puts "SimpleCov unavailable (#{e}). Proceeding without."
@@ -180,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, **kwargs|
       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 kwargs[:params].is_a?(Hash)
+        kwargs[: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?(kwargs[:params][key].class)
+            kwargs[:params][key] = SafeJSON.dump(kwargs[:params][key])
           end
         end
       end
-      super action, *args
+      super action, **kwargs
     end
   end