last_admin_check.rb 481 B

1234567891011121314151617181920
  1. RSpec.configure do |config|
  2. config.around(:example, last_admin_check: false) do |example|
  3. User.class_eval do
  4. alias_method :original_last_admin_check_admin_count, :last_admin_check_admin_count
  5. def last_admin_check_admin_count
  6. 1
  7. end
  8. end
  9. example.run
  10. User.class_eval do
  11. alias_method :last_admin_check_admin_count, :original_last_admin_check_admin_count
  12. remove_method :original_last_admin_check_admin_count
  13. end
  14. end
  15. end