]> git.openstreetmap.org Git - rails.git/commitdiff
Rubocop fixes and increase per method complexity limit from 23 to 25
authorSimon Poole <simon@poole.ch>
Wed, 30 Jan 2019 13:39:05 +0000 (14:39 +0100)
committerSimon Poole <simon@poole.ch>
Mon, 13 May 2019 14:54:29 +0000 (16:54 +0200)
.rubocop_todo.yml
app/controllers/users_controller.rb
test/integration/user_creation_test.rb

index b2cc901b0959f1888f03e33b531ffce6d2d57210..f989d393d21b145266974809a700885a9834f15e 100644 (file)
@@ -73,7 +73,7 @@ Metrics/ParameterLists:
 
 # Offense count: 72
 Metrics/PerceivedComplexity:
-  Max: 23
+  Max: 25
 
 # Offense count: 6
 Naming/AccessorMethodName:
index bbe60e39ca231349224c89a8156faeaec10f486a..925d8752f77b8e35bf4b556f85c2db07ca819462 100644 (file)
@@ -36,7 +36,7 @@ class UsersController < ApplicationController
   def save
     @title = t "users.new.title"
 
-    if params[:decline] || !params[:read_tou] || params[:read_tou] == 0
+    if params[:decline] || !params[:read_tou] || params[:read_tou] == "0"
       if current_user
         current_user.terms_seen = true
 
index e344b5879b744bc2c3d1552d1bed809882ebc277..3a8f4b552b06a313a72e225dfd3fd1b5ac3fb6ac 100644 (file)
@@ -7,9 +7,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest
     OmniAuth.config.test_mode = true
 
     stub_request(:get, /.*gravatar.com.*d=404/).to_return(:status => 404)
-    stub_request(:get, "https://api.hostip.info/country.php?ip=127.0.0.1").
-      to_return(status: 200, body: "", headers: {})
-
+    stub_hostip_requests
   end
 
   def teardown
@@ -143,7 +141,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
     end
   end
 
-
   # Check that the user can successfully recover their password
   def lost_password_recovery_success
     # Open the lost password form
@@ -221,7 +218,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest
           assert_response :redirect
           assert_redirected_to "/user/terms"
           post "/user/save",
-               :params => { :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :auth_provider => "openid", :auth_uid => "http://localhost:1123/new.tester", :pass_crypt => password, :pass_crypt_confirmation => password }, :read_tou => 1}
+               :params => { :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :auth_provider => "openid", :auth_uid => "http://localhost:1123/new.tester", :pass_crypt => password, :pass_crypt_confirmation => password }, :read_tou => 1 }
           assert_response :redirect
           follow_redirect!
         end