Fix new rubocop warnings

This commit is contained in:
Tom Hughes 2018-06-18 09:00:49 +01:00
parent 2f6a583510
commit f7a35c5895
18 changed files with 45 additions and 48 deletions

View file

@ -215,8 +215,8 @@ class AmfControllerTest < ActionController::TestCase
ways = map[2].collect { |x| x[0] }
assert ways.include?(way.id),
"map should include used way"
assert !ways.include?(deleted_way.id),
"map should not include deleted way"
assert_not ways.include?(deleted_way.id),
"map should not include deleted way"
end
##
@ -278,8 +278,8 @@ class AmfControllerTest < ActionController::TestCase
assert_equal Array, map[2].class, "third map element should be an array"
# TODO: looks like amf_controller changed since this test was written
# so someone who knows what they're doing should check this!
assert !map[2].include?(way.id),
"map should not include visible way"
assert_not map[2].include?(way.id),
"map should not include visible way"
assert map[2].include?(deleted_way.id),
"map should include deleted way"
end

View file

@ -244,8 +244,8 @@ class ChangesetControllerTest < ActionController::TestCase
# test that it really is closed now
cs = Changeset.find(cs_id)
assert(!cs.is_open?,
"changeset should be closed now (#{cs.closed_at} > #{Time.now.getutc}.")
assert_not(cs.is_open?,
"changeset should be closed now (#{cs.closed_at} > #{Time.now.getutc}.")
end
##
@ -1875,9 +1875,9 @@ CHANGESET
assert_equal Changeset::MAX_ELEMENTS + 1, changeset.num_changes
# check that the changeset is now closed as well
assert(!changeset.is_open?,
"changeset should have been auto-closed by exceeding " \
"element limit.")
assert_not(changeset.is_open?,
"changeset should have been auto-closed by exceeding " \
"element limit.")
end
##

View file

@ -1,4 +1,3 @@
require "test_helper"
class TitleHelperTest < ActionView::TestCase

View file

@ -222,7 +222,7 @@ class BoundingBoxTest < ActiveSupport::TestCase
end
def test_complete
assert !@bbox_from_nils.complete?, "should contain a nil"
assert_not @bbox_from_nils.complete?, "should contain a nil"
assert @bbox_from_string.complete?, "should not contain a nil"
end

View file

@ -50,7 +50,7 @@ class ChangesetCommentTest < ActiveSupport::TestCase
bad.each do |body|
changeset_comment = create(:changeset_comment)
changeset_comment.body = body
assert !changeset_comment.valid?, "#{body} is valid when it shouldn't be"
assert_not changeset_comment.valid?, "#{body} is valid when it shouldn't be"
end
end
end

View file

@ -33,7 +33,7 @@ class ChangesetTagTest < ActiveSupport::TestCase
tag.changeset_id = 1
tag.k = k
tag.v = "v"
assert !tag.valid?, "Key #{k} should be too long"
assert_not tag.valid?, "Key #{k} should be too long"
assert tag.errors[:k].any?
end
end
@ -44,14 +44,14 @@ class ChangesetTagTest < ActiveSupport::TestCase
tag.changeset_id = 1
tag.k = "k"
tag.v = v
assert !tag.valid?, "Value #{v} should be too long"
assert_not tag.valid?, "Value #{v} should be too long"
assert tag.errors[:v].any?
end
end
def test_empty_tag_invalid
tag = ChangesetTag.new
assert !tag.valid?, "Empty tag should be invalid"
assert_not tag.valid?, "Empty tag should be invalid"
assert tag.errors[:changeset].any?
end

View file

@ -14,7 +14,7 @@ class ClientApplicationTest < ActiveSupport::TestCase
bad.each do |url|
app = build(:client_application)
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
@ -31,7 +31,7 @@ class ClientApplicationTest < ActiveSupport::TestCase
bad.each do |url|
app = build(:client_application)
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
@ -48,7 +48,7 @@ class ClientApplicationTest < ActiveSupport::TestCase
bad.each do |url|
app = build(:client_application)
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

View file

@ -20,20 +20,20 @@ class NodeTagTest < ActiveSupport::TestCase
def test_length_key_invalid
tag = create(:node_tag)
tag.k = "k" * 256
assert !tag.valid?, "Key should be too long"
assert_not tag.valid?, "Key should be too long"
assert tag.errors[:k].any?
end
def test_length_value_invalid
tag = create(:node_tag)
tag.v = "v" * 256
assert !tag.valid?, "Value should be too long"
assert_not tag.valid?, "Value should be too long"
assert tag.errors[:v].any?
end
def test_empty_node_tag_invalid
tag = NodeTag.new
assert !tag.valid?, "Empty tag should be invalid"
assert_not tag.valid?, "Empty tag should be invalid"
assert tag.errors[:node].any?
end

View file

@ -14,7 +14,7 @@ class NoteCommentTest < ActiveSupport::TestCase
bad.each do |event|
note_comment = create(:note_comment)
note_comment.event = event
assert !note_comment.valid?, "#{event} is valid when it shouldn't be"
assert_not note_comment.valid?, "#{event} is valid when it shouldn't be"
end
end
@ -33,7 +33,7 @@ class NoteCommentTest < ActiveSupport::TestCase
bad.each do |body|
note_comment = create(:note_comment)
note_comment.body = body
assert !note_comment.valid?, "#{body} is valid when it shouldn't be"
assert_not note_comment.valid?, "#{body} is valid when it shouldn't be"
end
end
end

View file

@ -14,7 +14,7 @@ class NoteTest < ActiveSupport::TestCase
bad.each do |status|
note = create(:note)
note.status = status
assert !note.valid?, "#{status} is valid when it shouldn't be"
assert_not note.valid?, "#{status} is valid when it shouldn't be"
end
end

View file

@ -27,13 +27,13 @@ class OldNodeTagTest < ActiveSupport::TestCase
def test_length_value_invalid
tag = create(:old_node_tag)
tag.v = "v" * 256
assert !tag.valid?, "Value should be too long"
assert_not tag.valid?, "Value should be too long"
assert tag.errors[:v].any?
end
def test_empty_tag_invalid
tag = OldNodeTag.new
assert !tag.valid?, "Empty tag should be invalid"
assert_not tag.valid?, "Empty tag should be invalid"
assert tag.errors[:old_node].any?
end

View file

@ -20,20 +20,20 @@ class OldRelationTagTest < ActiveSupport::TestCase
def test_length_key_invalid
tag = create(:old_relation_tag)
tag.k = "k" * 256
assert !tag.valid?, "Key should be too long"
assert_not tag.valid?, "Key should be too long"
assert tag.errors[:k].any?
end
def test_length_value_invalid
tag = create(:old_relation_tag)
tag.v = "v" * 256
assert !tag.valid?, "Value should be too long"
assert_not tag.valid?, "Value should be too long"
assert tag.errors[:v].any?
end
def test_empty_tag_invalid
tag = OldRelationTag.new
assert !tag.valid?, "Empty tag should be invalid"
assert_not tag.valid?, "Empty tag should be invalid"
assert tag.errors[:old_relation].any?
end

View file

@ -20,20 +20,20 @@ class OldWayTagTest < ActiveSupport::TestCase
def test_length_key_invalid
tag = create(:old_way_tag)
tag.k = "k" * 256
assert !tag.valid?, "Key should be too long"
assert_not tag.valid?, "Key should be too long"
assert tag.errors[:k].any?
end
def test_length_value_invalid
tag = create(:old_way_tag)
tag.v = "v" * 256
assert !tag.valid?, "Value should be too long"
assert_not tag.valid?, "Value should be too long"
assert tag.errors[:v].any?
end
def test_empty_tag_invalid
tag = OldWayTag.new
assert !tag.valid?, "Empty tag should be invalid"
assert_not tag.valid?, "Empty tag should be invalid"
assert tag.errors[:old_way].any?
end

View file

@ -20,20 +20,20 @@ class RelationTagTest < ActiveSupport::TestCase
def test_length_key_invalid
tag = create(:relation_tag)
tag.k = "k" * 256
assert !tag.valid?, "Key should be too long"
assert_not tag.valid?, "Key should be too long"
assert tag.errors[:k].any?
end
def test_length_value_invalid
tag = create(:relation_tag)
tag.v = "v" * 256
assert !tag.valid?, "Value should be too long"
assert_not tag.valid?, "Value should be too long"
assert tag.errors[:v].any?
end
def test_empty_tag_invalid
tag = RelationTag.new
assert !tag.valid?, "Empty relation tag should be invalid"
assert_not tag.valid?, "Empty relation tag should be invalid"
assert tag.errors[:relation].any?
end

View file

@ -67,7 +67,7 @@ class UserTest < ActiveSupport::TestCase
user.display_name = "123"
assert user.valid?, " should allow nil display name"
user.display_name = "12"
assert !user.valid?, "should not allow 2 char name"
assert_not user.valid?, "should not allow 2 char name"
user.display_name = ""
assert_not user.valid?
user.display_name = nil
@ -99,7 +99,7 @@ class UserTest < ActiveSupport::TestCase
bad.each do |display_name|
user = build(:user)
user.display_name = display_name
assert !user.valid?, "#{display_name} is valid when it shouldn't be"
assert_not user.valid?, "#{display_name} is valid when it shouldn't be"
end
end

View file

@ -20,20 +20,20 @@ class WayTagTest < ActiveSupport::TestCase
def test_length_key_invalid
tag = create(:way_tag)
tag.k = "k" * 256
assert !tag.valid?, "Key should be too long"
assert_not tag.valid?, "Key should be too long"
assert tag.errors[:k].any?
end
def test_length_value_invalid
tag = create(:way_tag)
tag.v = "v" * 256
assert !tag.valid?, "Value should be too long"
assert_not tag.valid?, "Value should be too long"
assert tag.errors[:v].any?
end
def test_empty_tag_invalid
tag = WayTag.new
assert !tag.valid?, "Empty way tag should be invalid"
assert_not tag.valid?, "Empty way tag should be invalid"
assert tag.errors[:way].any?
end