avatar_check.rb 805 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. module ZammadSpecSupportAvatarCheck
  3. def self.included(base)
  4. # Execute in RSpec class context
  5. base.class_exec do
  6. # This method disables the avatar for email check for all examples.
  7. # It's possible to re-enable the check by adding the
  8. # meta tag `perform_avatar_for_email_check` to the needing example:
  9. #
  10. # @example
  11. # it 'does stuff with avatar check', perform_avatar_for_email_check: true do
  12. #
  13. before do |example|
  14. if !example.metadata[:perform_avatar_for_email_check]
  15. allow(Avatar).to receive(:auto_detection).and_return(false)
  16. end
  17. end
  18. end
  19. end
  20. end
  21. RSpec.configure do |config|
  22. config.include ZammadSpecSupportAvatarCheck
  23. end