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-23 14:26:09 +00:00
|
|
|
module SystemInitDoneHelper
|
|
|
|
def system_init_done(state = true)
|
2020-08-03 08:35:43 +00:00
|
|
|
# generally allow all calls to Setting.exists? to avoid
|
2018-03-28 09:46:39 +00:00
|
|
|
# RSpec errors where a different Setting is accessed
|
2020-08-03 08:35:43 +00:00
|
|
|
allow(Setting).to receive(:exists?).and_call_original
|
2018-03-28 09:46:39 +00:00
|
|
|
|
|
|
|
# just mock the Setting check for `system_init_done`
|
|
|
|
# and return the given parameter value
|
2021-07-19 12:24:09 +00:00
|
|
|
allow(Setting).to receive(:exists?).with(name: 'system_init_done').and_return(state)
|
2018-03-23 14:26:09 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include SystemInitDoneHelper
|
|
|
|
end
|