avatar_check.rb 735 B

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