Update for rubocop 0.54.0

This commit is contained in:
Tom Hughes 2018-05-17 19:39:25 +01:00
parent b126f02df9
commit cb3c4ec09b
15 changed files with 33 additions and 54 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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