]> git.openstreetmap.org Git - rails.git/blobdiff - test/integration/user_terms_seen_test.rb
Remove deprecated get_via_direct and post_via_redirect methods
[rails.git] / test / integration / user_terms_seen_test.rb
index a664feeb0aa13bca045bb7d438aa4dea4a0ad021..f1cabfc60e6a1e1cd38f5326d977606845a87e30 100644 (file)
@@ -1,11 +1,13 @@
 require "test_helper"
 
 class UserTermsSeenTest < ActionDispatch::IntegrationTest
-  fixtures :users
+  def setup
+    stub_hostip_requests
+  end
 
   def test_api_blocked
     with_terms_seen(true) do
-      user = users(:terms_not_seen_user)
+      user = create(:user, :terms_seen => false)
 
       get "/api/#{API_VERSION}/user/preferences", nil, auth_header(user.display_name, "test")
       assert_response :forbidden
@@ -21,10 +23,11 @@ class UserTermsSeenTest < ActionDispatch::IntegrationTest
 
   def test_terms_presented_at_login
     with_terms_seen(true) do
-      user = users(:terms_not_seen_user)
+      user = create(:user, :terms_seen => false)
 
       # try to log in
-      get_via_redirect "/login"
+      get "/login"
+      follow_redirect!
       assert_response :success
       assert_template "user/login"
       post "/login", :username => user.email, :password => "test", :referer => "/diary/new"
@@ -47,10 +50,11 @@ class UserTermsSeenTest < ActionDispatch::IntegrationTest
 
   def test_terms_cant_be_circumvented
     with_terms_seen(true) do
-      user = users(:terms_not_seen_user)
+      user = create(:user, :terms_seen => false)
 
       # try to log in
-      get_via_redirect "/login"
+      get "/login"
+      follow_redirect!
       assert_response :success
       assert_template "user/login"
       post "/login", :username => user.email, :password => "test", :referer => "/diary/new"