2018-03-23 14:26:09 +00:00
|
|
|
module SystemInitDoneHelper
|
|
|
|
def system_init_done(state = true)
|
2018-03-28 09:46:39 +00:00
|
|
|
# generally allow all calls to Setting.find_by to avoid
|
|
|
|
# RSpec errors where a different Setting is accessed
|
|
|
|
allow(Setting).to receive(:find_by).and_call_original
|
|
|
|
|
|
|
|
# just mock the Setting check for `system_init_done`
|
|
|
|
# and return the given parameter value
|
2018-03-23 14:26:09 +00:00
|
|
|
expect(Setting).to receive(:find_by).with(name: 'system_init_done').and_return(state)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include SystemInitDoneHelper
|
|
|
|
end
|