Validate that remote_photo_path on Photo entity is an URL with path

closes #119
This commit is contained in:
Benjamin Neff 2021-10-23 17:52:39 +02:00
parent 25b5b8d888
commit d84d68d066
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 12 additions and 6 deletions

View file

@ -10,7 +10,7 @@ module DiasporaFederation
rule :public, :boolean
rule :remote_photo_path, :not_empty
rule :remote_photo_path, [:not_empty, URI: [:path]]
rule :remote_photo_name, :not_empty

View file

@ -24,11 +24,17 @@ module DiasporaFederation
let(:property) { :public }
end
%i[remote_photo_name remote_photo_path].each do |prop|
describe "##{prop}" do
it_behaves_like "a property that mustn't be empty" do
let(:property) { prop }
end
describe "#remote_photo_path" do
let(:property) { :remote_photo_path }
it_behaves_like "a property that mustn't be empty"
it_behaves_like "a url path validator"
end
describe "#remote_photo_name" do
it_behaves_like "a property that mustn't be empty" do
let(:property) { :remote_photo_name }
end
end