2018-11-15 20:19:58 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Jobs::CleanUpDeprecatedUrlSiteSettings do
|
|
|
|
before do
|
|
|
|
@original_provider = SiteSetting.provider
|
|
|
|
SiteSetting.provider = SiteSettings::DbProvider.new(SiteSetting)
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
SiteSetting.delete_all
|
|
|
|
SiteSetting.provider = @original_provider
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should clean up the old deprecated site settings correctly' do
|
|
|
|
logo_upload = Fabricate(:upload)
|
|
|
|
SiteSetting.logo = logo_upload
|
|
|
|
SiteSetting.public_send("logo_url=", '/test/some/url', warn: false)
|
|
|
|
SiteSetting.public_send("logo_small_url=", '/test/another/url', warn: false)
|
|
|
|
|
|
|
|
expect do
|
|
|
|
described_class.new.execute({})
|
|
|
|
end.to change { SiteSetting.logo_url }.from("/test/some/url").to("")
|
|
|
|
|
2018-11-19 22:42:39 -05:00
|
|
|
expect(SiteSetting.exists?(name: "logo_url")).to eq(false)
|
2018-11-15 20:19:58 -05:00
|
|
|
expect(SiteSetting.logo).to eq(logo_upload)
|
|
|
|
expect(SiteSetting.logo_small_url).to eq('/test/another/url')
|
|
|
|
end
|
|
|
|
end
|