From: Tom Hughes Date: Thu, 17 May 2018 18:39:25 +0000 (+0100) Subject: Update for rubocop 0.54.0 X-Git-Tag: live~3606 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/cb3c4ec09b70e7eae62494af795187b32128fd0c Update for rubocop 0.54.0 --- diff --git a/.rubocop.yml b/.rubocop.yml index 6f721998d..fc2b5cd85 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,26 +1,5 @@ inherit_from: .rubocop_todo.yml -AllCops: - Include: - - '**/*.gemspec' - - '**/*.podspec' - - '**/*.jbuilder' - - '**/*.rake' - - '**/*.opal' - - '**/config.ru' - - '**/Gemfile' - - '**/Rakefile' - - '**/Capfile' - - '**/Guardfile' - - '**/Podfile' - - '**/Thorfile' - - '**/Vagrantfile' - - '**/Berksfile' - - '**/Cheffile' - - '**/Vagabondfile' - - '**/Fastfile' - - '**/*.builder' - Rails: Enabled: true diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index e149b83c7..e8d452fc7 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -567,7 +567,7 @@ class UserControllerTest < ActionController::TestCase stub_gravatar_request(user.new_email, 200) confirm_string = user.tokens.create.token # precondition gravatar should be turned off - assert !user.image_use_gravatar + assert_not user.image_use_gravatar post :confirm_email, :params => { :confirm_string => confirm_string } assert_response :redirect assert_redirected_to :action => :account, :display_name => user.display_name @@ -588,7 +588,7 @@ class UserControllerTest < ActionController::TestCase assert_redirected_to :action => :account, :display_name => user.display_name assert_match /Confirmed your change of email address/, flash[:notice] # gravatar use should now be disabled - assert !User.find(user.id).image_use_gravatar + assert_not User.find(user.id).image_use_gravatar end def test_terms_new_user diff --git a/test/integration/user_terms_seen_test.rb b/test/integration/user_terms_seen_test.rb index 7ec7fa730..811883f5f 100644 --- a/test/integration/user_terms_seen_test.rb +++ b/test/integration/user_terms_seen_test.rb @@ -44,7 +44,7 @@ class UserTermsSeenTest < ActionDispatch::IntegrationTest # should be carried through to a normal login with a message assert_response :success - assert !flash[:notice].nil? + assert_not flash[:notice].nil? end end diff --git a/test/models/acl_test.rb b/test/models/acl_test.rb index 189f92677..d3d8f26fe 100644 --- a/test/models/acl_test.rb +++ b/test/models/acl_test.rb @@ -5,17 +5,17 @@ class AclTest < ActiveSupport::TestCase acl = create(:acl) assert acl.valid? acl.k = nil - assert !acl.valid? + assert_not acl.valid? end def test_no_account_creation_by_subnet - assert !Acl.no_account_creation("192.168.1.1") + assert_not Acl.no_account_creation("192.168.1.1") create(:acl, :address => "192.168.0.0/16", :k => "no_account_creation") assert Acl.no_account_creation("192.168.1.1") end def test_no_account_creation_by_domain - assert !Acl.no_account_creation("192.168.1.1", "example.com") + assert_not Acl.no_account_creation("192.168.1.1", "example.com") create(:acl, :domain => "example.com", :k => "no_account_creation") assert Acl.no_account_creation("192.168.1.1", "example.com") end diff --git a/test/models/changeset_comment_test.rb b/test/models/changeset_comment_test.rb index 8e8d0cd70..58fdb9e75 100644 --- a/test/models/changeset_comment_test.rb +++ b/test/models/changeset_comment_test.rb @@ -6,27 +6,27 @@ class ChangesetCommentTest < ActiveSupport::TestCase comment = create(:changeset_comment) comment.author = nil - assert !comment.valid? + assert_not comment.valid? comment.author_id = 999111 - assert !comment.valid? + assert_not comment.valid? end def test_does_not_accept_invalid_changeset comment = create(:changeset_comment) comment.changeset = nil - assert !comment.valid? + assert_not comment.valid? comment.changeset_id = 999111 - assert !comment.valid? + assert_not comment.valid? end def test_does_not_accept_empty_visible comment = create(:changeset_comment) comment.visible = nil - assert !comment.valid? + assert_not comment.valid? end def test_comments_of_changeset_count diff --git a/test/models/changeset_tag_test.rb b/test/models/changeset_tag_test.rb index 030614a1e..2788d6f2d 100644 --- a/test/models/changeset_tag_test.rb +++ b/test/models/changeset_tag_test.rb @@ -62,7 +62,7 @@ class ChangesetTagTest < ActiveSupport::TestCase tag.k = existing.k tag.v = existing.v assert tag.new_record? - assert !tag.valid? + assert_not tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } assert tag.new_record? end diff --git a/test/models/message_test.rb b/test/models/message_test.rb index 285222f1e..48319843b 100644 --- a/test/models/message_test.rb +++ b/test/models/message_test.rb @@ -5,11 +5,11 @@ class MessageTest < ActiveSupport::TestCase def test_check_empty_message_fails message = Message.new - assert !message.valid? + assert_not message.valid? assert message.errors[:title].any? assert message.errors[:body].any? assert message.errors[:sent_on].any? - assert !message.message_read + assert_not message.message_read end def test_validating_msgs @@ -23,7 +23,7 @@ class MessageTest < ActiveSupport::TestCase message = create(:message, :unread) message.sender = nil message.recipient = nil - assert !message.valid? + assert_not message.valid? assert_raise(ActiveRecord::RecordNotFound) { User.find(0) } message.from_user_id = 0 diff --git a/test/models/node_tag_test.rb b/test/models/node_tag_test.rb index 29eda2bff..57a5f0d43 100644 --- a/test/models/node_tag_test.rb +++ b/test/models/node_tag_test.rb @@ -44,7 +44,7 @@ class NodeTagTest < ActiveSupport::TestCase tag.k = existing.k tag.v = existing.v assert tag.new_record? - assert !tag.valid? + assert_not tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } assert tag.new_record? end diff --git a/test/models/old_node_tag_test.rb b/test/models/old_node_tag_test.rb index 3f0867a87..33871657e 100644 --- a/test/models/old_node_tag_test.rb +++ b/test/models/old_node_tag_test.rb @@ -20,7 +20,7 @@ class OldNodeTagTest < ActiveSupport::TestCase def test_length_key_invalid tag = create(:old_node_tag) tag.k = "k" * 256 - assert !tag.valid? + assert_not tag.valid? assert tag.errors[:k].any? end @@ -45,7 +45,7 @@ class OldNodeTagTest < ActiveSupport::TestCase tag.k = existing.k tag.v = existing.v assert tag.new_record? - assert !tag.valid? + assert_not tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } assert tag.new_record? end diff --git a/test/models/old_relation_tag_test.rb b/test/models/old_relation_tag_test.rb index 58c70cc9c..d9dae2473 100644 --- a/test/models/old_relation_tag_test.rb +++ b/test/models/old_relation_tag_test.rb @@ -45,7 +45,7 @@ class OldRelationTagTest < ActiveSupport::TestCase tag.k = existing.k tag.v = existing.v assert tag.new_record? - assert !tag.valid? + assert_not tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } assert tag.new_record? end diff --git a/test/models/old_way_tag_test.rb b/test/models/old_way_tag_test.rb index 057bdf4f0..b2b693424 100644 --- a/test/models/old_way_tag_test.rb +++ b/test/models/old_way_tag_test.rb @@ -45,7 +45,7 @@ class OldWayTagTest < ActiveSupport::TestCase tag.k = existing.k tag.v = existing.v assert tag.new_record? - assert !tag.valid? + assert_not tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } assert tag.new_record? end diff --git a/test/models/relation_tag_test.rb b/test/models/relation_tag_test.rb index 3b4d2cdfc..cf9b24ded 100644 --- a/test/models/relation_tag_test.rb +++ b/test/models/relation_tag_test.rb @@ -44,7 +44,7 @@ class RelationTagTest < ActiveSupport::TestCase tag.k = existing.k tag.v = existing.v assert tag.new_record? - assert !tag.valid? + assert_not tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } assert tag.new_record? end diff --git a/test/models/tracepoint_test.rb b/test/models/tracepoint_test.rb index ae258f43a..670db5bce 100644 --- a/test/models/tracepoint_test.rb +++ b/test/models/tracepoint_test.rb @@ -5,7 +5,7 @@ class TracepointTest < ActiveSupport::TestCase tracepoint = create(:tracepoint) assert tracepoint.valid? tracepoint.timestamp = nil - assert !tracepoint.valid? + assert_not tracepoint.valid? end # Ensure the lat/lon is formatted as a decimal e.g. not 4.0e-05 diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 8af701ca0..168b9c3fa 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -5,7 +5,7 @@ class UserTest < ActiveSupport::TestCase def test_invalid_with_empty_attributes user = User.new - assert !user.valid? + assert_not user.valid? assert user.errors[:email].any? assert user.errors[:pass_crypt].any? assert user.errors[:display_name].any? @@ -25,7 +25,7 @@ class UserTest < ActiveSupport::TestCase :data_public => 1, :description => "desc" ) - assert !new_user.save + assert_not new_user.save assert new_user.errors[:email].include?("has already been taken") end @@ -39,7 +39,7 @@ class UserTest < ActiveSupport::TestCase :data_public => 1, :description => "desc" ) - assert !new_user.save + assert_not new_user.save assert new_user.errors[:display_name].include?("has already been taken") end @@ -69,12 +69,12 @@ class UserTest < ActiveSupport::TestCase user.display_name = "12" assert !user.valid?, "should not allow 2 char name" user.display_name = "" - assert !user.valid? + assert_not user.valid? user.display_name = nil # Don't understand why it isn't allowing a nil value, # when the validates statements specifically allow it # It appears the database does not allow null values - assert !user.valid? + assert_not user.valid? end def test_display_name_valid @@ -110,11 +110,11 @@ class UserTest < ActiveSupport::TestCase create(:friend, :befriender => alice, :befriendee => bob) assert alice.is_friends_with?(bob) - assert !alice.is_friends_with?(charlie) - assert !bob.is_friends_with?(alice) - assert !bob.is_friends_with?(charlie) - assert !charlie.is_friends_with?(bob) - assert !charlie.is_friends_with?(alice) + assert_not alice.is_friends_with?(charlie) + assert_not bob.is_friends_with?(alice) + assert_not bob.is_friends_with?(charlie) + assert_not charlie.is_friends_with?(bob) + assert_not charlie.is_friends_with?(alice) end def test_users_nearby diff --git a/test/models/way_tag_test.rb b/test/models/way_tag_test.rb index cde5bd415..a3699cac4 100644 --- a/test/models/way_tag_test.rb +++ b/test/models/way_tag_test.rb @@ -44,7 +44,7 @@ class WayTagTest < ActiveSupport::TestCase tag.k = existing.k tag.v = existing.v assert tag.new_record? - assert !tag.valid? + assert_not tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } assert tag.new_record? end