Merge branch 'master' into 14988-wb-rails5-upgrade
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 8 May 2019 19:25:57 +0000 (16:25 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 8 May 2019 19:25:57 +0000 (16:25 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

75 files changed:
apps/workbench/Gemfile
apps/workbench/Gemfile.lock
apps/workbench/app/assets/javascripts/application.js
apps/workbench/app/controllers/actions_controller.rb
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/collections_controller.rb
apps/workbench/app/controllers/container_requests_controller.rb
apps/workbench/app/controllers/containers_controller.rb
apps/workbench/app/controllers/healthcheck_controller.rb
apps/workbench/app/controllers/jobs_controller.rb
apps/workbench/app/controllers/logs_controller.rb
apps/workbench/app/controllers/pipeline_instances_controller.rb
apps/workbench/app/controllers/pipeline_templates_controller.rb
apps/workbench/app/controllers/projects_controller.rb
apps/workbench/app/controllers/repositories_controller.rb
apps/workbench/app/controllers/search_controller.rb
apps/workbench/app/controllers/sessions_controller.rb
apps/workbench/app/controllers/status_controller.rb
apps/workbench/app/controllers/tests_controller.rb
apps/workbench/app/controllers/user_agreements_controller.rb
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/controllers/websocket_controller.rb
apps/workbench/app/controllers/work_units_controller.rb
apps/workbench/app/controllers/workflows_controller.rb
apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/models/application_record.rb [new file with mode: 0644]
apps/workbench/app/models/arvados_base.rb
apps/workbench/app/models/user.rb
apps/workbench/app/views/application/_content.html.erb
apps/workbench/app/views/jobs/show.html.erb
apps/workbench/app/views/pipeline_instances/show.html.erb
apps/workbench/bin/bundle [new file with mode: 0755]
apps/workbench/bin/rails [new file with mode: 0755]
apps/workbench/bin/rake [new file with mode: 0755]
apps/workbench/bin/setup [new file with mode: 0755]
apps/workbench/bin/update [new file with mode: 0755]
apps/workbench/config/application.default.yml
apps/workbench/config/application.rb
apps/workbench/config/cable.yml [new file with mode: 0644]
apps/workbench/config/environment.rb
apps/workbench/config/environments/production.rb.example
apps/workbench/config/environments/test.rb.example
apps/workbench/config/initializers/application_controller_renderer.rb [new file with mode: 0644]
apps/workbench/config/initializers/assets.rb [new file with mode: 0644]
apps/workbench/config/initializers/cookies_serializer.rb [new file with mode: 0644]
apps/workbench/config/initializers/filter_parameter_logging.rb [new file with mode: 0644]
apps/workbench/config/initializers/new_framework_defaults.rb [new file with mode: 0644]
apps/workbench/config/initializers/session_store.rb
apps/workbench/config/puma.rb [new file with mode: 0644]
apps/workbench/config/secrets.yml [new file with mode: 0644]
apps/workbench/config/spring.rb [new file with mode: 0644]
apps/workbench/test/controllers/actions_controller_test.rb
apps/workbench/test/controllers/application_controller_test.rb
apps/workbench/test/controllers/collections_controller_test.rb
apps/workbench/test/controllers/container_requests_controller_test.rb
apps/workbench/test/controllers/containers_controller_test.rb
apps/workbench/test/controllers/disabled_api_test.rb
apps/workbench/test/controllers/jobs_controller_test.rb
apps/workbench/test/controllers/pipeline_instances_controller_test.rb
apps/workbench/test/controllers/pipeline_templates_controller_test.rb
apps/workbench/test/controllers/projects_controller_test.rb
apps/workbench/test/controllers/repositories_controller_test.rb
apps/workbench/test/controllers/search_controller_test.rb
apps/workbench/test/controllers/trash_items_controller_test.rb
apps/workbench/test/controllers/user_agreements_controller_test.rb
apps/workbench/test/controllers/users_controller_test.rb
apps/workbench/test/controllers/work_units_controller_test.rb
apps/workbench/test/controllers/workflows_controller_test.rb
apps/workbench/test/functional/.gitkeep [new file with mode: 0644]
apps/workbench/test/helpers/share_object_helper.rb
apps/workbench/test/mailers/.gitkeep [new file with mode: 0644]
apps/workbench/test/models/.gitkeep [new file with mode: 0644]
apps/workbench/test/test_helper.rb
apps/workbench/test/unit/work_unit_test.rb
build/run-tests.sh

index 7150faa9e12767db52ae6d11416122038c8875cd..0be9a3a4123ddb1b96fa9415d032ead462df255c 100644 (file)
@@ -4,10 +4,10 @@
 
 source 'https://rubygems.org'
 
-gem 'rails', '~> 4.2.0'
+gem 'rails', '~> 5.0.0'
 gem 'arvados', '>= 0.1.20150511150219'
 
-gem 'activerecord-nulldb-adapter'
+gem 'activerecord-nulldb-adapter', git: 'https://github.com/curoverse/nulldb'
 gem 'multi_json'
 gem 'oj'
 gem 'sass'
@@ -24,7 +24,7 @@ gem 'coffee-rails'
 # Gems used only for assets and not required
 # in production environments by default.
 group :assets do
-  gem 'sass-rails'
+  gem 'sassc-rails'
   gem 'uglifier', '~> 2.0'
 
   # See https://github.com/sstephenson/execjs#readme for more supported runtimes
@@ -48,6 +48,7 @@ group :test, :diagnostics, :performance do
 end
 
 group :test, :performance do
+  gem 'byebug'
   gem 'rails-perftest'
   gem 'ruby-prof'
   gem 'rvm-capistrano'
@@ -57,6 +58,7 @@ group :test, :performance do
   gem 'simplecov', '~> 0.7', require: false
   gem 'simplecov-rcov', require: false
   gem 'mocha', require: false
+  gem 'rails-controller-testing'
 end
 
 gem 'jquery-rails'
@@ -68,7 +70,12 @@ gem 'angularjs-rails', '~> 1.3.8'
 
 gem 'less'
 gem 'less-rails'
-gem 'wiselinks'
+
+# Wiselinks hasn't been updated for many years and it's using deprecated methods
+# Use our own Wiselinks fork until this PR is accepted:
+# https://github.com/igor-alexandrov/wiselinks/pull/116
+# gem 'wiselinks', git: 'https://github.com/curoverse/wiselinks.git', branch: 'rails-5.1-compatibility'
+
 gem 'sshkey'
 
 # To use ActiveModel has_secure_password
index cc45ca66f2cb9bb9f09efa4269f7533fe572bdb0..e39f2077602b64c95919f99d39911fe4c2510474 100644 (file)
@@ -1,6 +1,13 @@
+GIT
+  remote: https://github.com/curoverse/nulldb
+  revision: d8e0073b665acdd2537c5eb15178a60f02f4b413
+  specs:
+    activerecord-nulldb-adapter (0.3.9)
+      activerecord (>= 2.0.0)
+
 GIT
   remote: https://github.com/curoverse/themes_for_rails
-  revision: 61154877047d2346890bda0b7be5827cf51a6a76
+  revision: ddf6e592b3b6493ea0c2de7b5d3faa120ed35be0
   specs:
     themes_for_rails (0.5.1)
       rails (>= 3.0.0)
@@ -9,54 +16,66 @@ GEM
   remote: https://rubygems.org/
   specs:
     RedCloth (4.3.2)
-    actionmailer (4.2.11)
-      actionpack (= 4.2.11)
-      actionview (= 4.2.11)
-      activejob (= 4.2.11)
+    actioncable (5.0.7.2)
+      actionpack (= 5.0.7.2)
+      nio4r (>= 1.2, < 3.0)
+      websocket-driver (~> 0.6.1)
+    actionmailer (5.0.7.2)
+      actionpack (= 5.0.7.2)
+      actionview (= 5.0.7.2)
+      activejob (= 5.0.7.2)
       mail (~> 2.5, >= 2.5.4)
-      rails-dom-testing (~> 1.0, >= 1.0.5)
-    actionpack (4.2.11)
-      actionview (= 4.2.11)
-      activesupport (= 4.2.11)
-      rack (~> 1.6)
-      rack-test (~> 0.6.2)
-      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-dom-testing (~> 2.0)
+    actionpack (5.0.7.2)
+      actionview (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      rack (~> 2.0)
+      rack-test (~> 0.6.3)
+      rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.2)
-    actionview (4.2.11)
-      activesupport (= 4.2.11)
+    actionview (5.0.7.2)
+      activesupport (= 5.0.7.2)
       builder (~> 3.1)
       erubis (~> 2.7.0)
-      rails-dom-testing (~> 1.0, >= 1.0.5)
+      rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.3)
-    activejob (4.2.11)
-      activesupport (= 4.2.11)
-      globalid (>= 0.3.0)
-    activemodel (4.2.11)
-      activesupport (= 4.2.11)
-      builder (~> 3.1)
-    activerecord (4.2.11)
-      activemodel (= 4.2.11)
-      activesupport (= 4.2.11)
-      arel (~> 6.0)
-    activerecord-nulldb-adapter (0.3.8)
-      activerecord (>= 2.0.0)
-    activesupport (4.2.11)
-      i18n (~> 0.7)
+    activejob (5.0.7.2)
+      activesupport (= 5.0.7.2)
+      globalid (>= 0.3.6)
+    activemodel (5.0.7.2)
+      activesupport (= 5.0.7.2)
+    activerecord (5.0.7.2)
+      activemodel (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      arel (~> 7.0)
+    activesupport (5.0.7.2)
+      concurrent-ruby (~> 1.0, >= 1.0.2)
+      i18n (>= 0.7, < 2)
       minitest (~> 5.1)
-      thread_safe (~> 0.3, >= 0.3.4)
       tzinfo (~> 1.1)
-    addressable (2.5.2)
+    addressable (2.6.0)
       public_suffix (>= 2.0.2, < 4.0)
     andand (1.3.3)
     angularjs-rails (1.3.15)
-    arel (6.0.4)
-    arvados (0.1.20180302192246)
+    arel (7.1.4)
+    arvados (1.3.1.20190320201707)
       activesupport (>= 3)
       andand (~> 1.3, >= 1.3.3)
-      google-api-client (>= 0.7, < 0.8.9)
+      arvados-google-api-client (>= 0.7, < 0.8.9)
       i18n (~> 0)
       json (>= 1.7.7, < 3)
       jwt (>= 0.1.5, < 2)
+    arvados-google-api-client (0.8.7.2)
+      activesupport (>= 3.2, < 5.1)
+      addressable (~> 2.3)
+      autoparse (~> 0.3)
+      extlib (~> 0.9)
+      faraday (~> 0.9)
+      googleauth (~> 0.3)
+      launchy (~> 2.4)
+      multi_json (~> 1.10)
+      retriable (~> 1.4)
+      signet (~> 0.6)
     autoparse (0.3.3)
       addressable (>= 2.3.1)
       extlib (>= 0.9.15)
@@ -68,7 +87,7 @@ GEM
     bootstrap-x-editable-rails (1.5.1.1)
       railties (>= 3.0)
     builder (3.2.3)
-    byebug (10.0.0)
+    byebug (11.0.1)
     capistrano (2.15.9)
       highline
       net-scp (>= 1.0.0)
@@ -92,65 +111,47 @@ GEM
       execjs
     coffee-script-source (1.12.2)
     commonjs (0.2.7)
-    concurrent-ruby (1.1.4)
+    concurrent-ruby (1.1.5)
     crass (1.0.4)
     deep_merge (1.2.1)
-    docile (1.1.5)
+    docile (1.3.1)
     erubis (2.7.0)
     execjs (2.7.0)
     extlib (0.9.16)
-    faraday (0.14.0)
+    faraday (0.15.4)
       multipart-post (>= 1.2, < 3)
-    ffi (1.9.25)
+    ffi (1.10.0)
     flamegraph (0.9.5)
-    globalid (0.4.1)
+    globalid (0.4.2)
       activesupport (>= 4.2.0)
-    google-api-client (0.8.7)
-      activesupport (>= 3.2, < 5.0)
-      addressable (~> 2.3)
-      autoparse (~> 0.3)
-      extlib (~> 0.9)
-      faraday (~> 0.9)
-      googleauth (~> 0.3)
-      launchy (~> 2.4)
-      multi_json (~> 1.10)
-      retriable (~> 1.4)
-      signet (~> 0.6)
-    googleauth (0.6.2)
+    googleauth (0.8.1)
       faraday (~> 0.12)
       jwt (>= 1.4, < 3.0)
-      logging (~> 2.0)
-      memoist (~> 0.12)
+      memoist (~> 0.16)
       multi_json (~> 1.11)
-      os (~> 0.9)
+      os (>= 0.9, < 2.0)
       signet (~> 0.7)
-    grease (0.3.1)
     headless (1.0.2)
-    highline (1.7.10)
+    highline (2.0.2)
     httpclient (2.8.3)
     i18n (0.9.5)
       concurrent-ruby (~> 1.0)
-    jquery-rails (3.1.4)
-      railties (>= 3.0, < 5.0)
+    jquery-rails (4.3.3)
+      rails-dom-testing (>= 1, < 3)
+      railties (>= 4.2.0)
       thor (>= 0.14, < 2.0)
-    json (2.1.0)
+    json (2.2.0)
     jwt (1.5.6)
     launchy (2.4.3)
       addressable (~> 2.3)
     less (2.6.0)
       commonjs (~> 0.2.7)
-    less-rails (3.0.0)
-      actionpack (>= 4.0)
-      grease
+    less-rails (4.0.0)
+      actionpack (>= 4)
       less (~> 2.6.0)
-      sprockets (> 2, < 4)
-      tilt
+      sprockets (>= 2)
     libv8 (3.16.14.19)
-    little-plugger (1.1.4)
-    logging (2.2.2)
-      little-plugger (~> 1.1)
-      multi_json (~> 1.10)
-    lograge (0.9.0)
+    lograge (0.10.0)
       actionpack (>= 4)
       activesupport (>= 4)
       railties (>= 4)
@@ -163,32 +164,34 @@ GEM
       mini_mime (>= 0.1.1)
     memoist (0.16.0)
     metaclass (0.0.4)
-    mime-types (3.1)
+    method_source (0.9.2)
+    mime-types (3.2.2)
       mime-types-data (~> 3.2015)
-    mime-types-data (3.2016.0521)
+    mime-types-data (3.2019.0331)
     mini_mime (1.0.1)
     mini_portile2 (2.4.0)
     minitest (5.10.3)
-    mocha (1.3.0)
+    mocha (1.8.0)
       metaclass (~> 0.0.1)
     morrisjs-rails (0.5.1.2)
       railties (> 3.1, < 6)
     multi_json (1.13.1)
     multipart-post (2.0.0)
-    net-scp (1.2.1)
-      net-ssh (>= 2.6.5)
+    net-scp (2.0.0)
+      net-ssh (>= 2.6.5, < 6.0.0)
     net-sftp (2.1.2)
       net-ssh (>= 2.6.5)
-    net-ssh (4.2.0)
+    net-ssh (5.2.0)
     net-ssh-gateway (2.0.0)
       net-ssh (>= 4.0.0)
-    nokogiri (1.9.1)
+    nio4r (2.3.1)
+    nokogiri (1.10.2)
       mini_portile2 (~> 2.4.0)
     npm-rails (0.2.1)
       rails (>= 3.2)
-    oj (3.6.4)
-    os (0.9.6)
-    passenger (5.2.1)
+    oj (3.7.11)
+    os (1.0.0)
+    passenger (6.0.2)
       rack
       rake (>= 0.8.1)
     piwik_analytics (1.0.2)
@@ -200,76 +203,82 @@ GEM
       cliver (~> 0.3.1)
       multi_json (~> 1.0)
       websocket-driver (>= 0.2.0)
-    public_suffix (3.0.2)
-    rack (1.6.11)
-    rack-mini-profiler (0.10.7)
+    public_suffix (3.0.3)
+    rack (2.0.7)
+    rack-mini-profiler (1.0.2)
       rack (>= 1.2.0)
     rack-test (0.6.3)
       rack (>= 1.0)
-    rails (4.2.11)
-      actionmailer (= 4.2.11)
-      actionpack (= 4.2.11)
-      actionview (= 4.2.11)
-      activejob (= 4.2.11)
-      activemodel (= 4.2.11)
-      activerecord (= 4.2.11)
-      activesupport (= 4.2.11)
-      bundler (>= 1.3.0, < 2.0)
-      railties (= 4.2.11)
-      sprockets-rails
-    rails-deprecated_sanitizer (1.0.3)
-      activesupport (>= 4.2.0.alpha)
-    rails-dom-testing (1.0.9)
-      activesupport (>= 4.2.0, < 5.0)
-      nokogiri (~> 1.6)
-      rails-deprecated_sanitizer (>= 1.0.1)
+    rails (5.0.7.2)
+      actioncable (= 5.0.7.2)
+      actionmailer (= 5.0.7.2)
+      actionpack (= 5.0.7.2)
+      actionview (= 5.0.7.2)
+      activejob (= 5.0.7.2)
+      activemodel (= 5.0.7.2)
+      activerecord (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      bundler (>= 1.3.0)
+      railties (= 5.0.7.2)
+      sprockets-rails (>= 2.0.0)
+    rails-controller-testing (1.0.4)
+      actionpack (>= 5.0.1.x)
+      actionview (>= 5.0.1.x)
+      activesupport (>= 5.0.1.x)
+    rails-dom-testing (2.0.3)
+      activesupport (>= 4.2.0)
+      nokogiri (>= 1.6)
     rails-html-sanitizer (1.0.4)
       loofah (~> 2.2, >= 2.2.2)
     rails-perftest (0.0.7)
-    railties (4.2.11)
-      actionpack (= 4.2.11)
-      activesupport (= 4.2.11)
+    railties (5.0.7.2)
+      actionpack (= 5.0.7.2)
+      activesupport (= 5.0.7.2)
+      method_source
       rake (>= 0.8.7)
       thor (>= 0.18.1, < 2.0)
     rake (12.3.2)
     raphael-rails (2.1.2)
     rb-fsevent (0.10.3)
-    rb-inotify (0.9.10)
-      ffi (>= 0.5.0, < 2)
+    rb-inotify (0.10.0)
+      ffi (~> 1.0)
     ref (2.0.0)
-    request_store (1.4.0)
+    request_store (1.4.1)
       rack (>= 1.4)
-    responders (2.4.0)
-      actionpack (>= 4.2.0, < 5.3)
-      railties (>= 4.2.0, < 5.3)
+    responders (2.4.1)
+      actionpack (>= 4.2.0, < 6.0)
+      railties (>= 4.2.0, < 6.0)
     retriable (1.4.1)
     ruby-debug-passenger (0.2.0)
     ruby-prof (0.17.0)
     rubyzip (1.2.2)
     rvm-capistrano (1.5.6)
       capistrano (~> 2.15.4)
-    safe_yaml (1.0.4)
-    sass (3.5.5)
+    safe_yaml (1.0.5)
+    sass (3.7.4)
       sass-listen (~> 4.0.0)
     sass-listen (4.0.0)
       rb-fsevent (~> 0.9, >= 0.9.4)
       rb-inotify (~> 0.9, >= 0.9.7)
-    sass-rails (5.0.7)
-      railties (>= 4.0.0, < 6)
-      sass (~> 3.1)
-      sprockets (>= 2.8, < 4.0)
-      sprockets-rails (>= 2.0, < 4.0)
-      tilt (>= 1.1, < 3)
-    selenium-webdriver (3.14.1)
+    sassc (2.0.1)
+      ffi (~> 1.9)
+      rake
+    sassc-rails (2.1.0)
+      railties (>= 4.0.0)
+      sassc (>= 2.0)
+      sprockets (> 3.0)
+      sprockets-rails
+      tilt
+    selenium-webdriver (3.141.0)
       childprocess (~> 0.5)
       rubyzip (~> 1.2, >= 1.2.2)
-    signet (0.8.1)
+    signet (0.11.0)
       addressable (~> 2.3)
       faraday (~> 0.9)
       jwt (>= 1.5, < 3.0)
       multi_json (~> 1.10)
-    simplecov (0.15.1)
-      docile (~> 1.1.0)
+    simplecov (0.16.1)
+      docile (~> 1.1)
       json (>= 1.8, < 3)
       simplecov-html (~> 0.10.0)
     simplecov-html (0.10.2)
@@ -282,22 +291,21 @@ GEM
       actionpack (>= 4.0)
       activesupport (>= 4.0)
       sprockets (>= 3.0.0)
-    sshkey (1.9.0)
+    sshkey (2.0.0)
     therubyracer (0.12.3)
       libv8 (~> 3.16.14.15)
       ref
     thor (0.20.3)
     thread_safe (0.3.6)
-    tilt (2.0.8)
+    tilt (2.0.9)
     tzinfo (1.2.5)
       thread_safe (~> 0.1)
     uglifier (2.7.2)
       execjs (>= 0.3.0)
       json (>= 1.8.0)
-    websocket-driver (0.7.0)
+    websocket-driver (0.6.5)
       websocket-extensions (>= 0.1.0)
     websocket-extensions (0.1.3)
-    wiselinks (1.2.1)
     xpath (2.1.0)
       nokogiri (~> 1.3)
 
@@ -306,7 +314,7 @@ PLATFORMS
 
 DEPENDENCIES
   RedCloth
-  activerecord-nulldb-adapter
+  activerecord-nulldb-adapter!
   andand
   angularjs-rails (~> 1.3.8)
   arvados (>= 0.1.20150511150219)
@@ -336,7 +344,8 @@ DEPENDENCIES
   piwik_analytics
   poltergeist (~> 1.5.1)
   rack-mini-profiler
-  rails (~> 4.2.0)
+  rails (~> 5.0.0)
+  rails-controller-testing
   rails-perftest
   raphael-rails
   responders (~> 2.0)
@@ -345,7 +354,7 @@ DEPENDENCIES
   rvm-capistrano
   safe_yaml
   sass
-  sass-rails
+  sassc-rails
   selenium-webdriver (~> 3)
   simplecov (~> 0.7)
   simplecov-rcov
@@ -353,7 +362,6 @@ DEPENDENCIES
   themes_for_rails!
   therubyracer
   uglifier (~> 2.0)
-  wiselinks
 
 BUNDLED WITH
-   1.17.2
+   1.17.3
index 270a4c766d3152f3edd487561cc40ae4e2bdb256..1898128133535014f795bafaee942e10c6ff058d 100644 (file)
@@ -26,7 +26,6 @@
 //= require bootstrap/button
 //= require bootstrap3-editable/bootstrap-editable
 //= require bootstrap-tab-history
-//= require wiselinks
 //= require angular
 //= require raphael
 //= require morris
index beeae0760c21dfe2558483176000347c25167ad9..4f77a1be477e4f17046e8a243e65831c17122789 100644 (file)
@@ -8,14 +8,14 @@ class ActionsController < ApplicationController
 
   # Skip require_thread_api_token if this is a show action
   # for an object uuid that supports anonymous access.
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name and
     params['uuid'] and
     model_class.in?([Collection, Group, Job, PipelineInstance, PipelineTemplate])
   }
-  skip_filter :require_thread_api_token, only: [:report_issue_popup, :report_issue]
-  skip_filter :check_user_agreements, only: [:report_issue_popup, :report_issue]
+  skip_around_action :require_thread_api_token, only: [:report_issue_popup, :report_issue]
+  skip_before_action :check_user_agreements, only: [:report_issue_popup, :report_issue]
 
   @@exposed_actions = {}
   def self.expose_action method, &block
@@ -203,7 +203,7 @@ You can try recreating the collection to get a copy with full provenance data."
 
     respond_to do |format|
       IssueReporter.send_report(current_user, params).deliver
-      format.js {render nothing: true}
+      format.js {render body: nil}
     end
   end
 
index 8d9e8578c529a618678f9a8136d8472ae81021ff..21e9b49fd800fdce05d34e3358eafc9692111e12 100644 (file)
@@ -11,19 +11,19 @@ class ApplicationController < ActionController::Base
 
   ERROR_ACTIONS = [:render_error, :render_not_found]
 
-  around_filter :thread_clear
-  around_filter :set_current_request_id
-  around_filter :set_thread_api_token
+  around_action :thread_clear
+  around_action :set_current_request_id
+  around_action :set_thread_api_token
   # Methods that don't require login should
-  #   skip_around_filter :require_thread_api_token
-  around_filter :require_thread_api_token, except: ERROR_ACTIONS
-  before_filter :ensure_arvados_api_exists, only: [:index, :show]
-  before_filter :set_cache_buster
-  before_filter :accept_uuid_as_id_param, except: ERROR_ACTIONS
-  before_filter :check_user_agreements, except: ERROR_ACTIONS
-  before_filter :check_user_profile, except: ERROR_ACTIONS
-  before_filter :load_filters_and_paging_params, except: ERROR_ACTIONS
-  before_filter :find_object_by_uuid, except: [:create, :index, :choose] + ERROR_ACTIONS
+  #   skip_around_action :require_thread_api_token
+  around_action :require_thread_api_token, except: ERROR_ACTIONS
+  before_action :ensure_arvados_api_exists, only: [:index, :show]
+  before_action :set_cache_buster
+  before_action :accept_uuid_as_id_param, except: ERROR_ACTIONS
+  before_action :check_user_agreements, except: ERROR_ACTIONS
+  before_action :check_user_profile, except: ERROR_ACTIONS
+  before_action :load_filters_and_paging_params, except: ERROR_ACTIONS
+  before_action :find_object_by_uuid, except: [:create, :index, :choose] + ERROR_ACTIONS
   theme :select_theme
 
   begin
@@ -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 0a7f22b95789edc163198fbf32ab55045317f298..8d7e6ee332af5e3cf53dac674e6185626f43d413 100644 (file)
@@ -9,17 +9,17 @@ require "uri"
 class CollectionsController < ApplicationController
   include ActionController::Live
 
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name
   }
-  skip_around_filter(:require_thread_api_token,
+  skip_around_action(:require_thread_api_token,
                      only: [:show_file, :show_file_links])
-  skip_before_filter(:find_object_by_uuid,
+  skip_before_action(:find_object_by_uuid,
                      only: [:provenance, :show_file, :show_file_links])
   # We depend on show_file to display the user agreement:
-  skip_before_filter :check_user_agreements, only: :show_file
-  skip_before_filter :check_user_profile, only: :show_file
+  skip_before_action :check_user_agreements, only: :show_file
+  skip_before_action :check_user_profile, only: :show_file
 
   RELATION_LIMIT = 5
 
@@ -265,7 +265,7 @@ class CollectionsController < ApplicationController
   end
 
   def update
-    updated_attr = params[:collection].each.select {|a| a[0].andand.start_with? 'rename-file-path:'}
+    updated_attr = params[:collection].to_unsafe_hash.each.select {|a| a[0].andand.start_with? 'rename-file-path:'}
 
     if updated_attr.size > 0
       # Is it file rename?
index 454be448d9d1e7afad061ac983cd38780abd1365..d5627076f5e1d0b0dee23531fbe884dacb16aa64 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class ContainerRequestsController < ApplicationController
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name
   }
index f0e31644f1ba0b5ba8db27ef007be63382c16455..a8549cd5b82e8b9e82420d7f7478b2c3a9660247 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class ContainersController < ApplicationController
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name
   }
index 60043d9024c223558cabc9cfc51a1d2522e6e1f4..7afe4032a2c19f726465e8aae7b1f6cdf55dafc0 100644 (file)
@@ -3,17 +3,17 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class HealthcheckController < ApplicationController
-  skip_around_filter :thread_clear
-  skip_around_filter :set_thread_api_token
-  skip_around_filter :require_thread_api_token
-  skip_before_filter :ensure_arvados_api_exists
-  skip_before_filter :accept_uuid_as_id_param
-  skip_before_filter :check_user_agreements
-  skip_before_filter :check_user_profile
-  skip_before_filter :load_filters_and_paging_params
-  skip_before_filter :find_object_by_uuid
+  skip_around_action :thread_clear
+  skip_around_action :set_thread_api_token
+  skip_around_action :require_thread_api_token
+  skip_before_action :ensure_arvados_api_exists
+  skip_before_action :accept_uuid_as_id_param
+  skip_before_action :check_user_agreements
+  skip_before_action :check_user_profile
+  skip_before_action :load_filters_and_paging_params
+  skip_before_action :find_object_by_uuid
 
-  before_filter :check_auth_header
+  before_action :check_auth_header
 
   def check_auth_header
     mgmt_token = Rails.configuration.ManagementToken
index 204dbb76dfa545a19a3c3124b91acd58b6b77607..e38d3ba87b3e40e6df08e4d6150a2a3c392220a7 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class JobsController < ApplicationController
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name
   }
index 512f0a32e710e9037c167c05676733d5aa373cd3..7e413284bbc3ebb421434fc7e0748d0c897a7593 100644 (file)
@@ -3,5 +3,5 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class LogsController < ApplicationController
-  before_filter :ensure_current_user_is_admin
+  before_action :ensure_current_user_is_admin
 end
index 93bb86961386c1e9a299ec93057b2c046b1080bc..ab0e55b22a1a7c73aac99dcc5411641c7ada20a3 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class PipelineInstancesController < ApplicationController
-  skip_before_filter :find_object_by_uuid, only: :compare
-  before_filter :find_objects_by_uuid, only: :compare
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_before_action :find_object_by_uuid, only: :compare
+  before_action :find_objects_by_uuid, only: :compare
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name
   }
index 7d94e3469a10792f148a32e5c3a84e67c564dbc4..c497c70d434c4b67edb1dab42c2558bdd8242b16 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class PipelineTemplatesController < ApplicationController
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name
   }
index 4a7563a959d88cf70157c0b686c734ad7a66c6ff..cc657cbad92406d9887eb5f0a2173415aa8ff51e 100644 (file)
@@ -3,8 +3,8 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class ProjectsController < ApplicationController
-  before_filter :set_share_links, if: -> { defined? @object and @object}
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  before_action :set_share_links, if: -> { defined? @object and @object}
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     %w(show tab_counts public).include? ctrl.action_name
   }
index 5ca6f22b02f54bf2ea3b213b7106717cd10c845b..6ef541ebab23a23159d834ef117692812daa5f9e 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class RepositoriesController < ApplicationController
-  before_filter :set_share_links, if: -> { defined? @object }
+  before_action :set_share_links, if: -> { defined? @object }
 
   def index_pane_list
     %w(repositories help)
index 3775abd1ae9f1117926d7bde8c847fc32ad0cd60..80f3ff117a583c3e6b96df76b08f6d75e5dc4cd9 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class SearchController < ApplicationController
-  skip_before_filter :ensure_arvados_api_exists
+  skip_before_action :ensure_arvados_api_exists
 
   def find_objects_for_index
     search_what = Group
index 48fbc6bd04a708326d2dfe0f01afd5ae5383c12f..bff0f9f1c96ed8267470c350e24f92d268f5baf5 100644 (file)
@@ -3,11 +3,11 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class SessionsController < ApplicationController
-  skip_around_filter :require_thread_api_token, :only => [:destroy, :logged_out]
-  skip_around_filter :set_thread_api_token, :only => [:destroy, :logged_out]
-  skip_before_filter :find_object_by_uuid
-  skip_before_filter :find_objects_for_index
-  skip_before_filter :ensure_arvados_api_exists
+  skip_around_action :require_thread_api_token, :only => [:destroy, :logged_out]
+  skip_around_action :set_thread_api_token, :only => [:destroy, :logged_out]
+  skip_before_action :find_object_by_uuid
+  skip_before_action :find_objects_for_index, raise: false
+  skip_before_action :ensure_arvados_api_exists
 
   def destroy
     session.clear
index 90b7be564d4d12c5d8c593ea0ec0040a16a1c9a4..0a8fb5a282c5872b2b20b66cb4ee3dfb7f71a152 100644 (file)
@@ -3,8 +3,8 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class StatusController < ApplicationController
-  skip_around_filter :require_thread_api_token
-  skip_before_filter :find_object_by_uuid
+  skip_around_action :require_thread_api_token
+  skip_before_action :find_object_by_uuid
   def status
     # Allow non-credentialed cross-origin requests
     headers['Access-Control-Allow-Origin'] = '*'
index 5d2de4e5a974698455a91925c591c1391e5fccb4..73c1f4f34a6b2e8a760d5dad03bfc074e699b769 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class TestsController < ApplicationController
-  skip_before_filter :find_object_by_uuid
+  skip_before_action :find_object_by_uuid
   def mithril
   end
 end
index 2797c4c682fae377d92891a5072bea656148a900..bdfaa240335922e3b616bf4c10d791f34ded70ac 100644 (file)
@@ -3,9 +3,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class UserAgreementsController < ApplicationController
-  skip_before_filter :check_user_agreements
-  skip_before_filter :find_object_by_uuid
-  skip_before_filter :check_user_profile
+  skip_before_action :check_user_agreements
+  skip_before_action :find_object_by_uuid
+  skip_before_action :check_user_profile
 
   def index
     if unsigned_user_agreements.empty?
index c954944e0b4b8ad75ff75a805caf2927893a8c50..d934af796509e2c172dcda8d2941daf889acd716 100644 (file)
@@ -3,11 +3,11 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class UsersController < ApplicationController
-  skip_around_filter :require_thread_api_token, only: :welcome
-  skip_before_filter :check_user_agreements, only: [:welcome, :inactive, :link_account, :merge]
-  skip_before_filter :check_user_profile, only: [:welcome, :inactive, :profile, :link_account, :merge]
-  skip_before_filter :find_object_by_uuid, only: [:welcome, :activity, :storage]
-  before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
+  skip_around_action :require_thread_api_token, only: :welcome
+  skip_before_action :check_user_agreements, only: [:welcome, :inactive, :link_account, :merge]
+  skip_before_action :check_user_profile, only: [:welcome, :inactive, :profile, :link_account, :merge]
+  skip_before_action :find_object_by_uuid, only: [:welcome, :activity, :storage]
+  before_action :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
 
   def show
     if params[:uuid] == current_user.uuid
index e6fa5afade6180d1c2d65757b7518a84e06dd6d3..35993dc20edfcbb3e0397979a790c68177aa7cea 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class WebsocketController < ApplicationController
-  skip_before_filter :find_objects_for_index
+  skip_before_action :find_objects_for_index, raise: false
 
   def index
   end
index d3ded867c198f5c265fafb7b49a89d50e1515fc9..0f0033ce4965663ef76a7f2e479d8e38d7642dfb 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class WorkUnitsController < ApplicationController
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show_child_component' == ctrl.action_name
   }
index 3b98413e23a2224ef8da829f3ba8c6255d1adced..b7f99e855e69dab591e633d9a07a54baa6f03282 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 class WorkflowsController < ApplicationController
-  skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+  skip_around_action :require_thread_api_token, if: proc { |ctrl|
     Rails.configuration.anonymous_user_token and
     'show' == ctrl.action_name
   }
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 = {
diff --git a/apps/workbench/app/models/application_record.rb b/apps/workbench/app/models/application_record.rb
new file mode 100644 (file)
index 0000000..759034d
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class ApplicationRecord < ActiveRecord::Base
+  self.abstract_class = true
+end
\ No newline at end of file
index d7a65bdcee182d61aa47fe56bd4f648811de012d..a25d8ae01b232df58a63d4832a42e997de72f887 100644 (file)
@@ -2,11 +2,53 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-class ArvadosBase < ActiveRecord::Base
-  self.abstract_class = true
+class ArvadosBase
+  include ActiveModel::Validations
+  include ActiveModel::Conversion
+  include ActiveModel::Serialization
+  include ActiveModel::Dirty
+  include ActiveModel::AttributeAssignment
+  extend ActiveModel::Naming
+
+  Column = Struct.new("Column", :name)
+
   attr_accessor :attribute_sortkey
   attr_accessor :create_params
 
+  class Error < StandardError; end
+
+  module Type
+    class Hash < ActiveModel::Type::Value
+      def type
+        :hash
+      end
+
+      def default_value
+        {}
+      end
+
+      private
+      def cast_value(value)
+        (value.class == String) ? ::JSON.parse(value) : value
+      end
+    end
+
+    class Array < ActiveModel::Type::Value
+      def type
+        :array
+      end
+
+      def default_value
+        []
+      end
+
+      private
+      def cast_value(value)
+        (value.class == String) ? ::JSON.parse(value) : value
+      end
+    end
+  end
+
   def self.arvados_api_client
     ArvadosApiClient.new_or_current
   end
@@ -35,7 +77,7 @@ class ArvadosBase < ActiveRecord::Base
   end
 
   def initialize raw_params={}, create_params={}
-    super self.class.permit_attribute_params(raw_params)
+    self.class.permit_attribute_params(raw_params)
     @create_params = create_params
     @attribute_sortkey ||= {
       'id' => nil,
@@ -58,6 +100,10 @@ class ArvadosBase < ActiveRecord::Base
       'uuid' => '999',
     }
     @loaded_attributes = {}
+    attributes = self.class.columns.map { |c| [c.name.to_sym, nil] }.to_h.merge(raw_params)
+    attributes.symbolize_keys.each do |name, value|
+      send("#{name}=", value)
+    end
   end
 
   def self.columns
@@ -77,29 +123,70 @@ class ArvadosBase < ActiveRecord::Base
         else
           # Hash, Array
           @discovered_columns << column(k, coldef[:type], coldef[:type].constantize.new)
-          serialize k, coldef[:type].constantize
-        end
-        define_method k do
-          unless new_record? or @loaded_attributes.include? k.to_s
-            Rails.logger.debug "BUG: access non-loaded attribute #{k}"
-            # We should...
-            # raise ActiveModel::MissingAttributeError, "missing attribute: #{k}"
-          end
-          super()
+          # serialize k, coldef[:type].constantize
         end
+        attr_reader k
         @attribute_info[k] = coldef
       end
     end
     @discovered_columns
   end
 
+  def new_record?
+    # dup method doesn't reset the uuid attr
+    @uuid.nil? || @new_record || false
+  end
+
+  def initialize_dup(other)
+    super
+    @new_record = true
+    @created_at = nil
+  end
+
   def self.column(name, sql_type = nil, default = nil, null = true)
-    if sql_type == 'datetime'
-      cast_type = "ActiveRecord::Type::DateTime".constantize.new
-    else
-      cast_type = ActiveRecord::Base.connection.lookup_cast_type(sql_type)
+    caster = case sql_type
+              when 'integer'
+                ActiveModel::Type::Integer
+              when 'string', 'text'
+                ActiveModel::Type::String
+              when 'float'
+                ActiveModel::Type::Float
+              when 'datetime'
+                ActiveModel::Type::DateTime
+              when 'boolean'
+                ActiveModel::Type::Boolean
+              when 'Hash'
+                ArvadosBase::Type::Hash
+              when 'Array'
+                ArvadosBase::Type::Array
+              when 'jsonb'
+                ArvadosBase::Type::Hash
+              else
+                raise ArvadosBase::Error.new("Type unknown: #{sql_type}")
+            end
+    define_method "#{name}=" do |val|
+      val = default if val.nil?
+      casted_value = caster.new.cast(val)
+      attribute_will_change!(name) if send(name) != casted_value
+      set_attribute_after_cast(name, casted_value)
     end
-    ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, cast_type, sql_type.to_s, null)
+    Column.new(name.to_s)
+  end
+
+  def set_attribute_after_cast(name, casted_value)
+    instance_variable_set("@#{name}", casted_value)
+  end
+
+  def [](attr_name)
+    begin
+      send(attr_name)
+    rescue
+      nil
+    end
+  end
+
+  def []=(attr_name, attr_val)
+    send("#{attr_name}=", attr_val)
   end
 
   def self.attribute_info
@@ -185,17 +272,36 @@ class ArvadosBase < ActiveRecord::Base
     # The following permit! is necessary even with
     # "ActionController::Parameters.permit_all_parameters = true",
     # because permit_all does not permit nested attributes.
-    ActionController::Parameters.new(raw_params).permit!
+    if !raw_params.is_a? ActionController::Parameters
+      raw_params = ActionController::Parameters.new(raw_params)
+    end
+    raw_params.permit!
   end
 
   def self.create raw_params={}, create_params={}
-    x = super(permit_attribute_params(raw_params))
-    x.create_params = create_params
+    x = new(permit_attribute_params(raw_params), create_params)
+    x.save
     x
   end
 
+  def self.create! raw_params={}, create_params={}
+    x = new(permit_attribute_params(raw_params), create_params)
+    x.save!
+    x
+  end
+
+  def self.table_name
+    self.name.underscore.pluralize.downcase
+  end
+
   def update_attributes raw_params={}
-    super(self.class.permit_attribute_params(raw_params))
+    assign_attributes(self.class.permit_attribute_params(raw_params))
+    save
+  end
+
+  def update_attributes! raw_params={}
+    assign_attributes(self.class.permit_attribute_params(raw_params))
+    save!
   end
 
   def save
@@ -219,7 +325,10 @@ class ArvadosBase < ActiveRecord::Base
       obdata.delete :uuid
       resp = arvados_api_client.api(self.class, '/' + uuid, postdata)
     else
-      postdata.merge!(@create_params) if @create_params
+      if @create_params
+        @create_params = @create_params.to_unsafe_hash if @create_params.is_a? ActionController::Parameters
+        postdata.merge!(@create_params)
+      end
       resp = arvados_api_client.api(self.class, '', postdata)
     end
     return false if !resp[:etag] || !resp[:uuid]
@@ -245,6 +354,14 @@ class ArvadosBase < ActiveRecord::Base
     self.save or raise Exception.new("Save failed")
   end
 
+  def persisted?
+    (!new_record? && !destroyed?) ? true : false
+  end
+
+  def destroyed?
+    !(etag || uuid)
+  end
+
   def destroy
     if etag || uuid
       postdata = { '_method' => 'DELETE' }
@@ -333,6 +450,11 @@ class ArvadosBase < ActiveRecord::Base
     forget_uuid!
   end
 
+  def attributes
+    kv = self.class.columns.collect {|c| c.name}.map {|key| [key, send(key)]}
+    kv.to_h
+  end
+
   def attributes_for_display
     self.attributes.reject { |k,v|
       attribute_sortkey.has_key?(k) and !attribute_sortkey[k]
index 865ff6e9519cacf613b248df446fd4a1e0b24636..34e8181515c887fbe9e09659d09ebee4ab40f24f 100644 (file)
@@ -109,7 +109,7 @@ class User < ArvadosBase
     false
   end
 
-   def self.creatable?
+  def self.creatable?
     current_user and current_user.is_admin
-   end
+  end
 end
index 7f3542083e91180f9c943e3a93c16bf416c2930b..c4656e659d51cd08b2d75f8ad1859ad5aa7e1ba7 100644 (file)
@@ -56,7 +56,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
            <% else %>
              data-object-uuid="<%= @object.uuid %>"
            <% end %>
-           data-pane-content-url="<%= url_for(params.merge(tab_pane: pane_name)) %>"
+           data-pane-content-url="<%= url_for(params.permit!.merge(tab_pane: pane_name)) %>"
            style="margin-top:0.5em;"
            >
         <div class="pane-content">
index 1bf8065c31c804148b49bcd90ed80bd1ce91c497..4ac7601c8e57d91a3e460b559d7c0db7e1274b5a 100644 (file)
@@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
 
 <% content_for :tab_line_buttons do %>
   <div class="pane-loaded arv-log-event-listener arv-refresh-on-state-change"
-       data-pane-content-url="<%= url_for(params.merge(tab_pane: "job_buttons")) %>"
+       data-pane-content-url="<%= url_for(params.permit!.merge(tab_pane: "job_buttons")) %>"
        data-object-uuid="<%= @object.uuid %>"
        style="display: inline">
   <%= render partial: 'show_job_buttons', locals: {object: @object}%>
index 881d77102c656e1c7408d72c3d970e32dd5c89ad..e573bf52a23554fc35bb0ef143b6464375f0bbb7 100644 (file)
@@ -23,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0 %>
 
   <div id="pipeline-instance-tab-buttons"
        class="pane-loaded arv-log-event-listener arv-refresh-on-state-change"
-       data-pane-content-url="<%= url_for(params.merge(tab_pane: "tab_buttons")) %>"
+       data-pane-content-url="<%= url_for(params.permit!.merge(tab_pane: "tab_buttons")) %>"
        data-object-uuid="<%= @object.uuid %>"
        >
     <%= render partial: 'show_tab_buttons', locals: {object: @object}%>
diff --git a/apps/workbench/bin/bundle b/apps/workbench/bin/bundle
new file mode 100755 (executable)
index 0000000..9447ba8
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/apps/workbench/bin/rails b/apps/workbench/bin/rails
new file mode 100755 (executable)
index 0000000..4ab9539
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+APP_PATH = File.expand_path('../config/application', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/apps/workbench/bin/rake b/apps/workbench/bin/rake
new file mode 100755 (executable)
index 0000000..c69c1c4
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/apps/workbench/bin/setup b/apps/workbench/bin/setup
new file mode 100755 (executable)
index 0000000..50c3fa0
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+  system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+  # This script is a starting point to setup your application.
+  # Add necessary setup steps to this file.
+
+  puts '== Installing dependencies =='
+  system! 'gem install bundler --conservative'
+  system('bundle check') || system!('bundle install')
+
+  # puts "\n== Copying sample files =="
+  # unless File.exist?('config/database.yml')
+  #   cp 'config/database.yml.sample', 'config/database.yml'
+  # end
+
+  puts "\n== Preparing database =="
+  system! 'bin/rails db:setup'
+
+  puts "\n== Removing old logs and tempfiles =="
+  system! 'bin/rails log:clear tmp:clear'
+
+  puts "\n== Restarting application server =="
+  system! 'bin/rails restart'
+end
diff --git a/apps/workbench/bin/update b/apps/workbench/bin/update
new file mode 100755 (executable)
index 0000000..b56771e
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+  system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+  # This script is a way to update your development environment automatically.
+  # Add necessary update steps to this file.
+
+  puts '== Installing dependencies =='
+  system! 'gem install bundler --conservative'
+  system('bundle check') || system!('bundle install')
+
+  puts "\n== Updating database =="
+  system! 'bin/rails db:migrate'
+
+  puts "\n== Removing old logs and tempfiles =="
+  system! 'bin/rails log:clear tmp:clear'
+
+  puts "\n== Restarting application server =="
+  system! 'bin/rails restart'
+end
index ccc7e4bbddaaf8c6396fe33c863b96f1bbf54235..d38742248b52fac025d72bf95f89c86e91c29380 100644 (file)
@@ -66,7 +66,6 @@ production:
   eager_load: true
   consider_all_requests_local: false
   action_controller.perform_caching: true
-  serve_static_files: false
   assets.compile: false
   assets.digest: true
   i18n.fallbacks: true
@@ -89,8 +88,6 @@ production:
 test:
   cache_classes: true
   eager_load: false
-  serve_static_files: true
-  static_cache_control: public, max-age=3600
   consider_all_requests_local: true
   action_controller.perform_caching: false
   action_dispatch.show_exceptions: false
@@ -218,7 +215,7 @@ common:
   # would be enabled in a collection's show page.
   # It is sufficient to list only applications here.
   # No need to list text and image types.
-  application_mimetypes_with_view_icon: [cwl, fasta, go, javascript, json, pdf, python, r, rtf, sam, x-sh, vnd.realvnc.bed, xml, xsl]
+  application_mimetypes_with_view_icon: [cwl, fasta, go, javascript, json, pdf, python, x-python, r, rtf, sam, x-sh, vnd.realvnc.bed, xml, xsl]
 
   # the maximum number of bytes to load in the log viewer
   log_viewer_max_bytes: 1000000
index 891dd432c0dccfedf4f773cd41748c0222124e88..09fa403057aa996c66ea0ce530315c4c3a6347f2 100644 (file)
@@ -4,7 +4,18 @@
 
 require File.expand_path('../boot', __FILE__)
 
-require 'rails/all'
+require "rails"
+# Pick only the frameworks we need:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_view/railtie"
+# Skip ActionCable (new in Rails 5.0) as it adds '/cable' routes that we're not using
+# require "action_cable/engine"
+require "sprockets/railtie"
+require "rails/test_unit/railtie"
 
 Bundler.require(:default, Rails.env)
 
diff --git a/apps/workbench/config/cable.yml b/apps/workbench/config/cable.yml
new file mode 100644 (file)
index 0000000..c906069
--- /dev/null
@@ -0,0 +1,13 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+development:
+  adapter: async
+
+test:
+  adapter: async
+
+production:
+  adapter: redis
+  url: redis://localhost:6379/1
index d6b6a00e8dd158918394fea1f1c2d99aa8805834..cd706940a389752fd6263bb32fc82a057fc3c583 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 # Load the rails application
-require File.expand_path('../application', __FILE__)
+require_relative 'application'
 
 # Initialize the rails application
-ArvadosWorkbench::Application.initialize!
+Rails.application.initialize!
index 8b656c5a7746519eaffe4fdf13a8a50a9145efd2..ea2cf34e3dbe5d17b438ce6ab4a88e376b3b8be9 100644 (file)
@@ -13,7 +13,7 @@ ArvadosWorkbench::Application.configure do
   config.action_controller.perform_caching = true
 
   # Disable Rails's static asset server (Apache or nginx will already do this)
-  config.serve_static_files = false
+  config.public_file_server.enabled = false
 
   # Compress JavaScripts and CSS
   config.assets.js_compressor = :uglifier
index 7ce5082701274c0564dd3b22a73375a656fa08a5..373618c1d66a081c82fdf340649f6f23d887d050 100644 (file)
@@ -12,8 +12,8 @@ ArvadosWorkbench::Application.configure do
   config.cache_classes = true
 
   # Configure static asset server for tests with Cache-Control for performance
-  config.serve_static_files = true
-  config.static_cache_control = "public, max-age=3600"
+  config.public_file_server.enabled = true
+  config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
 
   # Show full error reports and disable caching
   config.consider_all_requests_local       = true
diff --git a/apps/workbench/config/initializers/application_controller_renderer.rb b/apps/workbench/config/initializers/application_controller_renderer.rb
new file mode 100644 (file)
index 0000000..525d6ad
--- /dev/null
@@ -0,0 +1,12 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# ActiveSupport::Reloader.to_prepare do
+#   ApplicationController.renderer.defaults.merge!(
+#     http_host: 'example.org',
+#     https: false
+#   )
+# end
diff --git a/apps/workbench/config/initializers/assets.rb b/apps/workbench/config/initializers/assets.rb
new file mode 100644 (file)
index 0000000..f02c87b
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/apps/workbench/config/initializers/cookies_serializer.rb b/apps/workbench/config/initializers/cookies_serializer.rb
new file mode 100644 (file)
index 0000000..5409f55
--- /dev/null
@@ -0,0 +1,9 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :marshal
diff --git a/apps/workbench/config/initializers/filter_parameter_logging.rb b/apps/workbench/config/initializers/filter_parameter_logging.rb
new file mode 100644 (file)
index 0000000..f26d0ad
--- /dev/null
@@ -0,0 +1,8 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/apps/workbench/config/initializers/new_framework_defaults.rb b/apps/workbench/config/initializers/new_framework_defaults.rb
new file mode 100644 (file)
index 0000000..b8dca33
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+
+Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
+
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = false
+
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = false
+
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = false
+
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = false
+
+# Do not halt callback chains when a callback returns false. Previous versions had true.
+ActiveSupport.halt_callback_chains_on_return_false = true
index b53e9ef9155cc28f0b902c985493447fc15ff570..7a2f297207691f37df4d4ac75543bfa0b969d00c 100644 (file)
@@ -4,7 +4,7 @@
 
 # Be sure to restart your server when you modify this file.
 
-ArvadosWorkbench::Application.config.session_store :cookie_store, key: '_arvados_workbench_session'
+Rails.application.config.session_store :cookie_store, key: '_arvados_workbench_session'
 
 # Use the database for sessions instead of the cookie-based default,
 # which shouldn't be used to store highly confidential information
diff --git a/apps/workbench/config/puma.rb b/apps/workbench/config/puma.rb
new file mode 100644 (file)
index 0000000..e087396
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum, this matches the default thread size of Active Record.
+#
+threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
+#
+port        ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked webserver processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory. If you use this option
+# you need to make sure to reconnect any threads in the `on_worker_boot`
+# block.
+#
+# preload_app!
+
+# The code in the `on_worker_boot` will be called if you are using
+# clustered mode by specifying a number of `workers`. After each worker
+# process is booted this block will be run, if you are using `preload_app!`
+# option you will want to use this block to reconnect to any threads
+# or connections that may have been created at application boot, Ruby
+# cannot share connections between processes.
+#
+# on_worker_boot do
+#   ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
+# end
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/apps/workbench/config/secrets.yml b/apps/workbench/config/secrets.yml
new file mode 100644 (file)
index 0000000..bc8a0d0
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rails secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+  secret_key_base: 33e2d171ec6c67cf8e9a9fbfadc1071328bdab761297e2fe28b9db7613dd542c1ba3bdb3bd3e636d1d6f74ab73a2d90c4e9c0ecc14fde8ccd153045f94e9cc41
+
+test:
+  secret_key_base: d4c07cab3530fccf5d86565ecdc359eb2a853b8ede3b06edb2885e4423d7a726f50a3e415bb940fd4861e8fec16459665fd377acc8cdd98ea63294d2e0d12bb2
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/apps/workbench/config/spring.rb b/apps/workbench/config/spring.rb
new file mode 100644 (file)
index 0000000..101e684
--- /dev/null
@@ -0,0 +1,10 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+%w(
+  .ruby-version
+  .rbenv-vars
+  tmp/restart.txt
+  tmp/caching-dev.txt
+).each { |path| Spring.watch(path) }
index e768c6c7426d4db4bd7cd151d33ab4ebd3241878..86aa304e472324f992b7e72b5b1e7d27580f38e3 100644 (file)
@@ -7,7 +7,7 @@ require 'test_helper'
 class ActionsControllerTest < ActionController::TestCase
 
   test "send report" do
-    post :report_issue, {format: 'js'}, session_for(:admin)
+    post :report_issue, params: {format: 'js'}, session: session_for(:admin)
     assert_response :success
 
     found_email = false
@@ -21,13 +21,13 @@ class ActionsControllerTest < ActionController::TestCase
   end
 
   test "combine files into new collection" do
-    post(:combine_selected_files_into_collection, {
+    post(:combine_selected_files_into_collection, params: {
            selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
                        'zzzzz-4zz18-ehbhgtheo8909or/bar',
                        'zzzzz-4zz18-y9vne9npefyxh8g/baz',
                        '7a6ef4c162a5c6413070a8bd0bffc818+150'],
            format: "json"},
-         session_for(:active))
+         session: session_for(:active))
 
     assert_response 302   # collection created and redirected to new collection page
 
@@ -46,7 +46,7 @@ class ActionsControllerTest < ActionController::TestCase
   end
 
   test "combine files  with repeated names into new collection" do
-    post(:combine_selected_files_into_collection, {
+    post(:combine_selected_files_into_collection, params: {
            selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
                        'zzzzz-4zz18-00000nonamecoll/foo',
                        'zzzzz-4zz18-abcd6fx123409f7/foo',
@@ -54,7 +54,7 @@ class ActionsControllerTest < ActionController::TestCase
                        'zzzzz-4zz18-y9vne9npefyxh8g/baz',
                        '7a6ef4c162a5c6413070a8bd0bffc818+150'],
            format: "json"},
-         session_for(:active))
+         session: session_for(:active))
 
     assert_response 302   # collection created and redirected to new collection page
 
@@ -74,13 +74,13 @@ class ActionsControllerTest < ActionController::TestCase
   end
 
   test "combine collections with repeated filenames in almost similar directories and expect files with proper suffixes" do
-    post(:combine_selected_files_into_collection, {
+    post(:combine_selected_files_into_collection, params: {
            selection: ['zzzzz-4zz18-duplicatenames1',
                        'zzzzz-4zz18-duplicatenames2',
                        'zzzzz-4zz18-znfnqtbbv4spc3w/foo',
                        'zzzzz-4zz18-00000nonamecoll/foo',],
            format: "json"},
-         session_for(:active))
+         session: session_for(:active))
 
     assert_response 302   # collection created and redirected to new collection page
 
@@ -116,11 +116,11 @@ class ActionsControllerTest < ActionController::TestCase
   end
 
   test "combine collections with same filename in two different streams and expect no suffixes for filenames" do
-    post(:combine_selected_files_into_collection, {
+    post(:combine_selected_files_into_collection, params: {
            selection: ['zzzzz-4zz18-znfnqtbbv4spc3w',
                        'zzzzz-4zz18-foonbarfilesdir'],
            format: "json"},
-         session_for(:active))
+         session: session_for(:active))
 
     assert_response 302   # collection created and redirected to new collection page
 
@@ -144,11 +144,11 @@ class ActionsControllerTest < ActionController::TestCase
   end
 
   test "combine foo files from two different collection streams and expect proper filename suffixes" do
-    post(:combine_selected_files_into_collection, {
+    post(:combine_selected_files_into_collection, params: {
            selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
                        'zzzzz-4zz18-foonbarfilesdir/dir1/foo'],
            format: "json"},
-         session_for(:active))
+         session: session_for(:active))
 
     assert_response 302   # collection created and redirected to new collection page
 
@@ -174,7 +174,7 @@ class ActionsControllerTest < ActionController::TestCase
   ].each do |dm, fixture|
     test "access show method for public #{dm} and expect to see page" do
       Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
-      get(:show, {uuid: api_fixture(dm)[fixture]['uuid']})
+      get(:show, params: {uuid: api_fixture(dm)[fixture]['uuid']})
       assert_response :redirect
       if dm == 'groups'
         assert_includes @response.redirect_url, "projects/#{fixture['uuid']}"
@@ -194,7 +194,7 @@ class ActionsControllerTest < ActionController::TestCase
   ].each do |dm, fixture, expected|
     test "access show method for non-public #{dm} and expect #{expected}" do
       Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
-      get(:show, {uuid: api_fixture(dm)[fixture]['uuid']})
+      get(:show, params: {uuid: api_fixture(dm)[fixture]['uuid']})
       assert_response expected
       if expected == 404
         assert_includes @response.inspect, 'Log in'
index 45952ceba3ef46fa14378c8e3351fc79d7031df0..1b13d8f328def28af9064afff27191a6052195fe 100644 (file)
@@ -334,7 +334,7 @@ class ApplicationControllerTest < ActionController::TestCase
     # We're really testing ApplicationController's find_object_by_uuid.
     # It's easiest to do that by instantiating a concrete controller.
     @controller = NodesController.new
-    get(:show, {id: "zzzzz-zzzzz-zzzzzzzzzzzzzzz"}, session_for(:admin))
+    get(:show, params: {id: "zzzzz-zzzzz-zzzzzzzzzzzzzzz"}, session: session_for(:admin))
     assert_response 404
   end
 
@@ -350,7 +350,7 @@ class ApplicationControllerTest < ActionController::TestCase
       api_fixture("api_client_authorizations", "anonymous", "api_token")
     @controller = ProjectsController.new
     test_uuid = "zzzzz-j7d0g-zzzzzzzzzzzzzzz"
-    get(:show, {id: test_uuid})
+    get(:show, params: {id: test_uuid})
 
     assert_not_nil got_header
     assert_includes got_header, 'X-Request-Id'
@@ -359,13 +359,13 @@ class ApplicationControllerTest < ActionController::TestCase
 
   test "current request_id is nil after a request" do
     @controller = NodesController.new
-    get(:index, {}, session_for(:active))
+    get(:index, params: {}, session: session_for(:active))
     assert_nil Thread.current[:request_id]
   end
 
   test "X-Request-Id header" do
     @controller = NodesController.new
-    get(:index, {}, session_for(:active))
+    get(:index, params: {}, session: session_for(:active))
     assert_match /^req-[0-9a-zA-Z]{20}$/, response.headers['X-Request-Id']
   end
 
@@ -378,7 +378,7 @@ class ApplicationControllerTest < ActionController::TestCase
         api_fixture("api_client_authorizations", "anonymous", "api_token")
       @controller = ProjectsController.new
       test_uuid = "zzzzz-j7d0g-zzzzzzzzzzzzzzz"
-      get(:show, {id: test_uuid})
+      get(:show, params: {id: test_uuid})
       login_link = css_select(css_selector).first
       assert_not_nil(login_link, "failed to select login link")
       login_href = URI.unescape(login_link.attributes["href"].value)
@@ -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
@@ -428,7 +428,7 @@ class ApplicationControllerTest < ActionController::TestCase
 
       @controller = controller
 
-      get(:show, {id: fixture['uuid']})
+      get(:show, params: {id: fixture['uuid']})
 
       if anon_config
         assert_response 200
@@ -452,7 +452,7 @@ class ApplicationControllerTest < ActionController::TestCase
       Rails.configuration.include_accept_encoding_header_in_api_requests = config
 
       @controller = CollectionsController.new
-      get(:show, {id: api_fixture('collections')['foo_file']['uuid']}, session_for(:admin))
+      get(:show, params: {id: api_fixture('collections')['foo_file']['uuid']}, session: session_for(:admin))
 
       assert_equal([['.', 'foo', 3]], assigns(:object).files)
     end
@@ -461,13 +461,13 @@ class ApplicationControllerTest < ActionController::TestCase
   test 'Edit name and verify that a duplicate is not created' do
     @controller = ProjectsController.new
     project = api_fixture("groups")["aproject"]
-    post :update, {
+    post :update, params: {
       id: project["uuid"],
       project: {
         name: 'test name'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_includes @response.body, 'test name'
     updated = assigns(:object)
     assert_equal updated.uuid, project["uuid"]
@@ -481,7 +481,7 @@ class ApplicationControllerTest < ActionController::TestCase
     test "access #{controller.controller_name} index as admin and verify Home link is#{' not' if !expect_home_link} shown" do
       @controller = controller
 
-      get :index, {}, session_for(:admin)
+      get :index, params: {}, session: session_for(:admin)
 
       assert_response 200
       assert_includes @response.body, expect_str
@@ -503,7 +503,7 @@ class ApplicationControllerTest < ActionController::TestCase
     test "access #{controller.controller_name} index as admin and verify Delete option is#{' not' if !expect_delete_link} shown" do
       @controller = controller
 
-      get :index, {}, session_for(:admin)
+      get :index, params: {}, session: session_for(:admin)
 
       assert_response 200
       assert_includes @response.body, expect_str
index 3ff02a82a2711e983ce507421b2e290317effca8..88287cd3f3d1cd0b5e65ed980b4c58b6ce4b13dd 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
 
@@ -51,7 +55,7 @@ class CollectionsControllerTest < ActionController::TestCase
   def show_collection(params, session={}, response=:success)
     params = collection_params(params) if not params.is_a? Hash
     session = session_for(session) if not session.is_a? Hash
-    get(:show, params, session)
+    get(:show, params: params, session: session)
     assert_response response
   end
 
@@ -68,10 +72,10 @@ class CollectionsControllerTest < ActionController::TestCase
   test "download a file with spaces in filename" do
     setup_for_keep_web
     collection = api_fixture('collections')['w_a_z_file']
-    get :show_file, {
+    get :show_file, params: {
       uuid: collection['uuid'],
       file: 'w a z'
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :redirect
     assert_match /w%20a%20z/, response.redirect_url
   end
@@ -123,7 +127,7 @@ class CollectionsControllerTest < ActionController::TestCase
   test "viewing collection files with a reader token" do
     params = collection_params(:foo_file)
     params[:reader_token] = api_token("active_all_collections")
-    get(:show_file_links, params)
+    get(:show_file_links, params: params)
     assert_response :redirect
     assert_no_session
   end
@@ -132,7 +136,7 @@ class CollectionsControllerTest < ActionController::TestCase
     setup_for_keep_web
     params = collection_params(:foo_file, "foo")
     params[:reader_token] = api_token("active_all_collections")
-    get(:show_file, params)
+    get(:show_file, params: params)
     assert_response :redirect
     assert_match /foo/, response.redirect_url
     assert_no_session
@@ -141,7 +145,7 @@ class CollectionsControllerTest < ActionController::TestCase
   test "reader token Collection links end with trailing slash" do
     # Testing the fix for #2937.
     session = session_for(:active_trustedclient)
-    post(:share, collection_params(:foo_file), session)
+    post(:share, params: collection_params(:foo_file), session: session)
     assert(@controller.download_link.ends_with? '/',
            "Collection share link does not end with slash for wget")
   end
@@ -150,7 +154,7 @@ class CollectionsControllerTest < ActionController::TestCase
     setup_for_keep_web
     params = collection_params(:foo_file, 'foo')
     sess = session_for(:active)
-    get(:show_file, params, sess)
+    get(:show_file, params: params, session: sess)
     assert_response :redirect
     assert_match /foo/, response.redirect_url
   end
@@ -158,7 +162,7 @@ class CollectionsControllerTest < ActionController::TestCase
   test 'anonymous download' do
     setup_for_keep_web
     config_anonymous true
-    get :show_file, {
+    get :show_file, params: {
       uuid: api_fixture('collections')['user_agreement_in_anonymously_accessible_project']['uuid'],
       file: 'GNU_General_Public_License,_version_3.pdf',
     }
@@ -169,7 +173,7 @@ class CollectionsControllerTest < ActionController::TestCase
   test "can't get a file from Keep without permission" do
     params = collection_params(:foo_file, 'foo')
     sess = session_for(:spectator)
-    get(:show_file, params, sess)
+    get(:show_file, params: params, session: sess)
     assert_response 404
   end
 
@@ -178,7 +182,7 @@ class CollectionsControllerTest < ActionController::TestCase
     params = collection_params(:foo_file, 'foo')
     read_token = api_token('active')
     params[:reader_token] = read_token
-    get(:show_file, params)
+    get(:show_file, params: params)
     assert_response :redirect
     assert_match /foo/, response.redirect_url
     assert_not_equal(read_token, session[:arvados_api_token],
@@ -191,7 +195,7 @@ class CollectionsControllerTest < ActionController::TestCase
       params = collection_params(:foo_file, 'foo')
       params[:reader_token] =
         api_token('active_noscope')
-      get(:show_file, params)
+      get(:show_file, params: params)
       if anon
         # Some files can be shown without a valid token, but not this one.
         assert_response 404
@@ -209,7 +213,7 @@ class CollectionsControllerTest < ActionController::TestCase
     sess = session_for(:expired)
     read_token = api_token('active')
     params[:reader_token] = read_token
-    get(:show_file, params, sess)
+    get(:show_file, params: params, session: sess)
     assert_response :redirect
     assert_not_equal(read_token, session[:arvados_api_token],
                      "using a reader token set the session's API token")
@@ -220,10 +224,10 @@ class CollectionsControllerTest < ActionController::TestCase
     ua_collection = api_fixture('collections')['user_agreement']
     # Here we don't test whether the agreement can be retrieved from
     # Keep. We only test that show_file decides to send file content.
-    get :show_file, {
+    get :show_file, params: {
       uuid: ua_collection['uuid'],
       file: ua_collection['manifest_text'].match(/ \d+:\d+:(\S+)/)[1]
-    }, session_for(:inactive)
+    }, session: session_for(:inactive)
     assert_nil(assigns(:unsigned_user_agreements),
                "Did not skip check_user_agreements filter " +
                "when showing the user agreement.")
@@ -238,7 +242,7 @@ class CollectionsControllerTest < ActionController::TestCase
   test "show file in a subdirectory of a collection" do
     setup_for_keep_web
     params = collection_params(:collection_with_files_in_subdir, 'subdir2/subdir3/subdir4/file1_in_subdir4.txt')
-    get(:show_file, params, session_for(:user1_with_load))
+    get(:show_file, params: params, session: session_for(:user1_with_load))
     assert_response :redirect
     assert_match /subdir2\/subdir3\/subdir4\/file1_in_subdir4\.txt/, response.redirect_url
   end
@@ -320,11 +324,11 @@ class CollectionsControllerTest < ActionController::TestCase
     show_collection(fixture_name, :active)
     fixture = api_fixture('collections')[fixture_name.to_s]
     assert_equal(fixture['name'], assigns(:object).name)
-    assert_equal(fixture['properties'][0], assigns(:object).properties[0])
+    assert_equal(fixture['properties'].values[0], assigns(:object).properties.values[0])
   end
 
   test "create collection with properties" do
-    post :create, {
+    post :create, params: {
       collection: {
         name: 'collection created with properties',
         manifest_text: '',
@@ -333,7 +337,7 @@ class CollectionsControllerTest < ActionController::TestCase
         },
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
     assert_not_nil assigns(:object).uuid
     assert_equal 'collection created with properties', assigns(:object).name
@@ -342,13 +346,13 @@ class CollectionsControllerTest < ActionController::TestCase
 
   test "update description and check manifest_text is not lost" do
     collection = api_fixture("collections")["multilevel_collection_1"]
-    post :update, {
+    post :update, params: {
       id: collection["uuid"],
       collection: {
         description: 'test description update'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
     assert_not_nil assigns(:object)
     # Ensure the Workbench response still has the original manifest_text
@@ -416,7 +420,7 @@ class CollectionsControllerTest < ActionController::TestCase
   test "anonymous user accesses collection in shared project" do
     config_anonymous true
     collection = api_fixture('collections')['public_text_file']
-    get(:show, {id: collection['uuid']})
+    get(:show, params: {id: collection['uuid']})
 
     response_object = assigns(:object)
     assert_equal collection['name'], response_object['name']
@@ -427,19 +431,19 @@ class CollectionsControllerTest < ActionController::TestCase
   end
 
   test "can view empty collection" do
-    get :show, {id: 'd41d8cd98f00b204e9800998ecf8427e+0'}, session_for(:active)
+    get :show, params: {id: 'd41d8cd98f00b204e9800998ecf8427e+0'}, session: session_for(:active)
     assert_includes @response.body, 'The following collections have this content'
   end
 
   test "collection portable data hash redirect" do
     di = api_fixture('collections')['docker_image']
-    get :show, {id: di['portable_data_hash']}, session_for(:active)
+    get :show, params: {id: di['portable_data_hash']}, session: session_for(:active)
     assert_match /\/collections\/#{di['uuid']}/, @response.redirect_url
   end
 
   test "collection portable data hash with multiple matches" do
     pdh = api_fixture('collections')['foo_file']['portable_data_hash']
-    get :show, {id: pdh}, session_for(:admin)
+    get :show, params: {id: pdh}, session: session_for(:admin)
     matches = api_fixture('collections').select {|k,v| v["portable_data_hash"] == pdh}
     assert matches.size > 1
 
@@ -455,13 +459,15 @@ class CollectionsControllerTest < ActionController::TestCase
 
   test "collection page renders name" do
     collection = api_fixture('collections')['foo_file']
-    get :show, {id: collection['uuid']}, session_for(:active)
+    get :show, params: {id: collection['uuid']}, session: session_for(:active)
     assert_includes @response.body, collection['name']
     assert_match /not authorized to manage collection sharing links/, @response.body
   end
 
   test "No Upload tab on non-writable collection" do
-    get :show, {id: api_fixture('collections')['user_agreement']['uuid']}, session_for(:active)
+    get :show,
+        params: {id: api_fixture('collections')['user_agreement']['uuid']},
+        session: session_for(:active)
     assert_not_includes @response.body, '<a href="#Upload"'
   end
 
@@ -475,7 +481,9 @@ class CollectionsControllerTest < ActionController::TestCase
       setup_for_keep_web
       tok = api_token('active')
       id = api_fixture('collections')['w_a_z_file'][id_type]
-      get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+      get :show_file,
+          params: {uuid: id, file: "w a z"},
+          session: session_for(:active)
       assert_response :redirect
       assert_equal "https://#{id.sub '+', '-'}.example/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
     end
@@ -484,7 +492,9 @@ class CollectionsControllerTest < ActionController::TestCase
       setup_for_keep_web
       tok = api_token('active')
       id = api_fixture('collections')['w_a_z_file'][id_type]
-      get :show_file, {uuid: id, file: "w a z", reader_token: tok}, session_for(:expired)
+      get :show_file,
+          params: {uuid: id, file: "w a z", reader_token: tok},
+          session: session_for(:expired)
       assert_response :redirect
       assert_equal "https://#{id.sub '+', '-'}.example/t=#{URI.escape tok}/_/w%20a%20z", @response.redirect_url
     end
@@ -493,7 +503,7 @@ class CollectionsControllerTest < ActionController::TestCase
       setup_for_keep_web
       config_anonymous true
       id = api_fixture('collections')['public_text_file'][id_type]
-      get :show_file, {uuid: id, file: "Hello World.txt"}
+      get :show_file, params: {uuid: id, file: "Hello World.txt"}
       assert_response :redirect
       assert_equal "https://#{id.sub '+', '-'}.example/_/Hello%20World.txt", @response.redirect_url
     end
@@ -502,7 +512,7 @@ class CollectionsControllerTest < ActionController::TestCase
       setup_for_keep_web
       config_anonymous true
       id = api_fixture('collections')['public_text_file'][id_type]
-      get :show_file, {
+      get :show_file, params: {
         uuid: id,
         file: "Hello World.txt",
         disposition: 'attachment',
@@ -516,7 +526,7 @@ class CollectionsControllerTest < ActionController::TestCase
                          'https://download.example/c=%{uuid_or_pdh}')
       tok = api_token('active')
       id = api_fixture('collections')['w_a_z_file'][id_type]
-      get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+      get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
       assert_response :redirect
       assert_equal "https://download.example/c=#{id.sub '+', '-'}/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
     end
@@ -527,7 +537,7 @@ class CollectionsControllerTest < ActionController::TestCase
                          'https://download.example/c=%{uuid_or_pdh}')
       tok = api_token('active')
       id = api_fixture('collections')['w_a_z_file'][id_type]
-      get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+      get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
       assert_response :redirect
       assert_equal "https://collections.example/c=#{id.sub '+', '-'}/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
     end
@@ -538,7 +548,7 @@ class CollectionsControllerTest < ActionController::TestCase
       setup_for_keep_web
       config_anonymous anon
       id = api_fixture('collections')['w_a_z_file']['uuid']
-      get :show_file, {uuid: id, file: "w a z"}, session_for(:spectator)
+      get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:spectator)
       assert_response 404
     end
 
@@ -548,11 +558,11 @@ class CollectionsControllerTest < ActionController::TestCase
                          'https://download.example/c=%{uuid_or_pdh}')
       tok = api_token('active')
       id = api_fixture('collections')['public_text_file']['uuid']
-      get :show_file, {
+      get :show_file, params: {
         uuid: id,
         file: 'Hello world.txt',
         disposition: 'attachment',
-      }, session_for(:active)
+      }, session: session_for(:active)
       assert_response :redirect
       expect_url = "https://download.example/c=#{id.sub '+', '-'}/_/Hello%20world.txt"
       if not anon
@@ -567,7 +577,7 @@ class CollectionsControllerTest < ActionController::TestCase
     # cannot read this collection without a session token.
     setup_for_keep_web 'https://collections.example/c=%{uuid_or_pdh}', false
     id = api_fixture('collections')['w_a_z_file']['uuid']
-    get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+    get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
     assert_response 422
   end
 
@@ -577,7 +587,7 @@ class CollectionsControllerTest < ActionController::TestCase
       setup_for_keep_web false, 'https://download.example/c=%{uuid_or_pdh}'
       tok = api_token('active')
       id = api_fixture('collections')['w_a_z_file']['uuid']
-      get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+      get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
       assert_response :redirect
       assert_equal "https://download.example/c=#{id.sub '+', '-'}/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
     end
@@ -594,14 +604,15 @@ class CollectionsControllerTest < ActionController::TestCase
     assert_includes(collection['manifest_text'], "0:0:file1")
 
     # now remove all files named 'file1' from the collection
-    post :remove_selected_files, {
+    post :remove_selected_files, params: {
       id: collection['uuid'],
       selection: ["#{collection['uuid']}/file1",
                   "#{collection['uuid']}/dir1/file1"],
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
 
+    use_token :active
     # verify no 'file1' in the updated collection
     collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
     assert_not_includes(collection['manifest_text'], "0:0:file1")
@@ -618,15 +629,16 @@ class CollectionsControllerTest < ActionController::TestCase
     assert_includes(collection['manifest_text'], "0:0:file1")
 
     # now remove all files from "dir1" subdir of the collection
-    post :remove_selected_files, {
+    post :remove_selected_files, params: {
       id: collection['uuid'],
       selection: ["#{collection['uuid']}/dir1/file1",
                   "#{collection['uuid']}/dir1/file2"],
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
 
     # verify that "./dir1" no longer exists in this collection's manifest text
+    use_token :active
     collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
     assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1 0:0:file2\n$/, collection['manifest_text']
     assert_not_includes(collection['manifest_text'], 'dir1')
@@ -642,57 +654,61 @@ class CollectionsControllerTest < ActionController::TestCase
     assert_includes(collection['manifest_text'], "0:0:file1")
 
     # rename 'file1' as 'file1renamed' and verify
-    post :update, {
+    post :update, params: {
       id: collection['uuid'],
       collection: {
         'rename-file-path:file1' => 'file1renamed'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
 
+    use_token :active
     collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
     assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed 0:0:file2\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1 0:0:dir1file2 0:0:dir1imagefile.png\n$/, collection['manifest_text']
 
     # now rename 'file2' such that it is moved into 'dir1'
     @test_counter = 0
-    post :update, {
+    post :update, params: {
       id: collection['uuid'],
       collection: {
         'rename-file-path:file2' => 'dir1/file2'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
 
+    use_token :active
     collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
     assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1 0:0:dir1file2 0:0:dir1imagefile.png 0:0:file2\n$/, collection['manifest_text']
 
     # now rename 'dir1/dir1file1' such that it is moved into a new subdir
     @test_counter = 0
-    post :update, {
+    post :update, params: {
       id: collection['uuid'],
       collection: {
         'rename-file-path:dir1/dir1file1' => 'dir2/dir3/dir1file1moved'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
 
+    use_token :active
     collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
     assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file2 0:0:dir1imagefile.png 0:0:file2\n.\/dir2\/dir3 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1moved\n$/, collection['manifest_text']
 
     # now rename the image file 'dir1/dir1imagefile.png'
     @test_counter = 0
-    post :update, {
+    post :update, params: {
       id: collection['uuid'],
       collection: {
         'rename-file-path:dir1/dir1imagefile.png' => 'dir1/dir1imagefilerenamed.png'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
 
+    use_token :active
     collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
     assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file2 0:0:dir1imagefilerenamed.png 0:0:file2\n.\/dir2\/dir3 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1moved\n$/, collection['manifest_text']
   end
@@ -701,13 +717,13 @@ class CollectionsControllerTest < ActionController::TestCase
     use_token :active
 
     # rename 'file2' as 'file1' and expect error
-    post :update, {
+    post :update, params: {
       id: 'zzzzz-4zz18-pyw8yp9g3pr7irn',
       collection: {
         'rename-file-path:file2' => 'file1'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response 422
     assert_includes json_response['errors'], 'Duplicate file path'
   end
@@ -716,13 +732,13 @@ class CollectionsControllerTest < ActionController::TestCase
     use_token :active
 
     # rename 'file1' as 'dir1/file1' and expect error
-    post :update, {
+    post :update, params: {
       id: 'zzzzz-4zz18-pyw8yp9g3pr7irn',
       collection: {
         'rename-file-path:file1' => 'dir1/file1'
       },
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response 422
     assert_includes json_response['errors'], 'Duplicate file path'
   end
index 6e96839e25f617f6ffca29ca1a44e81065c0cce2..93686aa6b14668d762185a5f19a5431d8398a60f 100644 (file)
@@ -12,7 +12,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     container_uuid = cr['container_uuid']
     container = Container.find(container_uuid)
 
-    get :show, {id: cr['uuid'], tab_pane: 'Log'}, session_for(:active)
+    get :show, params: {id: cr['uuid'], tab_pane: 'Log'}, session: session_for(:active)
     assert_response :success
 
     assert_select "a", {:href=>"/collections/#{container['log']}", :text=>"Download the log"}
@@ -27,7 +27,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     container_uuid = cr['container_uuid']
     container = Container.find(container_uuid)
 
-    get :show, {id: cr['uuid'], tab_pane: 'Log'}, session_for(:active)
+    get :show, params: {id: cr['uuid'], tab_pane: 'Log'}, session: session_for(:active)
     assert_response :success
 
     assert_includes @response.body, '<pre id="event_log_div"'
@@ -39,7 +39,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
 
     uuid = api_fixture('container_requests')['completed']['uuid']
 
-    get :show, {id: uuid}, session_for(:active)
+    get :show, params: {id: uuid}, session: session_for(:active)
     assert_response :success
 
     assert_includes @response.body, "action=\"/container_requests/#{uuid}/copy\""
@@ -47,7 +47,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
 
   test "cancel request for queued container" do
     cr_fixture = api_fixture('container_requests')['queued']
-    post :cancel, {id: cr_fixture['uuid']}, session_for(:active)
+    post :cancel, params: {id: cr_fixture['uuid']}, session: session_for(:active)
     assert_response 302
 
     use_token 'active'
@@ -72,13 +72,12 @@ class ContainerRequestsControllerTest < ActionController::TestCase
       if reuse_enabled
         copy_params.merge!({use_existing: true})
       end
-      post(:copy, copy_params, session_for(:active))
+      post(:copy, params: copy_params, session: session_for(:active))
       assert_response 302
       copied_cr = assigns(:object)
       assert_not_nil copied_cr
       assert_equal 'Uncommitted', copied_cr[:state]
       assert_equal "Copy of #{completed_cr['name']}", copied_cr['name']
-      assert_equal completed_cr['cmd'], copied_cr['cmd']
       assert_equal completed_cr['runtime_constraints']['ram'], copied_cr['runtime_constraints'][:ram]
       if reuse_enabled
         assert copied_cr[:use_existing]
@@ -114,8 +113,8 @@ class ContainerRequestsControllerTest < ActionController::TestCase
       cr = api_fixture('container_requests')[cr_fixture]
       assert_not_nil cr
       get(:show,
-          {id: cr['uuid']},
-          session_for(:active))
+          params: {id: cr['uuid']},
+          session: session_for(:active))
       assert_response :success
       if should_show
         assert_includes @response.body, "href=\"#Provenance\""
@@ -130,7 +129,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
 
     cr = api_fixture('container_requests')['completed_with_input_mounts']
 
-    get :show, {id: cr['uuid']}, session_for(:active)
+    get :show, params: {id: cr['uuid']}, session: session_for(:active)
     assert_response :success
 
     assert_match /hello/, @response.body
index a6a299932cddf74f9c43169d4871179c8d12cebb..ff7584e20b0317373ca53f642361d337894a3213 100644 (file)
@@ -10,7 +10,9 @@ class ContainersControllerTest < ActionController::TestCase
 
     container = api_fixture('containers')['completed']
 
-    get :show, {id: container['uuid'], tab_pane: 'Log'}, session_for(:active)
+    get :show,
+        params: {id: container['uuid'], tab_pane: 'Log'},
+        session: session_for(:active)
     assert_response :success
 
     assert_select "a", {:href=>"/collections/#{container['log']}", :text=>"Download the log"}
index 913f2b972834fce585bab576ddab67b576344221..556b958d00a8f0fe50c1a9af9d81b62c2eeb1771 100644 (file)
@@ -16,7 +16,7 @@ class DisabledApiTest < ActionController::TestCase
     dd[:resources][:pipeline_instances][:methods].delete(:index)
     ArvadosApiClient.any_instance.stubs(:discovery).returns(dd)
 
-    get :index, {}, session_for(:active)
+    get :index, params: {}, session: session_for(:active)
     assert_includes @response.body, "zzzzz-xvhdp-cr4runningcntnr" # expect crs
     assert_not_includes @response.body, "zzzzz-d1hrv-"   # expect no pipelines
     assert_includes @response.body, "Run a process"
@@ -29,7 +29,7 @@ class DisabledApiTest < ActionController::TestCase
     dd[:resources][:pipeline_instances][:methods].delete(:index)
     ArvadosApiClient.any_instance.stubs(:discovery).returns(dd)
 
-    get :index, {}, session_for(:active)
+    get :index, params: {}, session: session_for(:active)
     assert_not_includes @response.body, "compute-node-summary-pane"
   end
 
@@ -46,7 +46,7 @@ class DisabledApiTest < ActionController::TestCase
       dd[:resources][ctrl_name][:methods].delete(:index)
       ArvadosApiClient.any_instance.stubs(:discovery).returns(dd)
 
-      get :index, {}, session_for(:active)
+      get :index, params: {}, session: session_for(:active)
       assert_response 404
     end
   end
@@ -68,9 +68,9 @@ class DisabledApiTest < ActionController::TestCase
       proj_uuid = api_fixture('groups')['anonymously_accessible_project']['uuid']
 
       if user
-        get(:show, {id: proj_uuid}, session_for(user))
+        get(:show, params: {id: proj_uuid}, session: session_for(user))
       else
-        get(:show, {id: proj_uuid})
+        get(:show, params: {id: proj_uuid})
       end
 
       resp = @response.body
index f854eaa77fae4723e00bda563441c2c1a2f59e64..29a8efc24f8630188e653deabfead02541ddfe91 100644 (file)
@@ -6,22 +6,22 @@ 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
 
   test "job page lists pipelines and jobs in which it is used" do
     get(:show,
-        {id: api_fixture('jobs')['completed_job_in_publicly_accessible_project']['uuid']},
-        session_for(:active))
+        params: {id: api_fixture('jobs')['completed_job_in_publicly_accessible_project']['uuid']},
+        session: session_for(:active))
     assert_response :success
 
     assert_select "div.used-in-pipelines" do
-      assert_select "a[href=/pipeline_instances/zzzzz-d1hrv-n68vc490mloy4fi]"
+      assert_select "a[href=\"/pipeline_instances/zzzzz-d1hrv-n68vc490mloy4fi\"]"
     end
 
     assert_select "div.used-in-jobs" do
-      assert_select "a[href=/jobs/zzzzz-8i9sb-with2components]"
+      assert_select "a[href=\"/jobs/zzzzz-8i9sb-with2components\"]"
     end
   end
 end
index 6887cac8924e182ae3b9e881f1ec2356dcf9fbf2..c76244d11cd1538e1584701ca4894a7318ef87c4 100644 (file)
@@ -10,12 +10,12 @@ class PipelineInstancesControllerTest < ActionController::TestCase
   def create_instance_long_enough_to(instance_attrs={})
     # create 'two_part' pipeline with the given instance attributes
     pt_fixture = api_fixture('pipeline_templates')['two_part']
-    post :create, {
+    post :create, params: {
       pipeline_instance: instance_attrs.merge({
         pipeline_template_uuid: pt_fixture['uuid']
       }),
       format: :json
-    }, session_for(:active)
+    }, session: session_for(:active)
     assert_response :success
     pi_uuid = assigns(:object).uuid
     assert_not_nil assigns(:object)
@@ -38,14 +38,14 @@ class PipelineInstancesControllerTest < ActionController::TestCase
   test "can render pipeline instance with tagged collections" do
     # Make sure to pass in a tagged collection to test that part of the rendering behavior.
     get(:show,
-        {id: api_fixture("pipeline_instances")["pipeline_with_tagged_collection_input"]["uuid"]},
-        session_for(:active))
+        params: {id: api_fixture("pipeline_instances")["pipeline_with_tagged_collection_input"]["uuid"]},
+        session: session_for(:active))
     assert_response :success
   end
 
   test "update script_parameters one at a time using merge param" do
       template_fixture = api_fixture('pipeline_templates')['two_part']
-      post :update, {
+      post :update, params: {
         id: api_fixture("pipeline_instances")["pipeline_to_merge_params"]["uuid"],
         pipeline_instance: {
           components: {
@@ -63,7 +63,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
         },
         merge: true,
         format: :json
-      }, session_for(:active)
+      }, session: session_for(:active)
       assert_response :success
       assert_not_nil assigns(:object)
       orig_params = template_fixture['components']['part-two']['script_parameters']
@@ -77,15 +77,15 @@ class PipelineInstancesControllerTest < ActionController::TestCase
 
   test "component rendering copes with unexpected components format" do
     get(:show,
-        {id: api_fixture("pipeline_instances")["components_is_jobspec"]["uuid"]},
-        session_for(:active))
+        params: {id: api_fixture("pipeline_instances")["components_is_jobspec"]["uuid"]},
+        session: session_for(:active))
     assert_response :success
   end
 
   test "dates in JSON components are parsed" do
     get(:show,
-        {id: api_fixture('pipeline_instances')['has_component_with_completed_jobs']['uuid']},
-        session_for(:active))
+        params: {id: api_fixture('pipeline_instances')['has_component_with_completed_jobs']['uuid']},
+        session: session_for(:active))
     assert_response :success
     assert_not_nil assigns(:object)
     assert_not_nil assigns(:object).components[:foo][:job]
@@ -103,7 +103,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
 
   test "copy pipeline instance with components=use_latest" do
     post(:copy,
-         {
+         params: {
            id: api_fixture('pipeline_instances')['pipeline_with_newer_template']['uuid'],
            components: 'use_latest',
            script: 'use_latest',
@@ -111,7 +111,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
              state: 'RunningOnServer'
            }
          },
-         session_for(:active))
+         session: session_for(:active))
     assert_response 302
     assert_not_nil assigns(:object)
 
@@ -136,7 +136,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
 
   test "copy pipeline instance on newer template works with script=use_same" do
     post(:copy,
-         {
+         params: {
            id: api_fixture('pipeline_instances')['pipeline_with_newer_template']['uuid'],
            components: 'use_latest',
            script: 'use_same',
@@ -144,7 +144,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
              state: 'RunningOnServer'
            }
          },
-         session_for(:active))
+         session: session_for(:active))
     assert_response 302
     assert_not_nil assigns(:object)
 
index 1f733c48eb0284897cf7ae1060461cc9eb9da961..4752f328a98056d5de770fa2ed344b012a4f0acd 100644 (file)
@@ -7,8 +7,8 @@ require 'test_helper'
 class PipelineTemplatesControllerTest < ActionController::TestCase
   test "component rendering copes with unexpeceted components format" do
     get(:show,
-        {id: api_fixture("pipeline_templates")["components_is_jobspec"]["uuid"]},
-        session_for(:active))
+        params: {id: api_fixture("pipeline_templates")["components_is_jobspec"]["uuid"]},
+        session: session_for(:active))
     assert_response :success
   end
 end
index 21b3361c1612d8df920217b0a43775b9f372a9de..09a6950cead6fad12ce20262c3eda4a6d978d91c 100644 (file)
@@ -9,7 +9,7 @@ class ProjectsControllerTest < ActionController::TestCase
   include ShareObjectHelper
 
   test "invited user is asked to sign user agreements on front page" do
-    get :index, {}, session_for(:inactive)
+    get :index, params: {}, session: session_for(:inactive)
     assert_response :redirect
     assert_match(/^#{Regexp.escape(user_agreements_url)}\b/,
                  @response.redirect_url,
@@ -17,7 +17,7 @@ class ProjectsControllerTest < ActionController::TestCase
   end
 
   test "uninvited user is asked to wait for activation" do
-    get :index, {}, session_for(:inactive_uninvited)
+    get :index, params: {}, session: session_for(:inactive_uninvited)
     assert_response :redirect
     assert_match(/^#{Regexp.escape(inactive_users_url)}\b/,
                  @response.redirect_url,
@@ -28,9 +28,9 @@ class ProjectsControllerTest < ActionController::TestCase
    [:project_viewer, false]].each do |which_user, should_show|
     test "create subproject button #{'not ' unless should_show} shown to #{which_user}" do
       readonly_project_uuid = api_fixture('groups')['aproject']['uuid']
-      get :show, {
+      get :show, params: {
         id: readonly_project_uuid
-      }, session_for(which_user)
+      }, session: session_for(which_user)
       buttons = css_select('[data-method=post]').select do |el|
         el.attributes['data-remote-href'].value.match /project.*owner_uuid.*#{readonly_project_uuid}/
       end
@@ -46,22 +46,22 @@ class ProjectsControllerTest < ActionController::TestCase
   test "sharing a project with a user and group" do
     uuid_list = [api_fixture("groups")["future_project_viewing_group"]["uuid"],
                  api_fixture("users")["future_project_user"]["uuid"]]
-    post(:share_with, {
+    post(:share_with, params: {
            id: api_fixture("groups")["asubproject"]["uuid"],
            uuids: uuid_list,
            format: "json"},
-         session_for(:active))
+         session: session_for(:active))
     assert_response :success
     assert_equal(uuid_list, json_response["success"])
   end
 
   test "user with project read permission can't add permissions" do
     share_uuid = api_fixture("users")["spectator"]["uuid"]
-    post(:share_with, {
+    post(:share_with, params: {
            id: api_fixture("groups")["aproject"]["uuid"],
            uuids: [share_uuid],
            format: "json"},
-         session_for(:project_viewer))
+         session: session_for(:project_viewer))
     assert_response 422
     assert(json_response["errors"].andand.
              any? { |msg| msg.start_with?("#{share_uuid}: ") },
@@ -98,8 +98,8 @@ class ProjectsControllerTest < ActionController::TestCase
     # detected. The test passes quickly, but fails slowly.
     Timeout::timeout 10 do
       get(:show,
-          { id: api_fixture("groups")["project_owns_itself"]["uuid"] },
-          session_for(:admin))
+          params: { id: api_fixture("groups")["project_owns_itself"]["uuid"] },
+          session: session_for(:admin))
     end
     assert_response :success
   end
@@ -111,10 +111,10 @@ class ProjectsControllerTest < ActionController::TestCase
     coll_key = "collection_to_remove_from_subproject"
     coll_uuid = api_fixture("collections")[coll_key]["uuid"]
     delete(:remove_item,
-           { id: api_fixture("groups")["asubproject"]["uuid"],
+           params: { id: api_fixture("groups")["asubproject"]["uuid"],
              item_uuid: coll_uuid,
              format: "js" },
-           session_for(:subproject_admin))
+           session: session_for(:subproject_admin))
     assert_response :success
     assert_match(/\b#{coll_uuid}\b/, @response.body,
                  "removed object not named in response")
@@ -130,10 +130,10 @@ class ProjectsControllerTest < ActionController::TestCase
     # should be implicitly moved to the user's Home project when removed.
     specimen_uuid = api_fixture('specimens', 'in_asubproject')['uuid']
     delete(:remove_item,
-           { id: api_fixture('groups', 'asubproject')['uuid'],
+           params: { id: api_fixture('groups', 'asubproject')['uuid'],
              item_uuid: specimen_uuid,
              format: 'js' },
-           session_for(:subproject_admin))
+           session: session_for(:subproject_admin))
     assert_response :success
     assert_match(/\b#{specimen_uuid}\b/, @response.body,
                  "removed object not named in response")
@@ -151,10 +151,10 @@ class ProjectsControllerTest < ActionController::TestCase
     test "removing #{dm} from a subproject results in renaming it when there is another such object with same name in home project" do
       object = api_fixture(dm, fixture)
       delete(:remove_item,
-             { id: api_fixture('groups', 'asubproject')['uuid'],
+             params: { id: api_fixture('groups', 'asubproject')['uuid'],
                item_uuid: object['uuid'],
                format: 'js' },
-             session_for(:active))
+             session: session_for(:active))
       assert_response :success
       assert_match(/\b#{object['uuid']}\b/, @response.body,
                    "removed object not named in response")
@@ -236,12 +236,12 @@ class ProjectsControllerTest < ActionController::TestCase
     encoded_params = Hash[params.map { |k,v|
                             [k, (v.is_a?(Array) || v.is_a?(Hash)) ? v.to_json : v]
                           }]
-    get :show, encoded_params, session_for(:active)
+    get :show, params: encoded_params, session: session_for(:active)
   end
 
   test "visit non-public project as anonymous when anonymous browsing is enabled and expect page not found" do
     Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
-    get(:show, {id: api_fixture('groups')['aproject']['uuid']})
+    get(:show, params: {id: api_fixture('groups')['aproject']['uuid']})
     assert_response 404
     assert_match(/log ?in/i, @response.body)
   end
@@ -261,7 +261,7 @@ class ProjectsControllerTest < ActionController::TestCase
       Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
 
       if user
-        get :public, {}, session_for(user)
+        get :public, params: {}, session: session_for(user)
       else
         get :public
       end
@@ -276,18 +276,22 @@ class ProjectsControllerTest < ActionController::TestCase
   end
 
   test "visit public projects page when anon config is not enabled as active user and expect 404" do
-    get :public, {}, session_for(:active)
+    Rails.configuration.anonymous_user_token = nil
+    Rails.configuration.enable_public_projects_page = false
+    get :public, params: {}, session: session_for(:active)
     assert_response 404
   end
 
   test "visit public projects page when anon config is enabled but public projects page is disabled as active user and expect 404" do
     Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
     Rails.configuration.enable_public_projects_page = false
-    get :public, {}, session_for(:active)
+    get :public, params: {}, session: session_for(:active)
     assert_response 404
   end
 
   test "visit public projects page when anon config is not enabled as anonymous and expect login page" do
+    Rails.configuration.anonymous_user_token = nil
+    Rails.configuration.enable_public_projects_page = false
     get :public
     assert_response :redirect
     assert_match /\/users\/welcome/, @response.redirect_url
@@ -317,7 +321,7 @@ class ProjectsControllerTest < ActionController::TestCase
     found = Group.find(project['uuid'])
     found.description = 'test description update'
     found.save!
-    get(:show, {id: project['uuid']}, session_for(:active))
+    get(:show, params: {id: project['uuid']}, session: session_for(:active))
     assert_includes @response.body, 'test description update'
   end
 
@@ -327,7 +331,7 @@ class ProjectsControllerTest < ActionController::TestCase
     found = Group.find(project['uuid'])
     found.description = '*test bold description for textile formatting*'
     found.save!
-    get(:show, {id: project['uuid']}, session_for(:active))
+    get(:show, params: {id: project['uuid']}, session: session_for(:active))
     assert_includes @response.body, '<strong>test bold description for textile formatting</strong>'
   end
 
@@ -337,7 +341,7 @@ class ProjectsControllerTest < ActionController::TestCase
     found = Group.find(project['uuid'])
     found.description = '<b>Textile</b> description with link to home page <a href="/">take me home</a>.'
     found.save!
-    get(:show, {id: project['uuid']}, session_for(:active))
+    get(:show, params: {id: project['uuid']}, session: session_for(:active))
     assert_includes @response.body, '<b>Textile</b> description with link to home page <a href="/">take me home</a>.'
   end
 
@@ -347,7 +351,7 @@ class ProjectsControllerTest < ActionController::TestCase
     found = Group.find(project['uuid'])
     found.description = 'Textile description with unsafe script tag <script language="javascript">alert("Hello there")</script>.'
     found.save!
-    get(:show, {id: project['uuid']}, session_for(:active))
+    get(:show, params: {id: project['uuid']}, session: session_for(:active))
     assert_includes @response.body, 'Textile description with unsafe script tag alert("Hello there").'
   end
 
@@ -364,7 +368,7 @@ EOT
     found = Group.find(project['uuid'])
     found.description = textile_table
     found.save!
-    get(:show, {id: project['uuid']}, session_for(:active))
+    get(:show, params: {id: project['uuid']}, session: session_for(:active))
     assert_includes @response.body, '<th>First Header'
     assert_includes @response.body, '<td>Content Cell'
   end
@@ -377,7 +381,7 @@ EOT
     # uses 'Link to object' as a hyperlink for the object
     found.description = '"Link to object":' + api_fixture('groups')['asubproject']['uuid']
     found.save!
-    get(:show, {id: project['uuid']}, session_for(:active))
+    get(:show, params: {id: project['uuid']}, session: session_for(:active))
 
     # check that input was converted to textile, not staying as inputted
     refute_includes  @response.body,'"Link to object"'
@@ -386,7 +390,7 @@ EOT
 
   test "project viewer can't see project sharing tab" do
     project = api_fixture('groups')['aproject']
-    get(:show, {id: project['uuid']}, session_for(:project_viewer))
+    get(:show, params: {id: project['uuid']}, session: session_for(:project_viewer))
     refute_includes @response.body, '<div id="Sharing"'
     assert_includes @response.body, '<div id="Data_collections"'
   end
@@ -397,7 +401,7 @@ EOT
   ].each do |username|
     test "#{username} can see project sharing tab" do
      project = api_fixture('groups')['aproject']
-     get(:show, {id: project['uuid']}, session_for(username))
+     get(:show, params: {id: project['uuid']}, session: session_for(username))
      assert_includes @response.body, '<div id="Sharing"'
      assert_includes @response.body, '<div id="Data_collections"'
     end
@@ -409,7 +413,7 @@ EOT
     ['project_viewer',false],
   ].each do |user, can_move|
     test "#{user} can move subproject from project #{can_move}" do
-      get(:show, {id: api_fixture('groups')['aproject']['uuid']}, session_for(user))
+      get(:show, params: {id: api_fixture('groups')['aproject']['uuid']}, session: session_for(user))
       if can_move
         assert_includes @response.body, 'Move project...'
       else
@@ -423,7 +427,7 @@ EOT
     [:active, false],
   ].each do |user, expect_all_nodes|
     test "in dashboard other index page links as #{user}" do
-      get :index, {}, session_for(user)
+      get :index, params: {}, session: session_for(user)
 
       [["processes", "/all_processes"],
        ["collections", "/collections"],
@@ -443,7 +447,7 @@ EOT
   end
 
   test "dashboard should show the correct status for processes" do
-    get :index, {}, session_for(:active)
+    get :index, params: {}, session: session_for(:active)
     assert_select 'div.panel-body.recent-processes' do
       [
         {
@@ -499,7 +503,7 @@ EOT
   test "visit a public project and verify the public projects page link exists" do
     Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
     uuid = api_fixture('groups')['anonymously_accessible_project']['uuid']
-    get :show, {id: uuid}
+    get :show, params: {id: uuid}
     project = assigns(:object)
     assert_equal uuid, project['uuid']
     refute_empty css_select("[href=\"/projects/#{project['uuid']}\"]")
@@ -509,12 +513,12 @@ EOT
   test 'all_projects unaffected by params after use by ProjectsController (#6640)' do
     @controller = ProjectsController.new
     project_uuid = api_fixture('groups')['aproject']['uuid']
-    get :index, {
+    get :index, params: {
       filters: [['uuid', '<', project_uuid]].to_json,
       limit: 0,
       offset: 1000,
-    }, session_for(:active)
-    assert_select "#projects-menu + ul li.divider ~ li a[href=/projects/#{project_uuid}]"
+    }, session: session_for(:active)
+    assert_select "#projects-menu + ul li.divider ~ li a[href=\"/projects/#{project_uuid}\"]"
   end
 
   [
@@ -580,7 +584,7 @@ EOT
 
     # share it again
     @controller = LinksController.new
-    post :create, {
+    post :create, params: {
       link: {
         link_class: 'permission',
         name: 'can_read',
@@ -588,7 +592,7 @@ EOT
         tail_uuid: api_fixture('users')['project_viewer']['uuid'],
       },
       format: :json
-    }, session_for(:system_user)
+    }, session: session_for(:system_user)
 
     # verify that the project is again included in starred projects
     use_token :project_viewer
index b81e2384c98db7975349e0ea4a4c387f95223a2a..a5d72097649c0302cffa6bd18970505ff8803ff4 100644 (file)
@@ -17,11 +17,11 @@ class RepositoriesControllerTest < ActionController::TestCase
     test "#{user} shares repository with a user and group" do
       uuid_list = [api_fixture("groups")["future_project_viewing_group"]["uuid"],
                    api_fixture("users")["future_project_user"]["uuid"]]
-      post(:share_with, {
+      post(:share_with, params: {
              id: api_fixture("repositories")["foo"]["uuid"],
              uuids: uuid_list,
              format: "json"},
-           session_for(user))
+           session: session_for(user))
       assert_response :success
       assert_equal(uuid_list, json_response["success"])
     end
@@ -29,11 +29,11 @@ class RepositoriesControllerTest < ActionController::TestCase
 
   test "user with repository read permission cannot add permissions" do
     share_uuid = api_fixture("users")["project_viewer"]["uuid"]
-    post(:share_with, {
+    post(:share_with, params: {
            id: api_fixture("repositories")["arvados"]["uuid"],
            uuids: [share_uuid],
            format: "json"},
-         session_for(:spectator))
+         session: session_for(:spectator))
     assert_response 422
     assert(json_response["errors"].andand.
              any? { |msg| msg.start_with?("#{share_uuid}: ") },
@@ -57,9 +57,9 @@ class RepositoriesControllerTest < ActionController::TestCase
     [:admin,  ['#Attributes', '#Sharing', '#Advanced']],
   ].each do |user, expected_panes|
     test "#{user} sees panes #{expected_panes}" do
-      get :show, {
+      get :show, params: {
         id: api_fixture('repositories')['foo']['uuid']
-      }, session_for(user)
+      }, session: session_for(user)
       assert_response :success
 
       panes = css_select('[data-toggle=tab]').each do |pane|
@@ -75,10 +75,10 @@ class RepositoriesControllerTest < ActionController::TestCase
     test "show tree to #{user}" do
       reset_api_fixtures_after_test false
       sha1, _, _ = stub_repo_content
-      get :show_tree, {
+      get :show_tree, params: {
         id: api_fixture('repositories')['foo']['uuid'],
         commit: sha1,
-      }, session_for(user)
+      }, session: session_for(user)
       assert_response :success
       assert_select 'tr td a', 'COPYING'
       assert_select 'tr td', '625 bytes'
@@ -91,10 +91,10 @@ class RepositoriesControllerTest < ActionController::TestCase
     test "show commit to #{user}" do
       reset_api_fixtures_after_test false
       sha1, commit, _ = stub_repo_content
-      get :show_commit, {
+      get :show_commit, params: {
         id: api_fixture('repositories')['foo']['uuid'],
         commit: sha1,
-      }, session_for(user)
+      }, session: session_for(user)
       assert_response :success
       assert_select 'pre', commit
     end
@@ -102,11 +102,11 @@ class RepositoriesControllerTest < ActionController::TestCase
     test "show blob to #{user}" do
       reset_api_fixtures_after_test false
       sha1, _, filedata = stub_repo_content filename: 'COPYING'
-      get :show_blob, {
+      get :show_blob, params: {
         id: api_fixture('repositories')['foo']['uuid'],
         commit: sha1,
         path: 'COPYING',
-      }, session_for(user)
+      }, session: session_for(user)
       assert_response :success
       assert_select 'pre', filedata
     end
@@ -116,11 +116,11 @@ class RepositoriesControllerTest < ActionController::TestCase
     test "show tree with path '#{path}'" do
       reset_api_fixtures_after_test false
       sha1, _, _ = stub_repo_content filename: 'COPYING'
-      get :show_tree, {
+      get :show_tree, params: {
         id: api_fixture('repositories')['foo']['uuid'],
         commit: sha1,
         path: path,
-      }, session_for(:active)
+      }, session: session_for(:active)
       assert_response :success
       assert_select 'tr td', 'COPYING'
     end
@@ -131,7 +131,7 @@ class RepositoriesControllerTest < ActionController::TestCase
       partial: :repositories_rows,
       format: :json,
     }
-    get :index, params, session_for(:active)
+    get :index, params: params, session: session_for(:active)
     assert_response :success
     repos = assigns(:objects)
     assert repos
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 40a017b3ede18e8de81eee17a631f54dfab40888..c4090f0cef7dde572f3faec563b006c2bf3883fe 100644 (file)
@@ -8,10 +8,10 @@ class TrashItemsControllerTest < ActionController::TestCase
   test "untrash collection with same name as another collection" do
     collection = api_fixture('collections')['trashed_collection_to_test_name_conflict_on_untrash']
     items = [collection['uuid']]
-    post :untrash_items, {
+    post :untrash_items, params: {
       selection: items,
       format: :js
-    }, session_for(:active)
+    }, session: session_for(:active)
 
     assert_response :success
   end
index 1733058a4794af160b161e24a1e7cb6d77a663f9..4c6e41dcee16af57f0fa349487770fcca96e66af 100644 (file)
@@ -6,12 +6,12 @@ require 'test_helper'
 
 class UserAgreementsControllerTest < ActionController::TestCase
   test 'User agreements page shows form if some user agreements are not signed' do
-    get :index, {}, session_for(:inactive)
+    get :index, params: {}, session: session_for(:inactive)
     assert_response 200
   end
 
   test 'User agreements page redirects if all user agreements signed' do
-    get :index, {return_to: root_path}, session_for(:active)
+    get :index, params: {return_to: root_path}, session: session_for(:active)
     assert_response :redirect
     assert_equal(root_url,
                  @response.redirect_url,
index 393b864dc53a61f3a81a91af6abd49e836a5e831..57b8705963d752e41123fcb094f1f4505a8a3862 100644 (file)
@@ -7,12 +7,12 @@ require 'test_helper'
 class UsersControllerTest < ActionController::TestCase
 
   test "valid token works in controller test" do
-    get :index, {}, session_for(:active)
+    get :index, params: {}, session: session_for(:active)
     assert_response :success
   end
 
   test "ignore previously valid token (for deleted user), don't crash" do
-    get :activity, {}, session_for(:valid_token_deleted_user)
+    get :activity, params: {}, session: session_for(:valid_token_deleted_user)
     assert_response :redirect
     assert_match /^#{Rails.configuration.arvados_login_base}/, @response.redirect_url
     assert_nil assigns(:my_jobs)
@@ -20,9 +20,9 @@ class UsersControllerTest < ActionController::TestCase
   end
 
   test "expired token redirects to api server login" do
-    get :show, {
+    get :show, params: {
       id: api_fixture('users')['active']['uuid']
-    }, session_for(:expired_trustedclient)
+    }, session: session_for(:expired_trustedclient)
     assert_response :redirect
     assert_match /^#{Rails.configuration.arvados_login_base}/, @response.redirect_url
     assert_nil assigns(:my_jobs)
@@ -30,15 +30,15 @@ class UsersControllerTest < ActionController::TestCase
   end
 
   test "show welcome page if no token provided" do
-    get :index, {}
+    get :index, params: {}
     assert_response :redirect
     assert_match /\/users\/welcome/, @response.redirect_url
   end
 
   test "'log in as user' feature uses a v2 token" do
-    post :sudo, {
+    post :sudo, params: {
       id: api_fixture('users')['active']['uuid']
-    }, session_for('admin_trustedclient')
+    }, session: session_for('admin_trustedclient')
     assert_response :redirect
     assert_match /api_token=v2%2F/, @response.redirect_url
   end
@@ -48,10 +48,10 @@ class UsersControllerTest < ActionController::TestCase
 
     ActionMailer::Base.deliveries = []
 
-    post :request_shell_access, {
+    post :request_shell_access, params: {
       id: user['uuid'],
       format: 'js'
-    }, session_for(:spectator)
+    }, session: session_for(:spectator)
     assert_response :success
 
     full_name = "#{user['first_name']} #{user['last_name']}"
@@ -73,7 +73,7 @@ class UsersControllerTest < ActionController::TestCase
     test "access users page as #{username} and verify show button is available" do
       admin_user = api_fixture('users','admin')
       active_user = api_fixture('users','active')
-      get :index, {}, session_for(username)
+      get :index, params: {}, session: session_for(username)
       if username == 'admin'
         assert_match /<a href="\/projects\/#{admin_user['uuid']}">Home<\/a>/, @response.body
         assert_match /<a href="\/projects\/#{active_user['uuid']}">Home<\/a>/, @response.body
@@ -97,9 +97,9 @@ class UsersControllerTest < ActionController::TestCase
     test "access settings drop down menu as #{username}" do
       admin_user = api_fixture('users','admin')
       active_user = api_fixture('users','active')
-      get :show, {
+      get :show, params: {
         id: api_fixture('users')[username]['uuid']
-      }, session_for(username)
+      }, session: session_for(username)
       if username == 'admin'
         assert_includes @response.body, admin_user['email']
         refute_empty css_select('[id="system-menu"]')
index a698b8df3c773c4b0f66e5b4625b3f255d42780d..6f74955cd1c8d0940c979b70867a6cbbfda5aacb 100644 (file)
@@ -67,6 +67,6 @@ class WorkUnitsControllerTest < ActionController::TestCase
     encoded_params = Hash[params.map { |k,v|
                             [k, (v.is_a?(Array) || v.is_a?(Hash)) ? v.to_json : v]
                           }]
-    get :index, encoded_params, session_for(:active)
+    get :index, params: encoded_params, session: session_for(:active)
   end
 end
index d73809a26688df7f09ef0e1793aecef431512c30..0877e59328dbe6454460b7bbf09f5cd1d739b1d9 100644 (file)
@@ -6,7 +6,7 @@ require 'test_helper'
 
 class WorkflowsControllerTest < ActionController::TestCase
   test "index" do
-    get :index, {}, session_for(:active)
+    get :index, params: {}, session: session_for(:active)
     assert_response :success
     assert_includes @response.body, 'Valid workflow with no definition yaml'
   end
@@ -16,7 +16,7 @@ class WorkflowsControllerTest < ActionController::TestCase
 
     wf = api_fixture('workflows')['workflow_with_input_specifications']
 
-    get :show, {id: wf['uuid']}, session_for(:active)
+    get :show, params: {id: wf['uuid']}, session: session_for(:active)
     assert_response :success
 
     assert_includes @response.body, "a short label for this parameter (optional)"
diff --git a/apps/workbench/test/functional/.gitkeep b/apps/workbench/test/functional/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
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
diff --git a/apps/workbench/test/mailers/.gitkeep b/apps/workbench/test/mailers/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/workbench/test/models/.gitkeep b/apps/workbench/test/models/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
index 8435eb4b7c6331f54483a3b363d1af67f1c7521b..bbd733bb47d98d345381763476c9dd48c5f6f883 100644 (file)
@@ -26,7 +26,7 @@ end
 
 require File.expand_path('../../config/environment', __FILE__)
 require 'rails/test_help'
-require 'mocha/mini_test'
+require 'mocha/minitest'
 
 class ActiveSupport::TestCase
   # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in
index 1daf582553bf5ce0283e2cd4dfc0550753ca846e..eaf65c578dbfb3afbfbdbe3d39081ee25cdee778 100644 (file)
@@ -32,12 +32,18 @@ class WorkUnitTest < ActiveSupport::TestCase
 
       if label != nil
         assert_equal(label, wu.label)
+      elsif obj.name.nil?
+        assert_nil(wu.label)
       else
         assert_equal(obj.name, wu.label)
       end
       assert_equal(obj['uuid'], wu.uuid)
       assert_equal(state, wu.state_label)
-      assert_equal(success, wu.success?)
+      if success.nil?
+        assert_nil(wu.success?)
+      else
+        assert_equal(success, wu.success?)
+      end
       assert_equal(progress, wu.progress)
 
       assert_equal(num_children, wu.children.size)
@@ -74,7 +80,11 @@ class WorkUnitTest < ActiveSupport::TestCase
       if walltime
         assert_equal true, (wu.walltime >= walltime)
       else
-        assert_equal walltime, wu.walltime
+        if walltime.nil?
+          assert_nil wu.walltime
+        else
+          assert_equal walltime, wu.walltime
+        end
       end
 
       if cputime
@@ -85,6 +95,8 @@ class WorkUnitTest < ActiveSupport::TestCase
 
       if queuedtime
         assert_equal true, (wu.queuedtime >= queuedtime)
+      elsif queuedtime.nil?
+        assert_nil wu.queuedtime
       else
         assert_equal queuedtime, wu.queuedtime
       end
index d9dd1bbdd3d093e411a479712495ecd0d9849018..68fc15183e5a55cb488cab48c7f9a83367f6c075 100755 (executable)
@@ -1051,7 +1051,11 @@ test_gofmt() {
 test_services/api() {
     rm -f "$WORKSPACE/services/api/git-commit.version"
     cd "$WORKSPACE/services/api" \
+<<<<<<< HEAD
+        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec bin/rails test TESTOPTS='-v -d' ${testargs[services/api]}
+=======
         && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test TESTOPTS='-v -d' ${testargs[services/api]}
+>>>>>>> master
 }
 
 test_sdk/ruby() {
@@ -1088,17 +1092,17 @@ test_services/nodemanager_integration() {
 
 test_apps/workbench_units() {
     cd "$WORKSPACE/apps/workbench" \
-        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:units TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_units]}
+        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:units TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_units]}
 }
 
 test_apps/workbench_functionals() {
     cd "$WORKSPACE/apps/workbench" \
-        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:functionals TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]}
+        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:functionals TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]}
 }
 
 test_apps/workbench_integration() {
     cd "$WORKSPACE/apps/workbench" \
-        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:integration TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]}
+        && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:integration TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]}
 }
 
 test_apps/workbench_benchmark() {