mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
FIX: Have file size restriction type return integers (#24989)
This commit is contained in:
parent
22d4fbf59c
commit
43a6c1b7cc
|
@ -143,6 +143,8 @@ class SiteSettings::TypeSupervisor
|
|||
value.to_f
|
||||
when self.class.types[:integer]
|
||||
value.to_i
|
||||
when self.class.types[:file_size_restriction]
|
||||
value.to_i
|
||||
when self.class.types[:bool]
|
||||
value == true || value == "t" || value == "true"
|
||||
when self.class.types[:null]
|
||||
|
|
|
@ -96,6 +96,9 @@ RSpec.describe SiteSettings::TypeSupervisor do
|
|||
it "'tag_group_list' should be at the right position" do
|
||||
expect(SiteSettings::TypeSupervisor.types[:tag_group_list]).to eq(26)
|
||||
end
|
||||
it "'file_size_restriction' should be at the right position" do
|
||||
expect(SiteSettings::TypeSupervisor.types[:file_size_restriction]).to eq(27)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -333,6 +336,16 @@ RSpec.describe SiteSettings::TypeSupervisor do
|
|||
).to eq(1)
|
||||
end
|
||||
|
||||
it "returns an integer for file_size_restriction type" do
|
||||
expect(
|
||||
settings.type_supervisor.to_rb_value(
|
||||
:type_file_size_restriction,
|
||||
"1024",
|
||||
SiteSetting.types[:file_size_restriction],
|
||||
),
|
||||
).to eq 1024
|
||||
end
|
||||
|
||||
it "returns nil value" do
|
||||
expect(settings.type_supervisor.to_rb_value(:type_null, "1")).to eq nil
|
||||
expect(settings.type_supervisor.to_rb_value(:type_null, 1)).to eq nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user