2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
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
|