1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Upgraded to Rails 5.1.1

This commit is contained in:
2017-06-08 21:45:36 -04:00
parent f409918f5b
commit 98e63a2ff0
19 changed files with 174 additions and 170 deletions

12
Gemfile
View File

@@ -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

View File

@@ -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

View File

@@ -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?

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -1,4 +1,4 @@
FROM ruby:2.3.0
FROM ruby:2.4.0
RUN apt-get update

View File

@@ -1,4 +1,4 @@
FROM ruby:2.3.0
FROM ruby:2.4.0
RUN apt-get clean
RUN apt-get update

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,7 +1,7 @@
require 'test_helper'
class StaticPagesControllerTest < ActionController::TestCase
include Devise::TestHelpers
include Devise::Test::ControllerHelpers
setup do
@tournament = Tournament.find(1)

View File

@@ -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

View File

@@ -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

View File

@@ -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