mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 14:05:37 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
48 lines
1.3 KiB
Ruby
48 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class GlobalPathInstance
|
|
extend GlobalPath
|
|
end
|
|
|
|
RSpec.describe SiteIconManager do
|
|
before do
|
|
SiteIconManager.enable
|
|
end
|
|
|
|
let(:upload) do
|
|
UploadCreator.new(file_from_fixtures("smallest.png"), 'logo.png').create_for(Discourse.system_user.id)
|
|
end
|
|
|
|
it "works correctly" do
|
|
SiteSetting.logo = nil
|
|
SiteSetting.logo_small = nil
|
|
|
|
# Falls back to sketch for some icons
|
|
expect(SiteIconManager.favicon.upload_id).to eq(SiteIconManager::SKETCH_LOGO_ID)
|
|
expect(SiteIconManager.mobile_logo).to eq(nil)
|
|
|
|
SiteSetting.logo_small = upload
|
|
|
|
# Always resizes to 512x512
|
|
manifest = SiteIconManager.manifest_icon
|
|
expect(manifest.upload_id).to eq(upload.id)
|
|
expect(manifest.width).to eq(512)
|
|
expect(manifest.height).to eq(512)
|
|
|
|
# Always resizes to 32x32
|
|
favicon = SiteIconManager.favicon
|
|
expect(favicon.upload_id).to eq(upload.id)
|
|
expect(favicon.width).to eq(32)
|
|
expect(favicon.height).to eq(32)
|
|
|
|
# Don't resize
|
|
opengraph = SiteIconManager.opengraph_image
|
|
expect(opengraph).to eq(upload)
|
|
|
|
# Site Setting integration
|
|
expect(SiteSetting.manifest_icon).to eq(nil)
|
|
expect(SiteSetting.site_manifest_icon_url).to eq(GlobalPathInstance.full_cdn_url(manifest.url))
|
|
end
|
|
|
|
end
|