last_admin_check.rb 558 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. RSpec.configure do |config|
  3. config.around(:example, last_admin_check: false) do |example|
  4. User.class_eval do
  5. alias_method :original_last_admin_check_admin_count, :last_admin_check_admin_count
  6. def last_admin_check_admin_count
  7. 1
  8. end
  9. end
  10. example.run
  11. User.class_eval do
  12. alias_method :last_admin_check_admin_count, :original_last_admin_check_admin_count
  13. remove_method :original_last_admin_check_admin_count
  14. end
  15. end
  16. end