From 98e63a2ff03773d937489d7258222d3f7e29d141 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 8 Jun 2017 21:45:36 -0400 Subject: [PATCH] Upgraded to Rails 5.1.1 --- Gemfile | 12 +- Gemfile.lock | 154 +++++++++--------- app/controllers/application_controller.rb | 2 +- app/controllers/mats_controller.rb | 4 +- app/controllers/schools_controller.rb | 4 +- app/controllers/tournaments_controller.rb | 8 +- app/controllers/weights_controller.rb | 2 +- app/controllers/wrestlers_controller.rb | 2 +- config/environments/production.rb | 4 +- config/environments/test.rb | 4 +- rails-dev-Dockerfile | 2 +- rails-prod-Dockerfile | 2 +- test/controllers/matches_controller_test.rb | 6 +- test/controllers/mats_controller_test.rb | 14 +- test/controllers/schools_controller_test.rb | 14 +- .../static_pages_controller_test.rb | 2 +- .../tournaments_controller_test.rb | 80 ++++----- test/controllers/weights_controller_test.rb | 14 +- test/controllers/wrestlers_controller_test.rb | 14 +- 19 files changed, 174 insertions(+), 170 deletions(-) diff --git a/Gemfile b/Gemfile index adeb6f3..cb9522d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,15 @@ source 'https://rubygems.org' -ruby '2.3.0' +ruby '2.4.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.5' +gem 'rails', '5.1.1' # Use sqlite3 as the database for Active Record gem 'sqlite3', :group => :development # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' +gem 'uglifier' # Use CoffeeScript for .js.coffee assets and views -gem 'coffee-rails', '~> 4.0.0' +gem 'coffee-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby @@ -18,9 +18,9 @@ gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.0' +gem 'jbuilder' # bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', :group => :doc +gem 'sdoc', :group => :doc # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring', :group => :development diff --git a/Gemfile.lock b/Gemfile.lock index 809fbf7..890e589 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,63 +1,65 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.5) - actionpack (= 4.2.5) - actionview (= 4.2.5) - activejob (= 4.2.5) + actioncable (5.1.1) + actionpack (= 5.1.1) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.5) - actionview (= 4.2.5) - activesupport (= 4.2.5) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.1.1) + actionview (= 5.1.1) + activesupport (= 5.1.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.5) - activesupport (= 4.2.5) + actionview (5.1.1) + activesupport (= 5.1.1) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.5) - activesupport (= 4.2.5) - globalid (>= 0.3.0) - activemodel (4.2.5) - activesupport (= 4.2.5) - builder (~> 3.1) - activerecord (4.2.5) - activemodel (= 4.2.5) - activesupport (= 4.2.5) - arel (~> 6.0) - activesupport (4.2.5) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.1) + activesupport (= 5.1.1) + globalid (>= 0.3.6) + activemodel (5.1.1) + activesupport (= 5.1.1) + activerecord (5.1.1) + activemodel (= 5.1.1) + activesupport (= 5.1.1) + arel (~> 8.0) + activesupport (5.1.1) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.4) + arel (8.0.0) ast (2.3.0) bcrypt (3.1.11) - brakeman (3.6.1) + brakeman (3.6.2) builder (3.2.3) bullet (5.5.1) activesupport (>= 3.0.0) uniform_notifier (~> 1.10.0) cancancan (2.0.0) - coffee-rails (4.0.1) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.0.5) dalli (2.7.6) - delayed_job (4.1.2) - activesupport (>= 3.0, < 5.1) - delayed_job_active_record (4.1.1) - activerecord (>= 3.0, < 5.1) + delayed_job (4.1.3) + activesupport (>= 3.0, < 5.2) + delayed_job_active_record (4.1.2) + activerecord (>= 3.0, < 5.2) delayed_job (>= 3.0, < 5) devise (4.3.0) bcrypt (~> 3.0) @@ -65,13 +67,13 @@ GEM railties (>= 4.1.0, < 5.2) responders warden (~> 1.2.3) - erubis (2.7.0) + erubi (1.6.0) execjs (2.7.0) globalid (0.4.0) activesupport (>= 4.2.0) - i18n (0.8.1) - jbuilder (2.6.4) - activesupport (>= 3.0.0) + i18n (0.8.4) + jbuilder (2.7.0) + activesupport (>= 4.2.0) multi_json (>= 1.2) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) @@ -83,42 +85,42 @@ GEM nokogiri (>= 1.5.9) mail (2.6.5) mime-types (>= 1.16, < 4) + method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) + mini_portile2 (2.2.0) minitest (5.10.2) multi_json (1.12.1) mysql2 (0.4.6) - newrelic_rpm (4.1.0.333) - nokogiri (1.7.2) - mini_portile2 (~> 2.1.0) + newrelic_rpm (4.2.0.334) + nio4r (2.1.0) + nokogiri (1.8.0) + mini_portile2 (~> 2.2.0) orm_adapter (0.5.0) parallel (1.11.2) parser (2.4.0.0) ast (~> 2.2) powerpack (0.1.1) - puma (3.8.2) - rack (1.6.8) + puma (3.9.1) + rack (2.0.3) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.5) - actionmailer (= 4.2.5) - actionpack (= 4.2.5) - actionview (= 4.2.5) - activejob (= 4.2.5) - activemodel (= 4.2.5) - activerecord (= 4.2.5) - activesupport (= 4.2.5) + rails (5.1.1) + actioncable (= 5.1.1) + actionmailer (= 5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) + activemodel (= 5.1.1) + activerecord (= 5.1.1) + activesupport (= 5.1.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.5) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.8) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + railties (= 5.1.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) rails_12factor (0.0.3) @@ -126,9 +128,10 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (4.2.5) - actionpack (= 4.2.5) - activesupport (= 4.2.5) + railties (5.1.1) + actionpack (= 5.1.1) + activesupport (= 5.1.1) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.2) @@ -152,7 +155,7 @@ GEM sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - spring (2.0.1) + spring (2.0.2) activesupport (>= 4.2) sprockets (3.7.1) concurrent-ruby (~> 1.0) @@ -178,6 +181,9 @@ GEM uniform_notifier (1.10.0) warden (1.2.7) rack (>= 1.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) PLATFORMS ruby @@ -186,29 +192,29 @@ DEPENDENCIES brakeman bullet cancancan - coffee-rails (~> 4.0.0) + coffee-rails dalli delayed_job_active_record devise - jbuilder (~> 2.0) + jbuilder jquery-rails mysql2 newrelic_rpm puma - rails (= 4.2.5) + rails (= 5.1.1) rails_12factor rb-readline round_robin_tournament rubocop - sdoc (~> 0.4.0) + sdoc spring sqlite3 therubyracer turbolinks - uglifier (>= 1.3.0) + uglifier RUBY VERSION - ruby 2.3.0p0 + ruby 2.4.0p0 BUNDLED WITH - 1.15.0 + 1.15.1 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a9f6dc6..3a110d7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - after_filter :set_csrf_cookie_for_ng + after_action :set_csrf_cookie_for_ng def set_csrf_cookie_for_ng cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery? diff --git a/app/controllers/mats_controller.rb b/app/controllers/mats_controller.rb index 6b517c9..782c39e 100644 --- a/app/controllers/mats_controller.rb +++ b/app/controllers/mats_controller.rb @@ -1,7 +1,7 @@ class MatsController < ApplicationController before_action :set_mat, only: [:show, :edit, :update, :destroy] - before_filter :check_access, only: [:new,:create,:update,:destroy,:edit,:show] - before_filter :check_for_matches, only: [:show] + before_action :check_access, only: [:new,:create,:update,:destroy,:edit,:show] + before_action :check_for_matches, only: [:show] # GET /mats/1 # GET /mats/1.json diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index b651c99..41ade29 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -1,7 +1,7 @@ class SchoolsController < ApplicationController before_action :set_school, only: [:show, :edit, :update, :destroy] - before_filter :check_access_director, only: [:new,:create,:destroy] - before_filter :check_access_delegate, only: [:update,:edit] + before_action :check_access_director, only: [:new,:create,:destroy] + before_action :check_access_delegate, only: [:update,:edit] # GET /schools/1 diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 0f443b6..fede68b 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -1,9 +1,9 @@ class TournamentsController < ApplicationController before_action :set_tournament, only: [:swap,:weigh_in_sheet,:error,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:remove_delegate,:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets] - before_filter :check_access_manage, only: [:swap,:weigh_in_sheet,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches] - before_filter :check_access_destroy, only: [:destroy,:delegate,:remove_delegate] - before_filter :check_tournament_errors, only: [:generate_matches] - before_filter :check_for_matches, only: [:up_matches,:bracket,:all_brackets] + before_action :check_access_manage, only: [:swap,:weigh_in_sheet,:teampointadjust,:remove_teampointadjust,:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches] + before_action :check_access_destroy, only: [:destroy,:delegate,:remove_delegate] + before_action :check_tournament_errors, only: [:generate_matches] + before_action :check_for_matches, only: [:up_matches,:bracket,:all_brackets] def weigh_in_sheet diff --git a/app/controllers/weights_controller.rb b/app/controllers/weights_controller.rb index 02e17af..cb5cd76 100644 --- a/app/controllers/weights_controller.rb +++ b/app/controllers/weights_controller.rb @@ -1,6 +1,6 @@ class WeightsController < ApplicationController before_action :set_weight, only: [:show, :edit, :update, :destroy,:re_gen] - before_filter :check_access, only: [:new,:create,:update,:destroy,:edit, :re_gen] + before_action :check_access, only: [:new,:create,:update,:destroy,:edit, :re_gen] # GET /weights/1 diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index e83a7c6..e671465 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -1,6 +1,6 @@ class WrestlersController < ApplicationController before_action :set_wrestler, only: [:show, :edit, :update, :destroy] - before_filter :check_access, only: [:new,:create,:update,:destroy,:edit] + before_action :check_access, only: [:new,:create,:update,:destroy,:edit] diff --git a/config/environments/production.rb b/config/environments/production.rb index 44552b6..582ed0d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -90,7 +90,7 @@ Wrestling::Application.configure do #THESE ADDED BY ME TO GET RAILS 4 WORKING IN HEROKU config.cache_classes = true - config.serve_static_files = true + config.public_file_server.enabled = true config.assets.compile = true config.assets.digest = true @@ -111,6 +111,4 @@ Wrestling::Application.configure do #Devise needs origin of email Rails.application.routes.default_url_options[:host] = 'https://wrestlingdev.com' - #For lineman creating assets - config.serve_static_files = true end diff --git a/config/environments/test.rb b/config/environments/test.rb index 476d5e3..6e4b153 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,8 +13,8 @@ Wrestling::Application.configure do config.eager_load = false # 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/rails-dev-Dockerfile b/rails-dev-Dockerfile index c684759..17a6891 100644 --- a/rails-dev-Dockerfile +++ b/rails-dev-Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.3.0 +FROM ruby:2.4.0 RUN apt-get update diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index 1b3072f..471cd64 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.3.0 +FROM ruby:2.4.0 RUN apt-get clean RUN apt-get update diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb index 12d6ca0..e17cf75 100644 --- a/test/controllers/matches_controller_test.rb +++ b/test/controllers/matches_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class MatchesControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,11 +10,11 @@ class MatchesControllerTest < ActionController::TestCase end def post_update - patch :update, id: @match.id, match: {tournament_id: 1, mat_id: 1} + patch :update, params: { id: @match.id, match: {tournament_id: 1, mat_id: 1} } end def get_edit - get :edit, id: @match.id + get :edit, params: { id: @match.id } end def sign_in_owner diff --git a/test/controllers/mats_controller_test.rb b/test/controllers/mats_controller_test.rb index 38de270..77ff092 100644 --- a/test/controllers/mats_controller_test.rb +++ b/test/controllers/mats_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class MatsControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,27 +10,27 @@ class MatsControllerTest < ActionController::TestCase end def create - post :create, mat: {name: 'Mat100', tournament_id: 1} + post :create, params: { mat: {name: 'Mat100', tournament_id: 1} } end def new - get :new, tournament: @tournament.id + get :new, params: { tournament: @tournament.id } end def show - get :show, id: 1 + get :show, params: { id: 1 } end def post_update - patch :update, id: @mat.id, mat: {name: @mat.name, tournament_id: @mat.tournament_id} + patch :update, params: { id: @mat.id, mat: {name: @mat.name, tournament_id: @mat.tournament_id} } end def destroy - delete :destroy, id: @mat.id + delete :destroy, params: { id: @mat.id } end def get_edit - get :edit, id: @mat.id + get :edit, params: { id: @mat.id } end def sign_in_owner diff --git a/test/controllers/schools_controller_test.rb b/test/controllers/schools_controller_test.rb index eee17d7..ce4ca3f 100644 --- a/test/controllers/schools_controller_test.rb +++ b/test/controllers/schools_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class SchoolsControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,23 +10,23 @@ class SchoolsControllerTest < ActionController::TestCase end def create - post :create, school: {name: 'Testaasdf', tournament_id: 1} + post :create, params: { school: {name: 'Testaasdf', tournament_id: 1} } end def new - get :new, tournament: @tournament.id + get :new, params: { tournament: @tournament.id } end def post_update - patch :update, id: @school.id, school: {name: @school.name, tournament_id: @school.tournament_id} + patch :update, params: { id: @school.id, school: {name: @school.name, tournament_id: @school.tournament_id} } end def destroy - delete :destroy, id: @school.id + delete :destroy, params: { id: @school.id } end def get_edit - get :edit, id: @school.id + get :edit, params: { id: @school.id } end def sign_in_owner @@ -168,7 +168,7 @@ class SchoolsControllerTest < ActionController::TestCase end test "view school" do - get :show, id: 1 + get :show, params: { id: 1 } success end diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb index 2eb9388..fdf52cb 100644 --- a/test/controllers/static_pages_controller_test.rb +++ b/test/controllers/static_pages_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class StaticPagesControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb index 707c6b3..ae2e1c2 100644 --- a/test/controllers/tournaments_controller_test.rb +++ b/test/controllers/tournaments_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class TournamentsControllerTest < ActionController::TestCase -include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -12,11 +12,11 @@ include Devise::TestHelpers end def post_update - patch :update, id: 1, tournament: {name: @tournament.name} + patch :update, params: { id: 1, tournament: {name: @tournament.name} } end def get_edit - get :edit, id: 1 + get :edit, params: { id: 1 } end def sign_in_owner @@ -44,7 +44,7 @@ include Devise::TestHelpers end def destroy - delete :destroy, id: 1 + delete :destroy, params: { id: 1 } end def no_matches @@ -57,91 +57,91 @@ include Devise::TestHelpers test "logged in tournament owner can generate matches" do sign_in_owner - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } success end test "logged in non tournament owner cannot generate matches" do sign_in_non_owner - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } redirect end test "logged in school delegate cannot generate matches" do sign_in_school_delegate - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } redirect end test "logged in tournament owner can create custom weights" do sign_in_owner - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } assert_redirected_to '/tournaments/1' end test "logged in non tournament owner cannot create custom weights" do sign_in_non_owner - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } redirect end test "logged in school delegate cannot create custom weights" do sign_in_school_delegate - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } redirect end test "logged in tournament owner can access weigh_ins" do sign_in_owner - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } success end test "logged in non tournament owner cannot access weigh_ins" do sign_in_non_owner - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } redirect end test "logged in school delegate cannot access weigh_ins" do sign_in_school_delegate - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } redirect end test "logged in tournament owner can access weigh_in_weight" do sign_in_owner - get :weigh_in, id: 1, weight: 1 + get :weigh_in, params: { id: 1, weight: 1 } success end test "logged in non tournament owner cannot access weigh_in_weight" do sign_in_non_owner - get :weigh_in_weight, id: 1, weight: 1 + get :weigh_in_weight, params: { id: 1, weight: 1 } redirect end test "logged in school delegate cannot access weigh_in_weight" do sign_in_school_delegate - get :weigh_in_weight, id: 1, weight: 1 + get :weigh_in_weight, params: { id: 1, weight: 1 } redirect end test "logged in tournament owner can access post weigh_in_weight" do sign_in_owner - post :weigh_in, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in, params: { id: 1, weight: 1, wrestler: @wrestlers } end test "logged in non tournament owner cannot access post weigh_in_weight" do sign_in_non_owner - post :weigh_in_weight, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in_weight, params: { id: 1, weight: 1, wrestler: @wrestlers } redirect end test "logged in school delegate cannot access post weigh_in_weight" do sign_in_school_delegate - post :weigh_in_weight, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in_weight, params: { id: 1, weight: 1, wrestler: @wrestlers } redirect end @@ -216,38 +216,38 @@ include Devise::TestHelpers test "redirect up_matches if no matches" do sign_in_owner wipe - get :up_matches, id: 1 + get :up_matches, params: { id: 1 } no_matches end test "redirect bracket if no matches" do sign_in_owner wipe - get :bracket, id: 1, weight: 1 + get :bracket, params: { id: 1, weight: 1 } no_matches end test "logged in tournament delegate can generate matches" do sign_in_delegate - get :generate_matches, id: 1 + get :generate_matches, params: { id: 1 } success end test "logged in tournament delegate can create custom weights" do sign_in_delegate - get :create_custom_weights, id: 1, customValue: 'hs' + get :create_custom_weights, params: { id: 1, customValue: 'hs' } assert_redirected_to '/tournaments/1' end test "logged in tournament delegate can access weigh_ins" do sign_in_delegate - get :weigh_in, id: 1 + get :weigh_in, params: { id: 1 } success end test "logged in tournament delegate can access weigh_in_weight" do sign_in_delegate - get :weigh_in, id: 1, weight: 1 + get :weigh_in, params: { id: 1, weight: 1 } success end @@ -259,7 +259,7 @@ include Devise::TestHelpers test "logged in tournament delegate can access post weigh_in_weight" do sign_in_delegate - post :weigh_in, id: 1, weight: 1, wrestler: @wrestlers + post :weigh_in, params: { id: 1, weight: 1, wrestler: @wrestlers } end test "logged in tournament delegate should post update tournament" do @@ -277,49 +277,49 @@ include Devise::TestHelpers test 'logged in tournament owner can delegate a user' do sign_in_owner - get :delegate, id: 1 + get :delegate, params: { id: 1 } success end test 'logged in tournament delegate cannot delegate a user' do sign_in_delegate - get :delegate, id: 1 + get :delegate, params: { id: 1 } redirect end test 'logged in tournament owner can delegate a school user' do sign_in_owner - get :school_delegate, id: 1 + get :school_delegate, params: { id: 1 } success end test 'logged in tournament delegate can delegate a school user' do sign_in_delegate - get :school_delegate, id: 1 + get :school_delegate, params: { id: 1 } success end test 'logged in tournament owner can delete a school delegate' do sign_in_owner - patch :remove_school_delegate, id: 1, delegate: SchoolDelegate.find(1) + patch :remove_school_delegate, params: { id: 1, delegate: SchoolDelegate.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/school_delegate" end test 'logged in tournament delegate can delete a school delegate' do sign_in_delegate - patch :remove_school_delegate, id: 1, delegate: SchoolDelegate.find(1) + patch :remove_school_delegate, params: { id: 1, delegate: SchoolDelegate.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/school_delegate" end test 'logged in tournament owner can delete a delegate' do sign_in_owner - patch :remove_delegate, id: 1, delegate: TournamentDelegate.find(1) + patch :remove_delegate, params: { id: 1, delegate: TournamentDelegate.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/delegate" end test 'logged in tournament delegate cannot delete a delegate' do sign_in_delegate - patch :remove_delegate, id: 1, delegate: TournamentDelegate.find(1) + patch :remove_delegate, params: { id: 1, delegate: TournamentDelegate.find(1) } redirect end @@ -328,37 +328,37 @@ include Devise::TestHelpers test 'logged in tournament delegate can adjust team points' do sign_in_delegate - get :teampointadjust, id: 1 + get :teampointadjust, params: { id: 1 } success end test 'logged in tournament owner can adjust team points' do sign_in_owner - get :teampointadjust, id: 1 + get :teampointadjust, params: { id: 1 } success end test 'logged in tournament delegate cannot adjust team points' do sign_in_school_delegate - get :teampointadjust, id: 1 + get :teampointadjust, params: { id: 1 } redirect end test 'logged in tournament owner can delete team point adjust' do sign_in_owner - post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1) + post :remove_teampointadjust, params: { id: 1, teampointadjust: Teampointadjust.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/teampointadjust" end test 'logged in tournament delegate can team point adjust' do sign_in_delegate - post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1) + post :remove_teampointadjust, params: { id: 1, teampointadjust: Teampointadjust.find(1) } assert_redirected_to "/tournaments/#{@tournament.id}/teampointadjust" end test 'logged in school delegate cannot delete team point adjust' do sign_in_school_delegate - post :remove_teampointadjust, id: 1, teampointadjust: Teampointadjust.find(1) + post :remove_teampointadjust, params: { id: 1, teampointadjust: Teampointadjust.find(1) } redirect end diff --git a/test/controllers/weights_controller_test.rb b/test/controllers/weights_controller_test.rb index f3e7882..8e1da47 100644 --- a/test/controllers/weights_controller_test.rb +++ b/test/controllers/weights_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class WeightsControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -10,23 +10,23 @@ class WeightsControllerTest < ActionController::TestCase end def create - post :create, weight: {max: 60000, tournament_id: 1} + post :create, params: { weight: {max: 60000, tournament_id: 1} } end def new - get :new, tournament: @tournament.id + get :new, params: { tournament: @tournament.id } end def post_update - patch :update, id: @weight.id, weight: {max: @weight.max, tournament_id: @weight.tournament_id} + patch :update, params: { id: @weight.id, weight: {max: @weight.max, tournament_id: @weight.tournament_id} } end def destroy - delete :destroy, id: @weight.id + delete :destroy, params: { id: @weight.id } end def get_edit - get :edit, id: @weight.id + get :edit, params: { id: @weight.id } end def sign_in_owner @@ -168,7 +168,7 @@ class WeightsControllerTest < ActionController::TestCase end test "view wegiht" do - get :show, id: 1 + get :show, params: { id: 1 } success end diff --git a/test/controllers/wrestlers_controller_test.rb b/test/controllers/wrestlers_controller_test.rb index 2193113..d2b6ee6 100644 --- a/test/controllers/wrestlers_controller_test.rb +++ b/test/controllers/wrestlers_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class WrestlersControllerTest < ActionController::TestCase - include Devise::TestHelpers + include Devise::Test::ControllerHelpers setup do @tournament = Tournament.find(1) @@ -11,23 +11,23 @@ class WrestlersControllerTest < ActionController::TestCase end def create - post :create, wrestler: {name: 'Testaasdf', weight_id: 1, school_id: 1} + post :create, params: { wrestler: {name: 'Testaasdf', weight_id: 1, school_id: 1} } end def new - get :new, school: 1 + get :new, params: { school: 1 } end def post_update - patch :update, id: @wrestler.id, wrestler: {name: @wrestler.name, weight_id: 1, school_id: 1} + patch :update, params: { id: @wrestler.id, wrestler: {name: @wrestler.name, weight_id: 1, school_id: 1} } end def destroy - delete :destroy, id: @wrestler.id + delete :destroy, params: { id: @wrestler.id } end def get_edit - get :edit, id: @wrestler.id + get :edit, params: { id: @wrestler.id } end def sign_in_owner @@ -169,7 +169,7 @@ class WrestlersControllerTest < ActionController::TestCase end test "view wrestler" do - get :show, id: @wrestler.id + get :show, params: { id: @wrestler.id } success end