Skip to content
代码片段 群组 项目
未验证 提交 5e950bd5 编辑于 作者: Marcos Rocha's avatar Marcos Rocha 提交者: GitLab
浏览文件

Add limits for license names

Changelog: changed
EE: true
上级 1a09139d
No related branches found
No related tags found
无相关合并请求
......@@ -656,11 +656,13 @@
"type": "array",
"description": "Specifies the licenses to match.",
"minItems": 1,
"maxItems": 1000,
"uniqueItems": true,
"additionalItems": false,
"items": {
"type": "string",
"minLength": 1
"minLength": 1,
"maxLength": 255
}
},
"license_states": {
......
......@@ -1257,6 +1257,38 @@
expect(errors).to contain_exactly(
"property '/#{type}/0/rules/0/license_types/0' is invalid: error_type=minLength")
end
context "when too long" do
before do
rule[:license_types] = ["a" * 256]
end
specify do
expect(errors).to contain_exactly("property '/#{type}/0/rules/0/license_types/0' is invalid: error_type=maxLength")
end
end
context "with repeated licenses" do
before do
rule[:license_types] = ["a"] * 2
end
specify do
expect(errors).to contain_exactly("property '/#{type}/0/rules/0/license_types' is invalid: error_type=uniqueItems")
end
end
context "with too many licenses" do
before do
licenses = []
1001.times { |i| licenses << "License #{i}" }
rule[:license_types] = licenses
end
specify do
expect(errors).to contain_exactly("property '/#{type}/0/rules/0/license_types' is invalid: error_type=maxItems")
end
end
end
describe "license_states" do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册