14988: More deprecation warning fixes on functional tests.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Mon, 22 Apr 2019 18:56:44 +0000 (15:56 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Mon, 22 Apr 2019 18:56:44 +0000 (15:56 -0300)
There's just one pending from the wiselinks gem. Will defer fixing it because
it's not conclusive that wiselinks is compatible with rails >= 5.0 yet.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/helpers/application_helper.rb
apps/workbench/test/controllers/application_controller_test.rb
apps/workbench/test/controllers/collections_controller_test.rb
apps/workbench/test/controllers/jobs_controller_test.rb
apps/workbench/test/controllers/search_controller_test.rb
apps/workbench/test/helpers/share_object_helper.rb

index 0200a3d1edfc092f2218ed6beda356b8c742bff1..21e9b49fd800fdce05d34e3358eafc9692111e12 100644 (file)
@@ -353,6 +353,9 @@ class ApplicationController < ActionController::Base
 
   def update
     @updates ||= params[@object.resource_param_name.to_sym]
+    if @updates.is_a? ActionController::Parameters
+      @updates = @updates.to_unsafe_hash
+    end
     @updates.keys.each do |attr|
       if @object.send(attr).is_a? Hash
         if @updates[attr].is_a? String
@@ -361,6 +364,9 @@ class ApplicationController < ActionController::Base
         if params[:merge] || params["merge_#{attr}".to_sym]
           # Merge provided Hash with current Hash, instead of
           # replacing.
+          if @updates[attr].is_a? ActionController::Parameters
+            @updates[attr] = @updates[attr].to_unsafe_hash
+          end
           @updates[attr] = @object.send(attr).with_indifferent_access.
             deep_merge(@updates[attr].with_indifferent_access)
         end
index 4c4b5ff34df52c471fa2ceaf566e8f9a5b606d02..3f72d5a2aae7015f00f6a4526aed33d65c811455 100644 (file)
@@ -25,7 +25,7 @@ module ApplicationHelper
   end
 
   def human_readable_bytes_html(n)
-    return h(n) unless n.is_a? Fixnum
+    return h(n) unless n.is_a? Integer
     return "0 bytes" if (n == 0)
 
     orders = {
index 1aea54ca1a32909768230143e01622eb293bee51..1b13d8f328def28af9064afff27191a6052195fe 100644 (file)
@@ -399,7 +399,7 @@ class ApplicationControllerTest < ActionController::TestCase
       # network.  100::/64 is the IPv6 discard prefix, so it's perfect.
       Rails.configuration.arvados_v1_base = "https://[100::f]:1/"
       @controller = NodesController.new
-      get(:index, {}, session_for(:active))
+      get(:index, params: {}, session: session_for(:active))
       assert_includes(405..422, @response.code.to_i,
                       "bad response code when API server is unreachable")
     ensure
index fa81f0713dc4d4da9c4517d226e043416d6a60e2..b6995da0698c56395b7a02dd6d19602c83f824eb 100644 (file)
@@ -32,7 +32,11 @@ class CollectionsControllerTest < ActionController::TestCase
 
   def assert_hash_includes(actual_hash, expected_hash, msg=nil)
     expected_hash.each do |key, value|
-      assert_equal(value, actual_hash[key], msg)
+      if value.nil?
+        assert_nil(actual_hash[key], msg)
+      else
+        assert_equal(value, actual_hash[key], msg)
+      end
     end
   end
 
index 1182bcbdddfd973e5f9b5cb8dabf94b9e0c466b8..be876a5a4ca3e69136fd9d6bff8b1c3e13060d3c 100644 (file)
@@ -6,7 +6,7 @@ require 'test_helper'
 
 class JobsControllerTest < ActionController::TestCase
   test "visit jobs index page" do
-    get :index, {}, session_for(:active)
+    get :index, params: {}, session: session_for(:active)
     assert_response :success
   end
 
index c57d70533efa23e90a07dd64982c4c1cbcd2f655..e620fbd8617c8fd135a1d19d08706e90e2f4406d 100644 (file)
@@ -13,43 +13,43 @@ class SearchControllerTest < ActionController::TestCase
   include Rails.application.routes.url_helpers
 
   test 'Get search dialog' do
-    xhr :get, :choose, {
+    get :choose, params: {
       format: :js,
       title: 'Search',
       action_name: 'Show',
       action_href: url_for(host: 'localhost', controller: :actions, action: :show),
       action_data: {}.to_json,
-    }, session_for(:active)
+    }, session: session_for(:active), xhr: true
     assert_response :success
   end
 
   test 'Get search results for all projects' do
-    xhr :get, :choose, {
+    get :choose, params: {
       format: :json,
       partial: true,
-    }, session_for(:active)
+    }, session: session_for(:active), xhr: true
     assert_response :success
     assert_not_empty(json_response['content'],
                      'search results for all projects should not be empty')
   end
 
   test 'Get search results for empty project' do
-    xhr :get, :choose, {
+    get :choose, params: {
       format: :json,
       partial: true,
       project_uuid: api_fixture('groups')['empty_project']['uuid'],
-    }, session_for(:active)
+    }, session: session_for(:active), xhr: true
     assert_response :success
     assert_empty(json_response['content'],
                  'search results for empty project should be empty')
   end
 
   test 'search results for aproject and verify recursive contents' do
-    xhr :get, :choose, {
+    get :choose, params: {
       format: :json,
       partial: true,
       project_uuid: api_fixture('groups')['aproject']['uuid'],
-    }, session_for(:active)
+    }, session: session_for(:active), xhr: true
     assert_response :success
     assert_not_empty(json_response['content'],
                  'search results for aproject should not be empty')
index 454cb2c3689bc33373dc14a4955f2f39ba3c3ab4..e31f196498d47a3963d108d01873ba1799c323d7 100644 (file)
@@ -71,7 +71,7 @@ module ShareObjectHelper
   end
 
   def user_can_manage(user_sym, fixture)
-    get(:show, {id: fixture["uuid"]}, session_for(user_sym))
+    get(:show, params: {id: fixture["uuid"]}, session: session_for(user_sym))
     is_manager = assigns(:user_is_manager)
     assert_not_nil(is_manager, "user_is_manager flag not set")
     if not is_manager