]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/client_application_test.rb
Remove the floating from the sidebar close buttons
[rails.git] / test / models / client_application_test.rb
index 604a5de3361df53b8fe154acde5aa2544067bfeb..c0b7b7977fcd6d84a7e4b6c5a9422768c5caccce 100644 (file)
@@ -1,56 +1,54 @@
 require "test_helper"
 
 class ClientApplicationTest < ActiveSupport::TestCase
 require "test_helper"
 
 class ClientApplicationTest < ActiveSupport::TestCase
-  fixtures :client_applications
-
   def test_url_valid
     ok = ["http://example.com/test", "https://example.com/test"]
   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|
 
     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.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
       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
 
   def test_support_url_valid
     ok = ["", "http://example.com/test", "https://example.com/test"]
     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|
 
     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.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
       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
 
   def test_callback_url_valid
     ok = ["", "http://example.com/test", "https://example.com/test", "ftp://example.com/test", "myapp://somewhere"]
     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|
 
     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.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
       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
     end
   end
 end