1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-24 17:04:43 +00:00

Added tests for hiding ads on lineup submission.

This commit is contained in:
2026-02-09 18:36:56 -05:00
parent 07d43e7720
commit b51866e9d8

View File

@@ -60,6 +60,15 @@ class SchoolsControllerTest < ActionController::TestCase
assert_redirected_to '/static_pages/not_allowed' assert_redirected_to '/static_pages/not_allowed'
end 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 def baums_import
baums_text = "***** 2019-01-09 13:36:50 ***** baums_text = "***** 2019-01-09 13:36:50 *****
Some School Some School
@@ -399,6 +408,27 @@ Some Guy
success success
end end
test "ads are hidden for logged in user on school show" do
sign_in_owner
get_show
success
assert_ads_hidden
end
test "ads are hidden for school permission key on edit" do
@tournament.update(is_public: false)
get_edit(school_permission_key: @school_permission_key)
success
assert_ads_hidden
end
test "ads are visible for anonymous user without school permission key on show" 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 test "non logged in user cannot edit school with invalid school_permission_key" do
@tournament.update(is_public: false) @tournament.update(is_public: false)
get_edit(school_permission_key: "invalid-key") get_edit(school_permission_key: "invalid-key")