Add a couple more tests for site settings import

This commit is contained in:
Blake Erickson 2018-03-23 15:14:54 -06:00
parent 9fdf139235
commit 25bf5278e0
1 changed files with 15 additions and 0 deletions

View File

@ -21,5 +21,20 @@ describe SiteSettingsTask do
expect(counts[:updated]).to eq 1
expect(SiteSetting.title).to eq "Test"
end
it "won't update a setting that doesn't exist" do
yml = "fake_setting: foo"
log, counts = SiteSettingsTask.import(yml)
expect(log[0]).to eq "NOT FOUND: existing site setting not found for fake_setting"
expect(counts[:not_found]).to eq 1
end
it "will log that an error has occured" do
yml = "min_password_length: 0"
log, counts = SiteSettingsTask.import(yml)
expect(log[0]).to eq "ERROR: min_password_length: Value must be between 8 and 500."
expect(counts[:errors]).to eq 1
expect(SiteSetting.min_password_length).to eq 10
end
end
end