# -- Save revised way
pointlist.collect! do |a|
- renumberednodes[a] ? renumberednodes[a] : a
+ renumberednodes[a] || a
end
new_way = Way.new
new_way.tags = attributes
INNER JOIN current_relation_members crm ON crm.id=cr.id
INNER JOIN current_nodes cn ON crm.member_id=cn.id AND crm.member_type='Node'
WHERE #{OSM.sql_for_area(bbox, 'cn.')}
- SQL
+ SQL
unless way_ids.empty?
sql += <<-SQL
UNION
INNER JOIN current_relation_members crm ON crm.id=cr.id
WHERE crm.member_type='Way'
AND crm.member_id IN (#{way_ids.join(',')})
- SQL
+ SQL
end
ActiveRecord::Base.connection.select_all(sql).collect { |a| [a["relid"].to_i, a["version"].to_i] }
end
end
end
+ protected
+
def create_paginators_and_retrieve_collections #:nodoc:
Pagination::OPTIONS[self.class].each do |collection_id, options|
next if options[:actions] && !options[:actions].include?(action_name)
collection.offset(paginator.current.offset).limit(options[:per_page])
end
- protected :create_paginators_and_retrieve_collections,
- :count_collection_for_pagination,
- :find_collection_for_pagination
+ private
def paginator_and_collection_for(_collection_id, options) #:nodoc:
klass = options[:class_name].constantize
[paginator, collection]
end
- private :paginator_and_collection_for
-
# A class representing a paginator for an Active Record collection.
class Paginator
include Enumerable
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
##
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
# 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
##
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
##
-
require "test_helper"
class TitleHelperTest < ActionView::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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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