Remove exception checking from system tests

This commit is contained in:
cryptogopher 2023-05-02 03:14:55 +02:00
parent 81c13cecf4
commit 74db85f26a
3 changed files with 10 additions and 10 deletions

View File

@ -22,14 +22,15 @@ Rails.application.configure do
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
# Hide full error reports.
config.consider_all_requests_local = false
# Render exception templates instead of raising exceptions.
config.action_dispatch.show_exceptions = true
# Disable caching.
config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false

View File

@ -4,7 +4,7 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
# NOTE: remove when capabilities no longer used by Rails
Selenium::WebDriver.logger.ignore(:capabilities)
driven_by :selenium, using: :headless_firefox, screen_size: [1600, 900]
driven_by :selenium, using: :headless_firefox, screen_size: [2400, 1600]
def sign_in(user: users.select(&:confirmed?).sample, password: randomize_user_password!(user))
visit new_user_session_url

View File

@ -101,12 +101,11 @@ class UsersTest < ApplicationSystemTestCase
end
end
test "users index visible only for admin" do
test "users index forbidden for non admin" do
sign_in user: users.reject(&:admin?).select(&:confirmed?).sample
assert_raise ApplicationController::AccessForbidden do
visit users_path
end
visit users_path
assert has_no_link?t('layouts.application.users')
assert_title "Access is forbidden to this page (403)"
end
test "update e-mail" do