mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-24 17:04:43 +00:00
Compare commits
3 Commits
07d43e7720
...
d57aaac09d
| Author | SHA1 | Date | |
|---|---|---|---|
| d57aaac09d | |||
| fcc8a9b9a9 | |||
| b51866e9d8 |
@@ -1 +1 @@
|
||||
wrestlingdev
|
||||
wrestlingdev
|
||||
@@ -1 +1 @@
|
||||
ruby-3.2.0
|
||||
ruby-4.0.1
|
||||
2
Gemfile
2
Gemfile
@@ -1,6 +1,6 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ruby '3.2.0'
|
||||
ruby '4.0.1'
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '8.1.2'
|
||||
|
||||
|
||||
@@ -117,8 +117,9 @@ GEM
|
||||
influxdb (~> 0.6, >= 0.6.4)
|
||||
railties (>= 5.0)
|
||||
io-console (0.8.2)
|
||||
irb (1.16.0)
|
||||
irb (1.17.0)
|
||||
pp (>= 0.6.0)
|
||||
prism (>= 1.3.0)
|
||||
rdoc (>= 4.0.0)
|
||||
reline (>= 0.4.2)
|
||||
jbuilder (2.14.1)
|
||||
@@ -377,7 +378,7 @@ DEPENDENCIES
|
||||
tzinfo-data
|
||||
|
||||
RUBY VERSION
|
||||
ruby 3.2.0p0
|
||||
ruby 4.0.1p0
|
||||
|
||||
BUNDLED WITH
|
||||
2.6.9
|
||||
|
||||
@@ -7,7 +7,7 @@ This application is being created to run a wrestling tournament.
|
||||
**Public Production Url:** [https://wrestlingdev.com](https://wrestlingdev.com)
|
||||
|
||||
**App Info**
|
||||
* Ruby 3.2.0
|
||||
* Ruby 4.0.1
|
||||
* Rails 8.1.2
|
||||
* DB MySQL/MariaDB
|
||||
* Solid Cache -> MySQL/MariaDB for html partial caching
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
module ApplicationHelper
|
||||
def hide_ads?
|
||||
return false unless controller_name == "schools"
|
||||
return false unless %w[show edit new].include?(action_name)
|
||||
|
||||
user_signed_in? || school_permission_key_present?
|
||||
case controller_name
|
||||
when "schools"
|
||||
action_name == "show" && (user_signed_in? || school_permission_key_present?)
|
||||
when "wrestlers"
|
||||
%w[new edit].include?(action_name) && (user_signed_in? || school_permission_key_present?)
|
||||
when "mats"
|
||||
action_name == "show" && user_signed_in?
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def school_permission_key_present?
|
||||
|
||||
@@ -57,6 +57,5 @@ module Wrestling
|
||||
config.active_support.cache_format_version = 7.1
|
||||
|
||||
config.load_defaults 8.1
|
||||
config.active_support.to_time_preserves_timezone = :zone
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM ruby:3.2.0
|
||||
FROM ruby:4.0.1
|
||||
|
||||
# Accept build arguments for user/group IDs
|
||||
ARG USER_ID=1000
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM ruby:3.2.0-slim
|
||||
FROM ruby:4.0.1-slim
|
||||
|
||||
#HEALTHCHECK --start-period=60s CMD curl http://127.0.0.1/
|
||||
|
||||
@@ -15,6 +15,8 @@ RUN apt-get -qq update --fix-missing \
|
||||
libsqlite3-dev \
|
||||
wget \
|
||||
default-libmysqlclient-dev \
|
||||
libyaml-dev \
|
||||
pkg-config \
|
||||
nodejs \
|
||||
tzdata \
|
||||
git \
|
||||
|
||||
@@ -66,6 +66,15 @@ class MatsControllerTest < ActionController::TestCase
|
||||
def redirect
|
||||
assert_redirected_to '/static_pages/not_allowed'
|
||||
end
|
||||
|
||||
def assert_ads_hidden
|
||||
assert_no_match(/blocked_message/, response.body)
|
||||
assert_no_match(/adsbygoogle/, response.body)
|
||||
end
|
||||
|
||||
def assert_ads_visible
|
||||
assert_match(/blocked_message/, response.body)
|
||||
end
|
||||
|
||||
def no_matches
|
||||
assert_redirected_to "/tournaments/#{@tournament.id}/no_matches"
|
||||
@@ -221,6 +230,13 @@ class MatsControllerTest < ActionController::TestCase
|
||||
success
|
||||
end
|
||||
|
||||
test "ads are hidden on mat show" do
|
||||
sign_in_owner
|
||||
show
|
||||
success
|
||||
assert_ads_hidden
|
||||
end
|
||||
|
||||
test "redirect to mat show when posting a match from mat show" do
|
||||
sign_in_owner
|
||||
post_match_update_from_mat_show
|
||||
|
||||
@@ -60,6 +60,15 @@ class SchoolsControllerTest < ActionController::TestCase
|
||||
assert_redirected_to '/static_pages/not_allowed'
|
||||
end
|
||||
|
||||
def assert_ads_hidden
|
||||
assert_no_match(/blocked_message/, response.body)
|
||||
assert_no_match(/adsbygoogle/, response.body)
|
||||
end
|
||||
|
||||
def assert_ads_visible
|
||||
assert_match(/blocked_message/, response.body)
|
||||
end
|
||||
|
||||
def baums_import
|
||||
baums_text = "***** 2019-01-09 13:36:50 *****
|
||||
Some School
|
||||
@@ -399,6 +408,27 @@ Some Guy
|
||||
success
|
||||
end
|
||||
|
||||
test "ads are hidden on school show when logged in" do
|
||||
sign_in_owner
|
||||
get_show
|
||||
success
|
||||
assert_ads_hidden
|
||||
end
|
||||
|
||||
test "ads are hidden on school show with school permission key" do
|
||||
@tournament.update(is_public: false)
|
||||
get_show(school_permission_key: @school_permission_key)
|
||||
success
|
||||
assert_ads_hidden
|
||||
end
|
||||
|
||||
test "ads are visible on school show for anonymous user without key" do
|
||||
@tournament.update(is_public: true)
|
||||
get_show
|
||||
success
|
||||
assert_ads_visible
|
||||
end
|
||||
|
||||
test "non logged in user cannot edit school with invalid school_permission_key" do
|
||||
@tournament.update(is_public: false)
|
||||
get_edit(school_permission_key: "invalid-key")
|
||||
|
||||
@@ -56,6 +56,15 @@ class WrestlersControllerTest < ActionController::TestCase
|
||||
assert_redirected_to '/static_pages/not_allowed'
|
||||
end
|
||||
|
||||
def assert_ads_hidden
|
||||
assert_no_match(/blocked_message/, response.body)
|
||||
assert_no_match(/adsbygoogle/, response.body)
|
||||
end
|
||||
|
||||
def assert_ads_visible
|
||||
assert_match(/blocked_message/, response.body)
|
||||
end
|
||||
|
||||
test "logged in tournament owner should get edit wrestler page" do
|
||||
sign_in_owner
|
||||
get_edit
|
||||
@@ -305,4 +314,39 @@ class WrestlersControllerTest < ActionController::TestCase
|
||||
|
||||
assert_select "a[href=?]", school_path(@school), text: /Back to/
|
||||
end
|
||||
|
||||
test "ads are hidden on wrestler new" do
|
||||
sign_in_owner
|
||||
new
|
||||
success
|
||||
assert_ads_hidden
|
||||
end
|
||||
|
||||
test "ads are hidden on wrestler edit" do
|
||||
sign_in_owner
|
||||
get_edit
|
||||
success
|
||||
assert_ads_hidden
|
||||
end
|
||||
|
||||
test "ads are hidden on wrestler new with school permission key" do
|
||||
valid_key = @school.permission_key
|
||||
get :new, params: { school: @school.id, school_permission_key: valid_key }
|
||||
success
|
||||
assert_ads_hidden
|
||||
end
|
||||
|
||||
test "ads are hidden on wrestler edit with school permission key" do
|
||||
valid_key = @school.permission_key
|
||||
get :edit, params: { id: @wrestler.id, school_permission_key: valid_key }
|
||||
success
|
||||
assert_ads_hidden
|
||||
end
|
||||
|
||||
test "ads are visible on wrestler show" do
|
||||
sign_in_owner
|
||||
get :show, params: { id: @wrestler.id }
|
||||
success
|
||||
assert_ads_visible
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user