system_init_done.rb 512 B

123456789101112131415
  1. module SystemInitDoneHelper
  2. def system_init_done(state = true)
  3. # generally allow all calls to Setting.find_by to avoid
  4. # RSpec errors where a different Setting is accessed
  5. allow(Setting).to receive(:find_by).and_call_original
  6. # just mock the Setting check for `system_init_done`
  7. # and return the given parameter value
  8. expect(Setting).to receive(:find_by).with(name: 'system_init_done').and_return(state)
  9. end
  10. end
  11. RSpec.configure do |config|
  12. config.include SystemInitDoneHelper
  13. end