Validate that remote_photo_path on Photo entity is an URL with path
closes #119
This commit is contained in:
parent
25b5b8d888
commit
d84d68d066
2 changed files with 12 additions and 6 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue