X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f7a35c5895b1bd830a9bf2c08ce36e265deb3e4c..424a0fa345e5d35f36aebfa5567655f267625504:/test/models/client_application_test.rb?ds=sidebyside diff --git a/test/models/client_application_test.rb b/test/models/client_application_test.rb index 8e5b21aff..9dc5ab5fc 100644 --- a/test/models/client_application_test.rb +++ b/test/models/client_application_test.rb @@ -3,52 +3,52 @@ require "test_helper" class ClientApplicationTest < ActiveSupport::TestCase def test_url_valid ok = ["http://example.com/test", "https://example.com/test"] - bad = ["", "ftp://example.com/test", "myapp://somewhere"] + bad = ["", "ftp://example.com/test", "myapp://somewhere", "http://example.com\nhttp://example.net"] ok.each do |url| app = build(:client_application) app.url = url - assert app.valid?, "#{url} is invalid, when it should be" + assert_predicate app, :valid?, "#{url} is invalid, when it should be" end bad.each do |url| app = build(:client_application) app.url = url - assert_not app.valid?, "#{url} is valid when it shouldn't be" + assert_not_predicate app, :valid?, "#{url} is valid when it shouldn't be" end end def test_support_url_valid ok = ["", "http://example.com/test", "https://example.com/test"] - bad = ["ftp://example.com/test", "myapp://somewhere", "gibberish"] + bad = ["ftp://example.com/test", "myapp://somewhere", "gibberish", "http://example.com\nhttp://example.net"] ok.each do |url| app = build(:client_application) app.support_url = url - assert app.valid?, "#{url} is invalid, when it should be" + assert_predicate app, :valid?, "#{url} is invalid, when it should be" end bad.each do |url| app = build(:client_application) app.support_url = url - assert_not app.valid?, "#{url} is valid when it shouldn't be" + assert_not_predicate app, :valid?, "#{url} is valid when it shouldn't be" end end def test_callback_url_valid ok = ["", "http://example.com/test", "https://example.com/test", "ftp://example.com/test", "myapp://somewhere"] - bad = ["gibberish"] + bad = ["gibberish", "http://example.com\nhttp://example.net"] ok.each do |url| app = build(:client_application) app.callback_url = url - assert app.valid?, "#{url} is invalid, when it should be" + assert_predicate app, :valid?, "#{url} is invalid, when it should be" end bad.each do |url| app = build(:client_application) app.callback_url = url - assert_not app.valid?, "#{url} is valid when it shouldn't be" + assert_not_predicate app, :valid?, "#{url} is valid when it shouldn't be" end end end