validate message text
This commit is contained in:
parent
4cee776338
commit
699c74a8f0
2 changed files with 11 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ module DiasporaFederation
|
||||||
rule :author, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
rule :guid, :guid
|
rule :guid, :guid
|
||||||
rule :conversation_guid, :guid
|
rule :conversation_guid, :guid
|
||||||
|
|
||||||
|
rule :text, [:not_empty,
|
||||||
|
length: {maximum: 65_535}]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,13 @@ module DiasporaFederation
|
||||||
let(:property) { :conversation_guid }
|
let(:property) { :conversation_guid }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#text" do
|
||||||
|
it_behaves_like "a property with a value validation/restriction" do
|
||||||
|
let(:property) { :text }
|
||||||
|
let(:wrong_values) { ["", "a" * 65_536] }
|
||||||
|
let(:correct_values) { ["a" * 65_535] }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue