2014-03-12 13:26:51 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
require_dependency 'jobs/scheduled/create_backup'
|
|
|
|
|
|
|
|
describe Jobs::CreateBackup do
|
|
|
|
it "does nothing when daily backups are disabled" do
|
|
|
|
SiteSetting.stubs(:backup_daily?).returns(false)
|
|
|
|
BackupRestore.expects(:backup!).never
|
|
|
|
Jobs::CreateBackup.new.execute({})
|
|
|
|
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
|
2014-03-12 13:26:51 -04:00
|
|
|
Jobs::CreateBackup.new.execute({})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|