2014-03-13 01:26:51 +08:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-04-06 18:12:27 +08:00
|
|
|
require_dependency 'jobs/regular/create_daily_backup'
|
2014-03-13 01:26:51 +08:00
|
|
|
|
2015-04-06 18:12:27 +08:00
|
|
|
describe Jobs::CreateDailyBackup do
|
2014-03-13 01:26:51 +08:00
|
|
|
it "does nothing when daily backups are disabled" do
|
|
|
|
SiteSetting.stubs(:backup_daily?).returns(false)
|
|
|
|
BackupRestore.expects(:backup!).never
|
2015-04-06 18:12:27 +08:00
|
|
|
Jobs::CreateDailyBackup.new.execute({})
|
2014-03-13 01:26:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "calls `backup!` when the daily backups are enabled" do
|
|
|
|
SiteSetting.stubs(:backup_daily?).returns(true)
|
2014-08-21 01:20:29 +08:00
|
|
|
BackupRestore.expects(:backup!).with(Discourse.system_user.id, { publish_to_message_bus: false }).once
|
2015-04-06 18:12:27 +08:00
|
|
|
Jobs::CreateDailyBackup.new.execute({})
|
2014-03-13 01:26:51 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|