FIX: fixnum type site setting can't be more than 20000
This commit is contained in:
parent
078177cf79
commit
636cc66e1f
|
@ -310,8 +310,8 @@ module SiteSettingExtension
|
||||||
type = get_data_type(name, defaults[name.to_sym])
|
type = get_data_type(name, defaults[name.to_sym])
|
||||||
|
|
||||||
if type == types[:fixnum]
|
if type == types[:fixnum]
|
||||||
# validate fixnum
|
# value should be less than 20000
|
||||||
valid = false unless value.to_i.is_a?(Fixnum)
|
valid = false if value.to_i > 20000
|
||||||
end
|
end
|
||||||
|
|
||||||
return valid
|
return valid
|
||||||
|
|
|
@ -340,12 +340,12 @@ describe SiteSettingExtension do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "set for an invalid fixnum value" do
|
describe "set for an invalid fixnum value (greater than 20000)" do
|
||||||
it "raises an error" do
|
it "raises an error" do
|
||||||
settings.setting(:test_setting, 80)
|
settings.setting(:test_setting, 80)
|
||||||
settings.refresh!
|
settings.refresh!
|
||||||
expect {
|
expect {
|
||||||
settings.set("test_setting", 9999999999999999999)
|
settings.set("test_setting", 20001)
|
||||||
}.to raise_error(ArgumentError)
|
}.to raise_error(ArgumentError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue