3 class ClientApplicationTest < ActiveSupport::TestCase
5 ok = ["http://example.com/test", "https://example.com/test"]
6 bad = ["", "ftp://example.com/test", "myapp://somewhere", "http://example.com\nhttp://example.net"]
9 app = build(:client_application)
11 assert app.valid?, "#{url} is invalid, when it should be"
15 app = build(:client_application)
17 assert_not app.valid?, "#{url} is valid when it shouldn't be"
21 def test_support_url_valid
22 ok = ["", "http://example.com/test", "https://example.com/test"]
23 bad = ["ftp://example.com/test", "myapp://somewhere", "gibberish", "http://example.com\nhttp://example.net"]
26 app = build(:client_application)
28 assert app.valid?, "#{url} is invalid, when it should be"
32 app = build(:client_application)
34 assert_not app.valid?, "#{url} is valid when it shouldn't be"
38 def test_callback_url_valid
39 ok = ["", "http://example.com/test", "https://example.com/test", "ftp://example.com/test", "myapp://somewhere"]
40 bad = ["gibberish", "http://example.com\nhttp://example.net"]
43 app = build(:client_application)
44 app.callback_url = url
45 assert app.valid?, "#{url} is invalid, when it should be"
49 app = build(:client_application)
50 app.callback_url = url
51 assert_not app.valid?, "#{url} is valid when it shouldn't be"