discourse/spec/jobs/create_daily_backup_spec.rb

19 lines
590 B
Ruby
Raw Normal View History

require 'spec_helper'
2015-04-06 06:12:27 -04:00
require_dependency 'jobs/regular/create_daily_backup'
2015-04-06 06:12:27 -04:00
describe Jobs::CreateDailyBackup do
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({})
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({})
end
end