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