X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/9a9b045372a6f48420a9a6dacfde52c34ab7abce..5a54cb52f8b46283ddb6059e53f0d49886983ccf:/test/models/client_application_test.rb?ds=inline diff --git a/test/models/client_application_test.rb b/test/models/client_application_test.rb index 604a5de33..8e5b21aff 100644 --- a/test/models/client_application_test.rb +++ b/test/models/client_application_test.rb @@ -1,22 +1,20 @@ require "test_helper" class ClientApplicationTest < ActiveSupport::TestCase - fixtures :client_applications - def test_url_valid ok = ["http://example.com/test", "https://example.com/test"] bad = ["", "ftp://example.com/test", "myapp://somewhere"] ok.each do |url| - app = client_applications(:normal_user_app).dup + app = build(:client_application) app.url = url assert app.valid?, "#{url} is invalid, when it should be" end bad.each do |url| - app = client_applications(:normal_user_app) + app = build(:client_application) app.url = url - assert !app.valid?, "#{url} is valid when it shouldn't be" + assert_not app.valid?, "#{url} is valid when it shouldn't be" end end @@ -25,15 +23,15 @@ class ClientApplicationTest < ActiveSupport::TestCase bad = ["ftp://example.com/test", "myapp://somewhere", "gibberish"] ok.each do |url| - app = client_applications(:normal_user_app) + app = build(:client_application) app.support_url = url assert app.valid?, "#{url} is invalid, when it should be" end bad.each do |url| - app = client_applications(:normal_user_app) + app = build(:client_application) app.support_url = url - assert !app.valid?, "#{url} is valid when it shouldn't be" + assert_not app.valid?, "#{url} is valid when it shouldn't be" end end @@ -42,15 +40,15 @@ class ClientApplicationTest < ActiveSupport::TestCase bad = ["gibberish"] ok.each do |url| - app = client_applications(:normal_user_app) + app = build(:client_application) app.callback_url = url assert app.valid?, "#{url} is invalid, when it should be" end bad.each do |url| - app = client_applications(:normal_user_app) + app = build(:client_application) app.callback_url = url - assert !app.valid?, "#{url} is valid when it shouldn't be" + assert_not app.valid?, "#{url} is valid when it shouldn't be" end end end