Validation webhooks
Created by: joren
The validation on web hooks doesn't really does his job. It only ignores url's that don't start with http or https. But when the url is tested or actually called it failes because URI.parse fails.
I'm not sure what the preferred change is. I could change URI.regexp() with a better regex, use a custom validator or something like http://www.simonecarletti.com/code/publicsuffix/. I'm not really familiar with the style guide of the development but would like to help.
I added 3 test of url's that should fail because it would not be able to be parsed when the webhook gets called.
Failures:
1) ProjectHook Validations url format
Failure/Error: it { should_not allow_value("http://ex_ample.com").for(:url) }
Expected errors when url is set to "http://ex_ample.com", got no errors
# ./spec/models/web_hook_spec.rb:38:in `block (4 levels) in <top (required)>'
2) ProjectHook Validations url format
Failure/Error: it { should_not allow_value("http://example").for(:url) }
Expected errors when url is set to "http://example", got no errors
# ./spec/models/web_hook_spec.rb:39:in `block (4 levels) in <top (required)>'
3) ProjectHook Validations url format
Failure/Error: it { should_not allow_value("http://ex ample").for(:url) }
Expected errors when url is set to "http://ex ample", got no errors
# ./spec/models/web_hook_spec.rb:40:in `block (4 levels) in <top (required)>'