mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Remove site setting stubbing (Round 1)
This commit is contained in:
@ -14,13 +14,13 @@ describe Backup do
|
||||
|
||||
context '#remove_old' do
|
||||
it "does nothing if there aren't more backups than the setting" do
|
||||
SiteSetting.stubs(:maximum_backups).returns(3)
|
||||
SiteSetting.maximum_backups = 3
|
||||
Backup.any_instance.expects(:remove).never
|
||||
Backup.remove_old
|
||||
end
|
||||
|
||||
it "calls remove on the backups over our limit" do
|
||||
SiteSetting.stubs(:maximum_backups).returns(1)
|
||||
SiteSetting.maximum_backups = 1
|
||||
b1.expects(:remove).never
|
||||
b2.expects(:remove).once
|
||||
b3.expects(:remove).once
|
||||
@ -30,13 +30,13 @@ describe Backup do
|
||||
|
||||
context ".after_create_hook" do
|
||||
it "calls upload_to_s3 if the SiteSetting is true" do
|
||||
SiteSetting.stubs(:enable_s3_backups?).returns(true)
|
||||
SiteSetting.enable_s3_backups = true
|
||||
b1.expects(:upload_to_s3).once
|
||||
b1.after_create_hook
|
||||
end
|
||||
|
||||
it "calls upload_to_s3 if the SiteSetting is false" do
|
||||
SiteSetting.stubs(:enable_s3_backups?).returns(false)
|
||||
SiteSetting.enable_s3_backups = false
|
||||
b1.expects(:upload_to_s3).never
|
||||
b1.after_create_hook
|
||||
end
|
||||
@ -44,17 +44,16 @@ describe Backup do
|
||||
|
||||
context ".after_remove_hook" do
|
||||
it "calls remove_from_s3 if the SiteSetting is true" do
|
||||
SiteSetting.stubs(:enable_s3_backups?).returns(true)
|
||||
SiteSetting.enable_s3_backups = true
|
||||
b1.expects(:remove_from_s3).once
|
||||
b1.after_remove_hook
|
||||
end
|
||||
|
||||
it "calls remove_from_s3 if the SiteSetting is false" do
|
||||
SiteSetting.stubs(:enable_s3_backups?).returns(false)
|
||||
SiteSetting.enable_s3_backups = false
|
||||
b1.expects(:remove_from_s3).never
|
||||
b1.after_remove_hook
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user