Skip to content

A platform for community discussion. Free, open, simple.

FIX: ensure avatar sizes are integers

Régis Hanol00dbc260d3dc
diff --git a/lib/discourse.rb b/lib/discourse.rb
index 86efda52355..5a13c19d356 100644
--- a/lib/discourse.rb
+++ b/lib/discourse.rb
@@ -135,7 +135,7 @@ module Discourse
SiteSetting.avatar_sizes.split("|").map(&:to_i).each do |size|
PIXEL_RATIOS.each do |pixel_ratio|
- set << size * pixel_ratio
+ set << (size * pixel_ratio).to_i
end
end
diff --git a/spec/components/discourse_spec.rb b/spec/components/discourse_spec.rb
index 9b3dc50b4ca..76a832c6d08 100644
--- a/spec/components/discourse_spec.rb
+++ b/spec/components/discourse_spec.rb
@@ -10,11 +10,15 @@ describe Discourse do
end
context 'current_hostname' do
-
it 'returns the hostname from the current db connection' do
expect(Discourse.current_hostname).to eq('foo.com')
end
+ end
+ context 'avatar_sizes' do
+ it 'returns a list of integers' do
+ expect(Discourse.avatar_sizes).to contain_exactly(20, 25, 30, 32, 37, 40, 45, 48, 50, 60, 64, 67, 75, 90, 96, 120, 135, 180, 240, 360)
+ end
end
context 'running_in_rack' do