2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2018-03-28 05:33:41 +00:00
|
|
|
module ZammadSpecSupportAvatarCheck
|
|
|
|
|
|
|
|
def self.included(base)
|
|
|
|
|
|
|
|
# Execute in RSpec class context
|
|
|
|
base.class_exec do
|
|
|
|
|
|
|
|
# This method disables the avatar for email check for all examples.
|
|
|
|
# It's possible to re-enable the check by adding the
|
|
|
|
# meta tag `perform_avatar_for_email_check` to the needing example:
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# it 'does stuff with avatar check', perform_avatar_for_email_check: true do
|
|
|
|
#
|
2021-07-19 12:24:09 +00:00
|
|
|
before do |example|
|
2018-03-28 05:33:41 +00:00
|
|
|
if !example.metadata[:perform_avatar_for_email_check]
|
|
|
|
allow(Avatar).to receive(:auto_detection).and_return(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include ZammadSpecSupportAvatarCheck
|
|
|
|
end
|