Fix rubocop warnings
This commit is contained in:
parent
95eda2d381
commit
5b33f3f8e3
61 changed files with 547 additions and 541 deletions
15
.rubocop.yml
15
.rubocop.yml
|
@ -24,18 +24,21 @@ AllCops:
|
|||
Rails:
|
||||
Enabled: true
|
||||
|
||||
Layout/ExtraSpacing:
|
||||
AllowForAlignment: true
|
||||
|
||||
Style/BracesAroundHashParameters:
|
||||
EnforcedStyle: context_dependent
|
||||
|
||||
Style/ExtraSpacing:
|
||||
AllowForAlignment: true
|
||||
|
||||
Style/FileName:
|
||||
Exclude:
|
||||
- 'script/deliver-message'
|
||||
- 'script/locale/reload-languages'
|
||||
- 'script/update-spam-blocks'
|
||||
|
||||
Style/FormatStringToken:
|
||||
EnforcedStyle: template
|
||||
|
||||
Style/IfInsideElse:
|
||||
Enabled: false
|
||||
|
||||
|
@ -55,6 +58,12 @@ Style/HashSyntax:
|
|||
Style/StringLiterals:
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
Style/SymbolArray:
|
||||
EnforcedStyle: brackets
|
||||
|
||||
Rails/ApplicationRecord:
|
||||
Enabled: false
|
||||
|
||||
Rails/HttpPositionalArguments:
|
||||
Enabled: false
|
||||
|
||||
|
|
|
@ -410,9 +410,9 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def map_layout
|
||||
append_content_security_policy_directives(
|
||||
:connect_src => %w(nominatim.openstreetmap.org overpass-api.de router.project-osrm.org valhalla.mapzen.com),
|
||||
:script_src => %w(graphhopper.com open.mapquestapi.com),
|
||||
:img_src => %w(developer.mapquest.com)
|
||||
:connect_src => %w[nominatim.openstreetmap.org overpass-api.de router.project-osrm.org valhalla.mapzen.com],
|
||||
:script_src => %w[graphhopper.com open.mapquestapi.com],
|
||||
:img_src => %w[developer.mapquest.com]
|
||||
)
|
||||
|
||||
if STATUS == :database_offline || STATUS == :api_offline
|
||||
|
|
|
@ -128,7 +128,7 @@ class DiaryEntryController < ApplicationController
|
|||
return
|
||||
end
|
||||
else
|
||||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w(active confirmed) })
|
||||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
|
||||
|
||||
if params[:language]
|
||||
@title = t "diary_entry.list.in_language_title", :language => Language.find(params[:language]).english_name
|
||||
|
@ -162,7 +162,7 @@ class DiaryEntryController < ApplicationController
|
|||
return
|
||||
end
|
||||
else
|
||||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w(active confirmed) })
|
||||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
|
||||
|
||||
if params[:language]
|
||||
@entries = @entries.where(:language_code => params[:language])
|
||||
|
|
|
@ -49,7 +49,7 @@ class OauthController < ApplicationController
|
|||
else
|
||||
@token.oob? ? @token.client_application.callback_url : @token.callback_url
|
||||
end
|
||||
@redirect_url = URI.parse(callback_url) unless callback_url.blank?
|
||||
@redirect_url = URI.parse(callback_url) if callback_url.present?
|
||||
|
||||
if @redirect_url.to_s.blank?
|
||||
render :action => "authorize_success"
|
||||
|
|
|
@ -69,11 +69,11 @@ class SiteController < ApplicationController
|
|||
require_user
|
||||
end
|
||||
|
||||
if editor == "potlatch" || editor == "potlatch2"
|
||||
if %w[potlatch potlatch2].include?(editor)
|
||||
append_content_security_policy_directives(
|
||||
:object_src => %w(*),
|
||||
:plugin_types => %w(application/x-shockwave-flash),
|
||||
:script_src => %w('unsafe-inline')
|
||||
:object_src => %w[*],
|
||||
:plugin_types => %w[application/x-shockwave-flash],
|
||||
:script_src => %w['unsafe-inline']
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -120,9 +120,9 @@ class SiteController < ApplicationController
|
|||
|
||||
def id
|
||||
append_content_security_policy_directives(
|
||||
:connect_src => %w(taginfo.openstreetmap.org *.mapillary.com),
|
||||
:img_src => %w(*),
|
||||
:script_src => %w(dev.virtualearth.net)
|
||||
:connect_src => %w[taginfo.openstreetmap.org *.mapillary.com],
|
||||
:img_src => %w[*],
|
||||
:script_src => %w[dev.virtualearth.net]
|
||||
)
|
||||
|
||||
render "id", :layout => false
|
||||
|
|
|
@ -21,7 +21,7 @@ class TraceController < ApplicationController
|
|||
def list
|
||||
# from display name, pick up user id if one user's traces only
|
||||
display_name = params[:display_name]
|
||||
unless display_name.blank?
|
||||
if display_name.present?
|
||||
target_user = User.active.where(:display_name => display_name).first
|
||||
if target_user.nil?
|
||||
render_unknown_user display_name
|
||||
|
|
|
@ -81,7 +81,7 @@ class UserController < ApplicationController
|
|||
@user.terms_agreed = Time.now.getutc
|
||||
@user.terms_seen = true
|
||||
|
||||
if @user.auth_uid.nil? || @user.auth_uid.empty?
|
||||
if @user.auth_uid.blank?
|
||||
@user.auth_provider = nil
|
||||
@user.auth_uid = nil
|
||||
end
|
||||
|
|
|
@ -99,7 +99,7 @@ module BrowseHelper
|
|||
|
||||
private
|
||||
|
||||
ICON_TAGS = %w(aeroway amenity barrier building highway historic landuse leisure man_made natural railway shop tourism waterway).freeze
|
||||
ICON_TAGS = %w[aeroway amenity barrier building highway historic landuse leisure man_made natural railway shop tourism waterway].freeze
|
||||
|
||||
def icon_tags(object)
|
||||
object.tags.find_all { |k, _v| ICON_TAGS.include? k }.sort
|
||||
|
|
|
@ -75,9 +75,7 @@ class ClientApplication < ActiveRecord::Base
|
|||
# this is the set of permissions that the client can ask for. clients
|
||||
# have to say up-front what permissions they want and when users sign up they
|
||||
# can agree or not agree to each of them.
|
||||
PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary,
|
||||
:allow_write_api, :allow_read_gpx, :allow_write_gpx,
|
||||
:allow_write_notes].freeze
|
||||
PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary, :allow_write_api, :allow_read_gpx, :allow_write_gpx, :allow_write_notes].freeze
|
||||
|
||||
def generate_keys
|
||||
self.key = OAuth::Helper.generate_key(40)[0, 40]
|
||||
|
|
|
@ -3,7 +3,7 @@ class DiaryEntry < ActiveRecord::Base
|
|||
belongs_to :language, :foreign_key => "language_code"
|
||||
|
||||
has_many :comments, -> { order(:id).preload(:user) }, :class_name => "DiaryComment"
|
||||
has_many :visible_comments, -> { joins(:user).where(:visible => true, :users => { :status => %w(active confirmed) }).order(:id) }, :class_name => "DiaryComment"
|
||||
has_many :visible_comments, -> { joins(:user).where(:visible => true, :users => { :status => %w[active confirmed] }).order(:id) }, :class_name => "DiaryComment"
|
||||
has_many :subscriptions, :class_name => "DiaryEntrySubscription"
|
||||
has_many :subscribers, :through => :subscriptions, :source => :user
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class Note < ActiveRecord::Base
|
|||
:numericality => { :on => :update, :integer_only => true }
|
||||
validates :latitude, :longitude, :numericality => { :only_integer => true }
|
||||
validates :closed_at, :presence => true, :if => proc { :status == "closed" }
|
||||
validates :status, :inclusion => %w(open closed hidden)
|
||||
validates :status, :inclusion => %w[open closed hidden]
|
||||
|
||||
validate :validate_position
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class NoteComment < ActiveRecord::Base
|
|||
validates :note, :presence => true, :associated => true
|
||||
validates :visible, :inclusion => [true, false]
|
||||
validates :author, :associated => true
|
||||
validates :event, :inclusion => %w(opened closed reopened commented hidden)
|
||||
validates :event, :inclusion => %w[opened closed reopened commented hidden]
|
||||
validates :body, :format => /\A[^\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff]*\z/
|
||||
|
||||
# Return the comment text
|
||||
|
|
|
@ -15,7 +15,7 @@ class Redaction < ActiveRecord::Base
|
|||
has_many :old_relations
|
||||
|
||||
validates :description, :presence => true
|
||||
validates :description_format, :inclusion => { :in => %w(text html markdown) }
|
||||
validates :description_format, :inclusion => { :in => %w[text html markdown] }
|
||||
|
||||
# this method overrides the AR default to provide the rich
|
||||
# text object for the description field.
|
||||
|
|
|
@ -33,7 +33,7 @@ class Relation < ActiveRecord::Base
|
|||
scope :ways, ->(*ids) { joins(:relation_members).where(:current_relation_members => { :member_type => "Way", :member_id => ids.flatten }) }
|
||||
scope :relations, ->(*ids) { joins(:relation_members).where(:current_relation_members => { :member_type => "Relation", :member_id => ids.flatten }) }
|
||||
|
||||
TYPES = %w(node way relation).freeze
|
||||
TYPES = %w[node way relation].freeze
|
||||
|
||||
def self.from_xml(xml, create = false)
|
||||
p = XML::Parser.string(xml, :options => XML::Parser::Options::NOERROR)
|
||||
|
|
|
@ -7,14 +7,14 @@ class Trace < ActiveRecord::Base
|
|||
|
||||
scope :visible, -> { where(:visible => true) }
|
||||
scope :visible_to, ->(u) { visible.where("visibility IN ('public', 'identifiable') OR user_id = ?", u) }
|
||||
scope :visible_to_all, -> { where(:visibility => %w(public identifiable)) }
|
||||
scope :visible_to_all, -> { where(:visibility => %w[public identifiable]) }
|
||||
scope :tagged, ->(t) { joins(:tags).where(:gpx_file_tags => { :tag => t }) }
|
||||
|
||||
validates :user, :presence => true, :associated => true
|
||||
validates :name, :presence => true, :length => 1..255
|
||||
validates :description, :presence => { :on => :create }, :length => 1..255
|
||||
validates :timestamp, :presence => true
|
||||
validates :visibility, :inclusion => %w(private public trackable identifiable)
|
||||
validates :visibility, :inclusion => %w[private public trackable identifiable]
|
||||
|
||||
def destroy
|
||||
super
|
||||
|
@ -29,7 +29,7 @@ class Trace < ActiveRecord::Base
|
|||
|
||||
def tagstring=(s)
|
||||
self.tags = if s.include? ","
|
||||
s.split(/\s*,\s*/).select { |tag| tag !~ /^\s*$/ }.collect do |tag|
|
||||
s.split(/\s*,\s*/).reject { |tag| tag =~ /^\s*$/ }.collect do |tag|
|
||||
tt = Tracetag.new
|
||||
tt.tag = tag
|
||||
tt
|
||||
|
|
|
@ -9,7 +9,7 @@ class User < ActiveRecord::Base
|
|||
has_many :messages, -> { where(:to_user_visible => true).order(:sent_on => :desc).preload(:sender, :recipient) }, :foreign_key => :to_user_id
|
||||
has_many :new_messages, -> { where(:to_user_visible => true, :message_read => false).order(:sent_on => :desc) }, :class_name => "Message", :foreign_key => :to_user_id
|
||||
has_many :sent_messages, -> { where(:from_user_visible => true).order(:sent_on => :desc).preload(:sender, :recipient) }, :class_name => "Message", :foreign_key => :from_user_id
|
||||
has_many :friends, -> { joins(:befriendee).where(:users => { :status => %w(active confirmed) }) }
|
||||
has_many :friends, -> { joins(:befriendee).where(:users => { :status => %w[active confirmed] }) }
|
||||
has_many :friend_users, :through => :friends, :source => :befriendee
|
||||
has_many :tokens, :class_name => "UserToken"
|
||||
has_many :preferences, :class_name => "UserPreference"
|
||||
|
@ -28,8 +28,8 @@ class User < ActiveRecord::Base
|
|||
|
||||
has_many :roles, :class_name => "UserRole"
|
||||
|
||||
scope :visible, -> { where(:status => %w(pending active confirmed)) }
|
||||
scope :active, -> { where(:status => %w(active confirmed)) }
|
||||
scope :visible, -> { where(:status => %w[pending active confirmed]) }
|
||||
scope :active, -> { where(:status => %w[active confirmed]) }
|
||||
scope :identifiable, -> { where(:data_public => true) }
|
||||
|
||||
has_attached_file :image,
|
||||
|
@ -37,7 +37,7 @@ class User < ActiveRecord::Base
|
|||
:styles => { :large => "100x100>", :small => "50x50>" }
|
||||
|
||||
validates :display_name, :presence => true, :allow_nil => true, :length => 3..255,
|
||||
:exclusion => %w(new terms save confirm confirm-email go_public reset-password forgot-password suspended)
|
||||
:exclusion => %w[new terms save confirm confirm-email go_public reset-password forgot-password suspended]
|
||||
validates :display_name, :if => proc { |u| u.display_name_changed? },
|
||||
:uniqueness => { :case_sensitive => false }
|
||||
validates :display_name, :if => proc { |u| u.display_name_changed? },
|
||||
|
@ -161,13 +161,13 @@ class User < ActiveRecord::Base
|
|||
##
|
||||
# returns true if a user is visible
|
||||
def visible?
|
||||
%w(pending active confirmed).include? status
|
||||
%w[pending active confirmed].include? status
|
||||
end
|
||||
|
||||
##
|
||||
# returns true if a user is active
|
||||
def active?
|
||||
%w(active confirmed).include? status
|
||||
%w[active confirmed].include? status
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -2,7 +2,7 @@ class UserRole < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
belongs_to :granter, :class_name => "User"
|
||||
|
||||
ALL_ROLES = %w(administrator moderator).freeze
|
||||
ALL_ROLES = %w[administrator moderator].freeze
|
||||
|
||||
validates :role, :inclusion => ALL_ROLES, :uniqueness => { :scope => :user_id }
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ module OpenStreetMap
|
|||
config.active_record.raise_in_transactional_callbacks = true unless STATUS == :database_offline
|
||||
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.autoload_paths += %W(#{config.root}/lib)
|
||||
config.autoload_paths += %W[#{config.root}/lib]
|
||||
|
||||
# Use SQL instead of Active Record's schema dumper when creating the database.
|
||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||
|
|
|
@ -11,24 +11,24 @@ Rails.application.config.assets.paths << Rails.root.join("config")
|
|||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
Rails.application.config.assets.precompile += %w(index.js browse.js welcome.js fixthemap.js)
|
||||
Rails.application.config.assets.precompile += %w(user.js login.js diary_entry.js edit/*.js)
|
||||
Rails.application.config.assets.precompile += %w(screen-ltr.css print-ltr.css)
|
||||
Rails.application.config.assets.precompile += %w(screen-rtl.css print-rtl.css)
|
||||
Rails.application.config.assets.precompile += %w(leaflet-all.css leaflet.ie.css)
|
||||
Rails.application.config.assets.precompile += %w(id.js id.css)
|
||||
Rails.application.config.assets.precompile += %w(embed.js embed.css)
|
||||
Rails.application.config.assets.precompile += %w(html5shiv.js)
|
||||
Rails.application.config.assets.precompile += %w(images/marker-*.png img/*-handle.png)
|
||||
Rails.application.config.assets.precompile += %w(swfobject.js expressInstall.swf)
|
||||
Rails.application.config.assets.precompile += %w(potlatch2.swf)
|
||||
Rails.application.config.assets.precompile += %w(potlatch2/assets.zip)
|
||||
Rails.application.config.assets.precompile += %w(potlatch2/FontLibrary.swf)
|
||||
Rails.application.config.assets.precompile += %w(potlatch2/locales/*.swf)
|
||||
Rails.application.config.assets.precompile += %w(help/introduction.*)
|
||||
Rails.application.config.assets.precompile += %w(iD/img/*.svg iD/img/*.png iD/img/*.gif)
|
||||
Rails.application.config.assets.precompile += %w(iD/img/pattern/*.png)
|
||||
Rails.application.config.assets.precompile += %w(iD/locales/*.json)
|
||||
Rails.application.config.assets.precompile += %w(iD/traffico/stylesheets/traffico.css)
|
||||
Rails.application.config.assets.precompile += %w(iD/traffico/fonts/traffico_*)
|
||||
Rails.application.config.assets.precompile += %w(iD/traffico/string-maps/*.json)
|
||||
Rails.application.config.assets.precompile += %w[index.js browse.js welcome.js fixthemap.js]
|
||||
Rails.application.config.assets.precompile += %w[user.js login.js diary_entry.js edit/*.js]
|
||||
Rails.application.config.assets.precompile += %w[screen-ltr.css print-ltr.css]
|
||||
Rails.application.config.assets.precompile += %w[screen-rtl.css print-rtl.css]
|
||||
Rails.application.config.assets.precompile += %w[leaflet-all.css leaflet.ie.css]
|
||||
Rails.application.config.assets.precompile += %w[id.js id.css]
|
||||
Rails.application.config.assets.precompile += %w[embed.js embed.css]
|
||||
Rails.application.config.assets.precompile += %w[html5shiv.js]
|
||||
Rails.application.config.assets.precompile += %w[images/marker-*.png img/*-handle.png]
|
||||
Rails.application.config.assets.precompile += %w[swfobject.js expressInstall.swf]
|
||||
Rails.application.config.assets.precompile += %w[potlatch2.swf]
|
||||
Rails.application.config.assets.precompile += %w[potlatch2/assets.zip]
|
||||
Rails.application.config.assets.precompile += %w[potlatch2/FontLibrary.swf]
|
||||
Rails.application.config.assets.precompile += %w[potlatch2/locales/*.swf]
|
||||
Rails.application.config.assets.precompile += %w[help/introduction.*]
|
||||
Rails.application.config.assets.precompile += %w[iD/img/*.svg iD/img/*.png iD/img/*.gif]
|
||||
Rails.application.config.assets.precompile += %w[iD/img/pattern/*.png]
|
||||
Rails.application.config.assets.precompile += %w[iD/locales/*.json]
|
||||
Rails.application.config.assets.precompile += %w[iD/traffico/stylesheets/traffico.css]
|
||||
Rails.application.config.assets.precompile += %w[iD/traffico/fonts/traffico_*]
|
||||
Rails.application.config.assets.precompile += %w[iD/traffico/string-maps/*.json]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Sanitize::Config::OSM = Sanitize::Config::RELAXED.dup
|
||||
|
||||
Sanitize::Config::OSM[:elements] -= %w(div style)
|
||||
Sanitize::Config::OSM[:elements] -= %w[div style]
|
||||
Sanitize::Config::OSM[:add_attributes] = { "a" => { "rel" => "nofollow" } }
|
||||
Sanitize::Config::OSM[:remove_contents] = %w(script style)
|
||||
Sanitize::Config::OSM[:remove_contents] = %w[script style]
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
if defined?(CSP_REPORT_URL)
|
||||
policy = {
|
||||
:default_src => %w('self'),
|
||||
:child_src => %w('self'),
|
||||
:connect_src => %w('self'),
|
||||
:font_src => %w('none'),
|
||||
:form_action => %w('self'),
|
||||
:frame_ancestors => %w('self'),
|
||||
:img_src => %w('self' data: www.gravatar.com *.wp.com *.tile.openstreetmap.org *.tile.thunderforest.com *.openstreetmap.fr),
|
||||
:media_src => %w('none'),
|
||||
:object_src => %w('self'),
|
||||
:plugin_types => %w('none'),
|
||||
:script_src => %w('self'),
|
||||
:style_src => %w('self' 'unsafe-inline'),
|
||||
:default_src => %w['self'],
|
||||
:child_src => %w['self'],
|
||||
:connect_src => %w['self'],
|
||||
:font_src => %w['none'],
|
||||
:form_action => %w['self'],
|
||||
:frame_ancestors => %w['self'],
|
||||
:img_src => %w['self' data: www.gravatar.com *.wp.com *.tile.openstreetmap.org *.tile.thunderforest.com *.openstreetmap.fr],
|
||||
:media_src => %w['none'],
|
||||
:object_src => %w['self'],
|
||||
:plugin_types => %w['none'],
|
||||
:script_src => %w['self'],
|
||||
:style_src => %w['self' 'unsafe-inline'],
|
||||
:report_uri => [CSP_REPORT_URL]
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
add_index "current_nodes", ["id"], :name => "current_nodes_id_idx"
|
||||
add_index "current_nodes", %w(latitude longitude), :name => "current_nodes_lat_lon_idx"
|
||||
add_index "current_nodes", %w[latitude longitude], :name => "current_nodes_lat_lon_idx"
|
||||
add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
|
||||
|
||||
create_table "current_segments", :id => false do |t|
|
||||
|
@ -26,7 +26,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
t.column "timestamp", :datetime
|
||||
end
|
||||
|
||||
add_index "current_segments", %w(id visible), :name => "current_segments_id_visible_idx"
|
||||
add_index "current_segments", %w[id visible], :name => "current_segments_id_visible_idx"
|
||||
add_index "current_segments", ["node_a"], :name => "current_segments_a_idx"
|
||||
add_index "current_segments", ["node_b"], :name => "current_segments_b_idx"
|
||||
|
||||
|
@ -82,7 +82,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
t.column "timestamp", :datetime
|
||||
end
|
||||
|
||||
add_index "gps_points", %w(latitude longitude user_id), :name => "points_idx"
|
||||
add_index "gps_points", %w[latitude longitude user_id], :name => "points_idx"
|
||||
add_index "gps_points", ["user_id"], :name => "points_uid_idx"
|
||||
add_index "gps_points", ["gpx_id"], :name => "points_gpxid_idx"
|
||||
|
||||
|
@ -109,7 +109,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
add_index "gpx_files", ["timestamp"], :name => "gpx_files_timestamp_idx"
|
||||
add_index "gpx_files", %w(visible public), :name => "gpx_files_visible_public_idx"
|
||||
add_index "gpx_files", %w[visible public], :name => "gpx_files_visible_public_idx"
|
||||
|
||||
create_table "gpx_pending_files", :id => false do |t|
|
||||
t.column "originalname", :string
|
||||
|
@ -148,7 +148,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
add_index "nodes", ["id"], :name => "nodes_uid_idx"
|
||||
add_index "nodes", %w(latitude longitude), :name => "nodes_latlon_idx"
|
||||
add_index "nodes", %w[latitude longitude], :name => "nodes_latlon_idx"
|
||||
|
||||
create_table "segments", :id => false do |t|
|
||||
t.column "id", :bigint
|
||||
|
@ -193,7 +193,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
t.column "sequence_id", :bigint, :null => false
|
||||
end
|
||||
|
||||
add_primary_key "way_segments", %w(id version sequence_id)
|
||||
add_primary_key "way_segments", %w[id version sequence_id]
|
||||
|
||||
create_table "way_tags", :id => false do |t|
|
||||
t.column "id", :bigint, :default => 0, :null => false
|
||||
|
@ -202,7 +202,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
t.column "version", :bigint
|
||||
end
|
||||
|
||||
add_index "way_tags", %w(id version), :name => "way_tags_id_version_idx"
|
||||
add_index "way_tags", %w[id version], :name => "way_tags_id_version_idx"
|
||||
|
||||
create_table "ways", :id => false do |t|
|
||||
t.column "id", :bigint, :default => 0, :null => false
|
||||
|
@ -212,7 +212,7 @@ class CreateOsmDb < ActiveRecord::Migration
|
|||
t.column "visible", :boolean, :default => true
|
||||
end
|
||||
|
||||
add_primary_key "ways", %w(id version)
|
||||
add_primary_key "ways", %w[id version]
|
||||
add_index "ways", ["id"], :name => "ways_id_version_idx"
|
||||
end
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class CleanupOsmDb < ActiveRecord::Migration
|
|||
change_column "current_way_segments", "id", :bigint, :null => false
|
||||
change_column "current_way_segments", "segment_id", :bigint, :null => false
|
||||
change_column "current_way_segments", "sequence_id", :bigint, :null => false
|
||||
add_primary_key "current_way_segments", %w(id sequence_id)
|
||||
add_primary_key "current_way_segments", %w[id sequence_id]
|
||||
remove_index "current_way_segments", :name => "current_way_segments_id_idx"
|
||||
|
||||
change_column "current_way_tags", "id", :bigint, :null => false
|
||||
|
@ -40,7 +40,7 @@ class CleanupOsmDb < ActiveRecord::Migration
|
|||
remove_index "gps_points", :name => "points_uid_idx"
|
||||
remove_index "gps_points", :name => "points_idx"
|
||||
remove_column "gps_points", "user_id"
|
||||
add_index "gps_points", %w(latitude longitude), :name => "points_idx"
|
||||
add_index "gps_points", %w[latitude longitude], :name => "points_idx"
|
||||
change_column "gps_points", "trackid", :integer, :null => false
|
||||
change_column "gps_points", "latitude", :integer, :null => false
|
||||
change_column "gps_points", "longitude", :integer, :null => false
|
||||
|
@ -204,7 +204,7 @@ class CleanupOsmDb < ActiveRecord::Migration
|
|||
change_column "current_way_segments", "segment_id", :bigint
|
||||
change_column "current_way_segments", "id", :bigint
|
||||
|
||||
add_index "current_segments", %w(id visible), :name => "current_segments_id_visible_idx"
|
||||
add_index "current_segments", %w[id visible], :name => "current_segments_id_visible_idx"
|
||||
remove_primary_key "current_segments"
|
||||
change_column "current_segments", "timestamp", :datetime
|
||||
change_column "current_segments", "visible", :boolean
|
||||
|
|
|
@ -12,7 +12,7 @@ class UserEnhancements < ActiveRecord::Migration
|
|||
t.column "v", :string, :null => false
|
||||
end
|
||||
|
||||
add_primary_key "user_preferences", %w(user_id k)
|
||||
add_primary_key "user_preferences", %w[user_id k]
|
||||
|
||||
create_table "user_tokens", :id => false do |t|
|
||||
t.column "id", :bigserial, :primary_key => true, :null => false
|
||||
|
|
|
@ -20,7 +20,7 @@ class TileTracepoints < ActiveRecord::Migration
|
|||
def self.down
|
||||
Tracepoint.update_all("latitude = latitude / 10, longitude = longitude / 10")
|
||||
|
||||
add_index "gps_points", %w(latitude longitude), :name => "points_idx"
|
||||
add_index "gps_points", %w[latitude longitude], :name => "points_idx"
|
||||
remove_index "gps_points", :name => "points_tile_idx"
|
||||
remove_column "gps_points", "tile"
|
||||
end
|
||||
|
|
|
@ -96,7 +96,7 @@ class TileNodes < ActiveRecord::Migration
|
|||
t.column "timestamp", :datetime, :null => false
|
||||
end
|
||||
|
||||
add_index "current_nodes", %w(latitude longitude), :name => "current_nodes_lat_lon_idx"
|
||||
add_index "current_nodes", %w[latitude longitude], :name => "current_nodes_lat_lon_idx"
|
||||
add_index "current_nodes", ["timestamp"], :name => "current_nodes_timestamp_idx"
|
||||
|
||||
downgrade_table "current_nodes_v6", "current_nodes"
|
||||
|
@ -116,7 +116,7 @@ class TileNodes < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
add_index "nodes", ["id"], :name => "nodes_uid_idx"
|
||||
add_index "nodes", %w(latitude longitude), :name => "nodes_latlon_idx"
|
||||
add_index "nodes", %w[latitude longitude], :name => "nodes_latlon_idx"
|
||||
add_index "nodes", ["timestamp"], :name => "nodes_timestamp_idx"
|
||||
|
||||
downgrade_table "nodes_v6", "nodes"
|
||||
|
|
|
@ -3,7 +3,7 @@ require "migrate"
|
|||
class AddRelations < ActiveRecord::Migration
|
||||
def self.up
|
||||
# enums work like strings but are more efficient
|
||||
create_enumeration :nwr_enum, %w(Node Way Relation)
|
||||
create_enumeration :nwr_enum, %w[Node Way Relation]
|
||||
|
||||
# a relation can have members much like a way can have nodes.
|
||||
# differences:
|
||||
|
@ -16,8 +16,8 @@ class AddRelations < ActiveRecord::Migration
|
|||
t.column "member_role", :string
|
||||
end
|
||||
|
||||
add_primary_key "current_relation_members", %w(id member_type member_id member_role)
|
||||
add_index "current_relation_members", %w(member_type member_id), :name => "current_relation_members_member_idx"
|
||||
add_primary_key "current_relation_members", %w[id member_type member_id member_role]
|
||||
add_index "current_relation_members", %w[member_type member_id], :name => "current_relation_members_member_idx"
|
||||
# the following is obsolete given the primary key, is it not?
|
||||
# add_index "current_relation_members", ["id"], :name => "current_relation_members_id_idx"
|
||||
create_table "current_relation_tags", :id => false do |t|
|
||||
|
@ -44,8 +44,8 @@ class AddRelations < ActiveRecord::Migration
|
|||
t.column "version", :bigint, :default => 0, :null => false
|
||||
end
|
||||
|
||||
add_primary_key "relation_members", %w(id version member_type member_id member_role)
|
||||
add_index "relation_members", %w(member_type member_id), :name => "relation_members_member_idx"
|
||||
add_primary_key "relation_members", %w[id version member_type member_id member_role]
|
||||
add_index "relation_members", %w[member_type member_id], :name => "relation_members_member_idx"
|
||||
|
||||
create_table "relation_tags", :id => false do |t|
|
||||
t.column "id", :bigint, :default => 0, :null => false
|
||||
|
@ -54,7 +54,7 @@ class AddRelations < ActiveRecord::Migration
|
|||
t.column "version", :bigint, :null => false
|
||||
end
|
||||
|
||||
add_index "relation_tags", %w(id version), :name => "relation_tags_id_version_idx"
|
||||
add_index "relation_tags", %w[id version], :name => "relation_tags_id_version_idx"
|
||||
|
||||
create_table "relations", :id => false do |t|
|
||||
t.column "id", :bigint, :null => false, :default => 0
|
||||
|
@ -64,7 +64,7 @@ class AddRelations < ActiveRecord::Migration
|
|||
t.column "visible", :boolean, :null => false, :default => true
|
||||
end
|
||||
|
||||
add_primary_key "relations", %w(id version)
|
||||
add_primary_key "relations", %w[id version]
|
||||
add_index "relations", ["timestamp"], :name => "relations_timestamp_idx"
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class RemoveSegments < ActiveRecord::Migration
|
|||
args = conn_opts.map(&:to_s) + [prefix]
|
||||
raise "#{cmd} failed" unless system cmd, *args
|
||||
|
||||
tempfiles = %w(ways way_nodes way_tags relations relation_members relation_tags)
|
||||
tempfiles = %w[ways way_nodes way_tags relations relation_members relation_tags]
|
||||
.map { |base| prefix + base }
|
||||
ways, way_nodes, way_tags,
|
||||
relations, relation_members, relation_tags = tempfiles
|
||||
|
|
|
@ -11,7 +11,7 @@ class DiaryComments < ActiveRecord::Migration
|
|||
t.column "updated_at", :datetime, :null => false
|
||||
end
|
||||
|
||||
add_index "diary_comments", %w(diary_entry_id id), :name => "diary_comments_entry_id_idx", :unique => true
|
||||
add_index "diary_comments", %w[diary_entry_id id], :name => "diary_comments_entry_id_idx", :unique => true
|
||||
end
|
||||
|
||||
def self.down
|
||||
|
|
|
@ -18,7 +18,7 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration
|
|||
args = conn_opts.map(&:to_s) + [prefix]
|
||||
raise "#{cmd} failed" unless system cmd, *args
|
||||
|
||||
tempfiles = %w(nodes node_tags current_nodes current_node_tags)
|
||||
tempfiles = %w[nodes node_tags current_nodes current_node_tags]
|
||||
.map { |base| prefix + base }
|
||||
nodes, node_tags, current_nodes, current_node_tags = tempfiles
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require "migrate"
|
||||
|
||||
class MoveToInnodb < ActiveRecord::Migration
|
||||
@conv_tables = %w(nodes ways way_tags way_nodes current_way_tags relation_members relations relation_tags current_relation_tags)
|
||||
@conv_tables = %w[nodes ways way_tags way_nodes current_way_tags relation_members relations relation_tags current_relation_tags]
|
||||
|
||||
@ver_tbl = %w(nodes ways relations)
|
||||
@ver_tbl = %w[nodes ways relations]
|
||||
|
||||
def self.up
|
||||
remove_index :current_way_tags, :name => :current_way_tags_v_idx
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "migrate"
|
||||
|
||||
class AddChangesets < ActiveRecord::Migration
|
||||
@conv_user_tables = %w(current_nodes current_relations current_ways nodes relations ways)
|
||||
@conv_user_tables = %w[current_nodes current_relations current_ways nodes relations ways]
|
||||
|
||||
def self.up
|
||||
create_table "changesets", :id => false do |t|
|
||||
|
|
|
@ -4,7 +4,7 @@ class AddMoreChangesetIndexes < ActiveRecord::Migration
|
|||
def self.up
|
||||
add_index "changesets", ["created_at"], :name => "changesets_created_at_idx"
|
||||
add_index "changesets", ["closed_at"], :name => "changesets_closed_at_idx"
|
||||
add_index "changesets", %w(min_lat max_lat min_lon max_lon), :name => "changesets_bbox_idx", :using => "GIST"
|
||||
add_index "changesets", %w[min_lat max_lat min_lon max_lon], :name => "changesets_bbox_idx", :using => "GIST"
|
||||
end
|
||||
|
||||
def self.down
|
||||
|
|
|
@ -2,7 +2,7 @@ require "migrate"
|
|||
|
||||
class AddMoreControlsToGpxFiles < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_enumeration :gpx_visibility_enum, %w(private public trackable identifiable)
|
||||
create_enumeration :gpx_visibility_enum, %w[private public trackable identifiable]
|
||||
add_column :gpx_files, :visibility, :gpx_visibility_enum, :default => "public", :null => false
|
||||
Trace.where(:public => false).update_all(:visibility => "private")
|
||||
add_index :gpx_files, [:visible, :visibility], :name => "gpx_files_visible_visibility_idx"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
class AddFineOAuthPermissions < ActiveRecord::Migration
|
||||
PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary,
|
||||
:allow_write_api, :allow_read_gpx, :allow_write_gpx].freeze
|
||||
PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary, :allow_write_api, :allow_read_gpx, :allow_write_gpx].freeze
|
||||
|
||||
def self.up
|
||||
PERMISSIONS.each do |perm|
|
||||
|
|
|
@ -2,7 +2,7 @@ require "migrate"
|
|||
|
||||
class CreateUserRoles < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_enumeration :user_role_enum, %w(administrator moderator)
|
||||
create_enumeration :user_role_enum, %w[administrator moderator]
|
||||
|
||||
create_table :user_roles do |t|
|
||||
t.column :user_id, :bigint, :null => false
|
||||
|
|
|
@ -2,7 +2,7 @@ require "migrate"
|
|||
|
||||
class AddStatusToUser < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_enumeration :user_status_enum, %w(pending active confirmed suspended deleted)
|
||||
create_enumeration :user_status_enum, %w[pending active confirmed suspended deleted]
|
||||
|
||||
add_column :users, :status, :user_status_enum, :null => false, :default => "pending"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require "migrate"
|
|||
|
||||
class AddMapBugTables < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_enumeration :map_bug_status_enum, %w(open closed hidden)
|
||||
create_enumeration :map_bug_status_enum, %w[open closed hidden]
|
||||
|
||||
create_table :map_bugs do |t|
|
||||
t.integer :latitude, :null => false
|
||||
|
|
|
@ -2,7 +2,7 @@ require "migrate"
|
|||
|
||||
class AddMapBugCommentEvent < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_enumeration :map_bug_event_enum, %w(opened closed reopened commented hidden)
|
||||
create_enumeration :map_bug_event_enum, %w[opened closed reopened commented hidden]
|
||||
|
||||
add_column :map_bug_comment, :event, :map_bug_event_enum
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require "migrate"
|
|||
|
||||
class AddTextFormat < ActiveRecord::Migration
|
||||
def up
|
||||
create_enumeration :format_enum, %w(html markdown text)
|
||||
create_enumeration :format_enum, %w[html markdown text]
|
||||
add_column :users, :description_format, :format_enum, :null => false, :default => "html"
|
||||
add_column :user_blocks, :reason_format, :format_enum, :null => false, :default => "html"
|
||||
add_column :diary_entries, :body_format, :format_enum, :null => false, :default => "html"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Editors
|
||||
ALL_EDITORS = %w(potlatch potlatch2 id remote).freeze
|
||||
RECOMMENDED_EDITORS = %w(id potlatch2 remote).freeze
|
||||
ALL_EDITORS = %w[potlatch potlatch2 id remote].freeze
|
||||
RECOMMENDED_EDITORS = %w[id potlatch2 remote].freeze
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ puts "<h2>OpenStreetMap stats report run at #{start_time}</h2>"
|
|||
|
||||
begin
|
||||
ActiveRecord::Base.transaction do
|
||||
user_count = User.where(:status => %w(active confirmed suspended)).count
|
||||
user_count = User.where(:status => %w[active confirmed suspended]).count
|
||||
tracepoint_count = Tracepoint.count
|
||||
node_count = Node.where(:visible => true).count
|
||||
way_count = Way.where(:visible => true).count
|
||||
|
|
|
@ -5,7 +5,7 @@ require "generator"
|
|||
|
||||
addresses = User.count(
|
||||
:conditions => {
|
||||
:status => %w(suspended deleted),
|
||||
:status => %w[suspended deleted],
|
||||
:creation_time => Time.now - 28.days..Time.now
|
||||
},
|
||||
:group => :creation_ip
|
||||
|
|
|
@ -17,8 +17,8 @@ class AmfControllerTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_getpresets
|
||||
user_en_de = create(:user, :languages => %w(en de))
|
||||
user_de = create(:user, :languages => %w(de))
|
||||
user_en_de = create(:user, :languages => %w[en de])
|
||||
user_de = create(:user, :languages => %w[de])
|
||||
[user_en_de, user_de].each do |user|
|
||||
amf_content "getpresets", "/1", ["#{user.email}:test", ""]
|
||||
post :amf_read
|
||||
|
|
|
@ -4,14 +4,14 @@ require "api_controller"
|
|||
class ApiControllerTest < ActionController::TestCase
|
||||
def setup
|
||||
super
|
||||
@badbigbbox = %w(-0.1,-0.1,1.1,1.1 10,10,11,11)
|
||||
@badmalformedbbox = %w(-0.1 hello
|
||||
10N2W10.1N2.1W)
|
||||
@badlatmixedbbox = %w(0,0.1,0.1,0 -0.1,80,0.1,70 0.24,54.34,0.25,54.33)
|
||||
@badlonmixedbbox = %w(80,-0.1,70,0.1 54.34,0.24,54.33,0.25)
|
||||
@badbigbbox = %w[-0.1,-0.1,1.1,1.1 10,10,11,11]
|
||||
@badmalformedbbox = %w[-0.1 hello
|
||||
10N2W10.1N2.1W]
|
||||
@badlatmixedbbox = %w[0,0.1,0.1,0 -0.1,80,0.1,70 0.24,54.34,0.25,54.33]
|
||||
@badlonmixedbbox = %w[80,-0.1,70,0.1 54.34,0.24,54.33,0.25]
|
||||
# @badlatlonoutboundsbbox = %w{ 191,-0.1,193,0.1 -190.1,89.9,-190,90 }
|
||||
@goodbbox = %w(-0.1,-0.1,0.1,0.1 51.1,-0.1,51.2,0
|
||||
-0.1,%20-0.1,%200.1,%200.1 -0.1edcd,-0.1d,0.1,0.1 -0.1E,-0.1E,0.1S,0.1N S0.1,W0.1,N0.1,E0.1)
|
||||
@goodbbox = %w[-0.1,-0.1,0.1,0.1 51.1,-0.1,51.2,0
|
||||
-0.1,%20-0.1,%200.1,%200.1 -0.1edcd,-0.1d,0.1,0.1 -0.1E,-0.1E,0.1S,0.1N S0.1,W0.1,N0.1,E0.1]
|
||||
# That last item in the goodbbox really shouldn't be there, as the API should
|
||||
# reall reject it, however this is to test to see if the api changes.
|
||||
end
|
||||
|
@ -217,7 +217,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_map_without_bbox
|
||||
%w(trackpoints map).each do |tq|
|
||||
%w[trackpoints map].each do |tq|
|
||||
get tq
|
||||
assert_response :bad_request
|
||||
assert_equal "The parameter bbox is required, and must be of the form min_lon,min_lat,max_lon,max_lat", @response.body, "A bbox param was expected"
|
||||
|
@ -238,7 +238,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
|
||||
def test_bbox_too_big
|
||||
@badbigbbox.each do |bbox|
|
||||
%w(trackpoints map).each do |tq|
|
||||
%w[trackpoints map].each do |tq|
|
||||
get tq, :bbox => bbox
|
||||
assert_response :bad_request, "The bbox:#{bbox} was expected to be too big"
|
||||
assert_equal "The maximum bbox size is #{MAX_REQUEST_AREA}, and your request was too large. Either request a smaller area, or use planet.osm", @response.body, "bbox: #{bbox}"
|
||||
|
@ -248,7 +248,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
|
||||
def test_bbox_malformed
|
||||
@badmalformedbbox.each do |bbox|
|
||||
%w(trackpoints map).each do |tq|
|
||||
%w[trackpoints map].each do |tq|
|
||||
get tq, :bbox => bbox
|
||||
assert_response :bad_request, "The bbox:#{bbox} was expected to be malformed"
|
||||
assert_equal "The parameter bbox is required, and must be of the form min_lon,min_lat,max_lon,max_lat", @response.body, "bbox: #{bbox}"
|
||||
|
@ -258,7 +258,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
|
||||
def test_bbox_lon_mixedup
|
||||
@badlonmixedbbox.each do |bbox|
|
||||
%w(trackpoints map).each do |tq|
|
||||
%w[trackpoints map].each do |tq|
|
||||
get tq, :bbox => bbox
|
||||
assert_response :bad_request, "The bbox:#{bbox} was expected to have the longitude mixed up"
|
||||
assert_equal "The minimum longitude must be less than the maximum longitude, but it wasn't", @response.body, "bbox: #{bbox}"
|
||||
|
@ -268,7 +268,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
|
||||
def test_bbox_lat_mixedup
|
||||
@badlatmixedbbox.each do |bbox|
|
||||
%w(trackpoints map).each do |tq|
|
||||
%w[trackpoints map].each do |tq|
|
||||
get tq, :bbox => bbox
|
||||
assert_response :bad_request, "The bbox:#{bbox} was expected to have the latitude mixed up"
|
||||
assert_equal "The minimum latitude must be less than the maximum latitude, but it wasn't", @response.body, "bbox: #{bbox}"
|
||||
|
@ -333,7 +333,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_changes_zoom_invalid
|
||||
zoom_to_test = %w(p -1 0 17 one two)
|
||||
zoom_to_test = %w[p -1 0 17 one two]
|
||||
zoom_to_test.each do |zoom|
|
||||
get :changes, :zoom => zoom
|
||||
assert_response :bad_request
|
||||
|
@ -354,7 +354,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_changes_hours_invalid
|
||||
invalid = %w(-21 335 -1 0 25 26 100 one two three ping pong :)
|
||||
invalid = %w[-21 335 -1 0 25 26 100 one two three ping pong :]
|
||||
invalid.each do |hour|
|
||||
get :changes, :hours => hour
|
||||
assert_response :bad_request, "Problem with the hour: #{hour}"
|
||||
|
|
|
@ -327,8 +327,8 @@ class ChangesetControllerTest < ActionController::TestCase
|
|||
|
||||
# simple diff to change a node, way and relation by removing
|
||||
# their tags
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
|
||||
<way id='#{way.id}' changeset='#{changeset_id}' version='1'>
|
||||
|
@ -342,7 +342,7 @@ class ChangesetControllerTest < ActionController::TestCase
|
|||
<member type='relation' role='some' ref='#{other_relation.id}'/>
|
||||
</relation>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -357,8 +357,8 @@ EOF
|
|||
|
||||
# simple diff to change a node, way and relation by removing
|
||||
# their tags
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
|
||||
<way id='#{way.id}' changeset='#{changeset_id}' version='1'>
|
||||
|
@ -372,7 +372,7 @@ EOF
|
|||
<member type='relation' role='some' ref='#{other_relation.id}'/>
|
||||
</relation>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -387,8 +387,8 @@ EOF
|
|||
|
||||
# simple diff to change a node, way and relation by removing
|
||||
# their tags
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
|
||||
<way id='#{way.id}' changeset='#{changeset_id}' version='1'>
|
||||
|
@ -402,7 +402,7 @@ EOF
|
|||
<member type='relation' role='some' ref='#{other_relation.id}'/>
|
||||
</relation>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -429,8 +429,8 @@ EOF
|
|||
basic_authorization user.email, "test"
|
||||
|
||||
# simple diff to create a node way and relation using placeholders
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
|
||||
<tag k='foo' v='bar'/>
|
||||
|
@ -447,7 +447,7 @@ EOF
|
|||
<member type='relation' role='some' ref='#{relation.id}'/>
|
||||
</relation>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -509,7 +509,7 @@ EOF
|
|||
delete << used_node.to_xml_node
|
||||
|
||||
# update the changeset to one that this user owns
|
||||
%w(node way relation).each do |type|
|
||||
%w[node way relation].each do |type|
|
||||
delete.find("//osmChange/delete/#{type}").each do |n|
|
||||
n["changeset"] = changeset.id.to_s
|
||||
end
|
||||
|
@ -582,8 +582,8 @@ EOF
|
|||
|
||||
# upload some widely-spaced nodes, spiralling positive and negative to cause
|
||||
# largest bbox over-expansion possible.
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id='-1' lon='-20' lat='-10' changeset='#{changeset_id}'/>
|
||||
<node id='-10' lon='20' lat='10' changeset='#{changeset_id}'/>
|
||||
|
@ -604,7 +604,7 @@ EOF
|
|||
<node id='-9' lon='-179.9' lat='-89.9' changeset='#{changeset_id}'/>
|
||||
<node id='-18' lon='179.9' lat='89.9' changeset='#{changeset_id}'/>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it, which used to cause an error like "PGError: ERROR:
|
||||
|
@ -645,7 +645,7 @@ EOF
|
|||
delete << used_node.to_xml_node
|
||||
|
||||
# update the changeset to one that this user owns
|
||||
%w(node way relation).each do |type|
|
||||
%w[node way relation].each do |type|
|
||||
delete.find("//osmChange/delete/#{type}").each do |n|
|
||||
n["changeset"] = changeset.id.to_s
|
||||
end
|
||||
|
@ -689,7 +689,7 @@ EOF
|
|||
delete << used_node.to_xml_node
|
||||
|
||||
# update the changeset to one that this user owns
|
||||
%w(node way relation).each do |type|
|
||||
%w[node way relation].each do |type|
|
||||
delete.find("//osmChange/delete/#{type}").each do |n|
|
||||
n["changeset"] = changeset.id.to_s
|
||||
end
|
||||
|
@ -739,14 +739,14 @@ EOF
|
|||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
# simple diff to create a node way and relation using placeholders
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
|
||||
<tag k='foo' v='#{'x' * 256}'/>
|
||||
</node>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -770,8 +770,8 @@ EOF
|
|||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
# simple diff to create a node way and relation using placeholders
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
|
||||
<tag k='foo' v='bar'/>
|
||||
|
@ -789,7 +789,7 @@ EOF
|
|||
<member type='relation' role='some' ref='#{relation.id}'/>
|
||||
</relation>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -832,8 +832,8 @@ EOF
|
|||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
# simple diff to create a node way and relation using placeholders
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
|
||||
<way id='#{way.id}' changeset='#{changeset.id}' version='1'>
|
||||
|
@ -853,7 +853,7 @@ EOF
|
|||
<tag k='baz' v='bat'/>
|
||||
</node>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -878,8 +878,8 @@ EOF
|
|||
# change the location of a node multiple times, each time referencing
|
||||
# the last version. doesn't this depend on version numbers being
|
||||
# sequential?
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
|
||||
<node id='#{node.id}' lon='1' lat='0' changeset='#{changeset.id}' version='2'/>
|
||||
|
@ -890,7 +890,7 @@ EOF
|
|||
<node id='#{node.id}' lon='3' lat='3' changeset='#{changeset.id}' version='7'/>
|
||||
<node id='#{node.id}' lon='9' lat='9' changeset='#{changeset.id}' version='8'/>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -914,13 +914,13 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
|
||||
<node id='#{node.id}' lon='1' lat='1' changeset='#{changeset.id}' version='1'/>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -937,12 +937,12 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='1' lon='1' lat='1' changeset='#{changeset.id}'/>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -959,12 +959,12 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<ping>
|
||||
<node id='1' lon='1' lat='1' changeset='#{changeset.id}' />
|
||||
</ping>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
content diff
|
||||
post :upload, :id => changeset.id
|
||||
|
@ -985,8 +985,8 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify><node id='#{node.id}' lon='0' lat='0' changeset='#{changeset.id}'
|
||||
version='1'></node>
|
||||
<node id='#{node.id}' lon='1' lat='1' changeset='#{changeset.id}' version='2'><tag k='k' v='v'/></node></modify>
|
||||
|
@ -1021,8 +1021,8 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}'>
|
||||
<tag k="foo" v="bar"/>
|
||||
|
@ -1034,7 +1034,7 @@ EOF
|
|||
<delete>
|
||||
<node id='-1' lon='2' lat='2' changeset='#{changeset.id}' version='2'/>
|
||||
</delete>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -1056,14 +1056,14 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id='-1' lon='0' lat='0' changeset='#{changeset.id}' version='1'/>
|
||||
<node id='-1' lon='1' lat='1' changeset='#{changeset.id}' version='1'/>
|
||||
<node id='-1' lon='2' lat='2' changeset='#{changeset.id}' version='2'/>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -1082,8 +1082,8 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
|
||||
<node id="-2" lon="1" lat="1" changeset="#{changeset.id}" version="1"/>
|
||||
|
@ -1095,7 +1095,7 @@ EOF
|
|||
<nd ref="-4"/>
|
||||
</way>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -1106,8 +1106,8 @@ EOF
|
|||
assert_equal "Placeholder node not found for reference -4 in way -1", @response.body
|
||||
|
||||
# the same again, but this time use an existing way
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
|
||||
<node id="-2" lon="1" lat="1" changeset="#{changeset.id}" version="1"/>
|
||||
|
@ -1119,7 +1119,7 @@ EOF
|
|||
<nd ref="-4"/>
|
||||
</way>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -1139,8 +1139,8 @@ EOF
|
|||
|
||||
basic_authorization changeset.user.email, "test"
|
||||
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
|
||||
<node id="-2" lon="1" lat="1" changeset="#{changeset.id}" version="1"/>
|
||||
|
@ -1152,7 +1152,7 @@ EOF
|
|||
<member type="node" role="foo" ref="-4"/>
|
||||
</relation>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -1163,8 +1163,8 @@ EOF
|
|||
assert_equal "Placeholder Node not found for reference -4 in relation -1.", @response.body
|
||||
|
||||
# the same again, but this time use an existing relation
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<create>
|
||||
<node id="-1" lon="0" lat="0" changeset="#{changeset.id}" version="1"/>
|
||||
<node id="-2" lon="1" lat="1" changeset="#{changeset.id}" version="1"/>
|
||||
|
@ -1176,7 +1176,7 @@ EOF
|
|||
<member type="way" role="bar" ref="-1"/>
|
||||
</relation>
|
||||
</create>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -1342,8 +1342,8 @@ EOF
|
|||
changeset_id = @response.body.to_i
|
||||
|
||||
# add a diff to it
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<modify>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
|
||||
<node id='#{node.id}' lon='1' lat='0' changeset='#{changeset_id}' version='2'/>
|
||||
|
@ -1354,7 +1354,7 @@ EOF
|
|||
<node id='#{node.id}' lon='3' lat='3' changeset='#{changeset_id}' version='7'/>
|
||||
<node id='#{node.id}' lon='9' lat='9' changeset='#{changeset_id}' version='8'/>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
@ -1387,9 +1387,9 @@ EOF
|
|||
assert_response :success
|
||||
changeset_id = @response.body.to_i
|
||||
|
||||
diff = <<OSMFILE
|
||||
<osmChange version="0.6" generator="JOSM">
|
||||
<create version="0.6" generator="JOSM">
|
||||
diff = <<OSMFILE.strip_heredoc
|
||||
<osmChange version="0.6" generator="JOSM">
|
||||
<create version="0.6" generator="JOSM">
|
||||
<node id='-1' visible='true' changeset='#{changeset_id}' lat='51.49619982187321' lon='-0.18722061869438314' />
|
||||
<node id='-2' visible='true' changeset='#{changeset_id}' lat='51.496359883909605' lon='-0.18653093576241928' />
|
||||
<node id='-3' visible='true' changeset='#{changeset_id}' lat='51.49598132358285' lon='-0.18719613290981638' />
|
||||
|
@ -1412,8 +1412,8 @@ EOF
|
|||
<tag k='highway' v='residential' />
|
||||
<tag k='name' v='Foobar Street' />
|
||||
</way>
|
||||
</create>
|
||||
</osmChange>
|
||||
</create>
|
||||
</osmChange>
|
||||
OSMFILE
|
||||
|
||||
# upload it
|
||||
|
@ -1450,8 +1450,8 @@ OSMFILE
|
|||
changeset_id = @response.body.to_i
|
||||
|
||||
# add a diff to it
|
||||
diff = <<EOF
|
||||
<osmChange>
|
||||
diff = <<EOF.strip_heredoc
|
||||
<osmChange>
|
||||
<delete>
|
||||
<node id='#{node.id}' lon='0' lat='0' changeset='#{changeset_id}' version='1'/>
|
||||
</delete>
|
||||
|
@ -1469,7 +1469,7 @@ OSMFILE
|
|||
<nd ref='-3'/>
|
||||
</way>
|
||||
</modify>
|
||||
</osmChange>
|
||||
</osmChange>
|
||||
EOF
|
||||
|
||||
# upload it
|
||||
|
|
|
@ -253,7 +253,7 @@ class GeocoderControllerTest < ActionController::TestCase
|
|||
].each do |code|
|
||||
post :search, :query => code
|
||||
assert_response :success
|
||||
assert_equal %w(us_postcode osm_nominatim), assigns(:sources)
|
||||
assert_equal %w[us_postcode osm_nominatim], assigns(:sources)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -269,20 +269,20 @@ class GeocoderControllerTest < ActionController::TestCase
|
|||
"CR2 6XH",
|
||||
"DN55 1PT"
|
||||
].each do |code|
|
||||
search_check code, %w(uk_postcode osm_nominatim)
|
||||
search_check code, %w[uk_postcode osm_nominatim]
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Test identification of Canadian postcodes
|
||||
def test_identify_ca_postcode
|
||||
search_check "A1B 2C3", %w(ca_postcode osm_nominatim)
|
||||
search_check "A1B 2C3", %w[ca_postcode osm_nominatim]
|
||||
end
|
||||
|
||||
##
|
||||
# Test identification fall through to the default case
|
||||
def test_identify_default
|
||||
search_check "foo bar baz", %w(osm_nominatim geonames)
|
||||
search_check "foo bar baz", %w[osm_nominatim geonames]
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -467,7 +467,7 @@ class GeocoderControllerTest < ActionController::TestCase
|
|||
assert_response :success
|
||||
assert_template :search
|
||||
assert_template :layout => "map"
|
||||
assert_equal %w(latlon osm_nominatim_reverse geonames_reverse), assigns(:sources)
|
||||
assert_equal %w[latlon osm_nominatim_reverse geonames_reverse], assigns(:sources)
|
||||
assert_nil @controller.params[:query]
|
||||
assert_in_delta lat, @controller.params[:lat]
|
||||
assert_in_delta lon, @controller.params[:lon]
|
||||
|
@ -476,7 +476,7 @@ class GeocoderControllerTest < ActionController::TestCase
|
|||
assert_response :success
|
||||
assert_template :search
|
||||
assert_template :layout => "xhr"
|
||||
assert_equal %w(latlon osm_nominatim_reverse geonames_reverse), assigns(:sources)
|
||||
assert_equal %w[latlon osm_nominatim_reverse geonames_reverse], assigns(:sources)
|
||||
assert_nil @controller.params[:query]
|
||||
assert_in_delta lat, @controller.params[:lat]
|
||||
assert_in_delta lon, @controller.params[:lon]
|
||||
|
|
|
@ -741,15 +741,15 @@ class RelationControllerTest < ActionController::TestCase
|
|||
|
||||
basic_authorization(user.email, "test")
|
||||
|
||||
doc_str = <<OSM
|
||||
<osm>
|
||||
doc_str = <<OSM.strip_heredoc
|
||||
<osm>
|
||||
<relation changeset='#{changeset.id}'>
|
||||
<member ref='#{node1.id}' type='node' role='first'/>
|
||||
<member ref='#{node2.id}' type='node' role='second'/>
|
||||
<member ref='#{way1.id}' type='way' role='third'/>
|
||||
<member ref='#{way2.id}' type='way' role='fourth'/>
|
||||
</relation>
|
||||
</osm>
|
||||
</osm>
|
||||
OSM
|
||||
doc = XML::Parser.string(doc_str).parse
|
||||
|
||||
|
@ -801,15 +801,15 @@ OSM
|
|||
node1 = create(:node)
|
||||
node2 = create(:node)
|
||||
|
||||
doc_str = <<OSM
|
||||
<osm>
|
||||
doc_str = <<OSM.strip_heredoc
|
||||
<osm>
|
||||
<relation changeset='#{changeset.id}'>
|
||||
<member ref='#{node1.id}' type='node' role='forward'/>
|
||||
<member ref='#{node2.id}' type='node' role='forward'/>
|
||||
<member ref='#{node1.id}' type='node' role='forward'/>
|
||||
<member ref='#{node2.id}' type='node' role='forward'/>
|
||||
</relation>
|
||||
</osm>
|
||||
</osm>
|
||||
OSM
|
||||
doc = XML::Parser.string(doc_str).parse
|
||||
|
||||
|
@ -844,15 +844,15 @@ OSM
|
|||
node3 = create(:node)
|
||||
node4 = create(:node)
|
||||
|
||||
doc_str = <<OSM
|
||||
<osm>
|
||||
doc_str = <<OSM.strip_heredoc
|
||||
<osm>
|
||||
<relation changeset='#{changeset.id}'>
|
||||
<member ref='#{node1.id}' type='node' role='forward'/>
|
||||
<member ref='#{node4.id}' type='node' role='forward'/>
|
||||
<member ref='#{node3.id}' type='node' role='forward'/>
|
||||
<member ref='#{node2.id}' type='node' role='forward'/>
|
||||
</relation>
|
||||
</osm>
|
||||
</osm>
|
||||
OSM
|
||||
doc = XML::Parser.string(doc_str).parse
|
||||
basic_authorization(user.email, "test")
|
||||
|
|
|
@ -539,7 +539,7 @@ class TraceControllerTest < ActionController::TestCase
|
|||
trace = Trace.order(:id => :desc).first
|
||||
assert_equal "a.gpx", trace.name
|
||||
assert_equal "New Trace", trace.description
|
||||
assert_equal %w(new trace), trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal "trackable", trace.visibility
|
||||
assert_equal false, trace.inserted
|
||||
assert_equal File.new(fixture).read, File.new(trace.trace_name).read
|
||||
|
@ -817,7 +817,7 @@ class TraceControllerTest < ActionController::TestCase
|
|||
trace = Trace.find(response.body.to_i)
|
||||
assert_equal "a.gpx", trace.name
|
||||
assert_equal "New Trace", trace.description
|
||||
assert_equal %w(new trace), trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal "trackable", trace.visibility
|
||||
assert_equal false, trace.inserted
|
||||
assert_equal File.new(fixture).read, File.new(trace.trace_name).read
|
||||
|
@ -835,7 +835,7 @@ class TraceControllerTest < ActionController::TestCase
|
|||
trace = Trace.find(response.body.to_i)
|
||||
assert_equal "a.gpx", trace.name
|
||||
assert_equal "New Trace", trace.description
|
||||
assert_equal %w(new trace), trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal "public", trace.visibility
|
||||
assert_equal false, trace.inserted
|
||||
assert_equal File.new(fixture).read, File.new(trace.trace_name).read
|
||||
|
@ -854,7 +854,7 @@ class TraceControllerTest < ActionController::TestCase
|
|||
trace = Trace.find(response.body.to_i)
|
||||
assert_equal "a.gpx", trace.name
|
||||
assert_equal "New Trace", trace.description
|
||||
assert_equal %w(new trace), trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag)
|
||||
assert_equal "private", trace.visibility
|
||||
assert_equal false, trace.inserted
|
||||
assert_equal File.new(fixture).read, File.new(trace.trace_name).read
|
||||
|
|
|
@ -10,7 +10,7 @@ class ApplicationHelperTest < ActionView::TestCase
|
|||
end
|
||||
|
||||
def test_linkify
|
||||
%w(http://example.com/test ftp://example.com/test https://example.com/test).each do |link|
|
||||
%w[http://example.com/test ftp://example.com/test https://example.com/test].each do |link|
|
||||
text = "Test #{link} is made into a link"
|
||||
|
||||
html = linkify(text)
|
||||
|
@ -22,7 +22,7 @@ class ApplicationHelperTest < ActionView::TestCase
|
|||
assert_dom_equal "Test <a href=\"#{link}\" rel=\"nofollow\">#{link}</a> is made into a link", html
|
||||
end
|
||||
|
||||
%w(test@example.com mailto:test@example.com).each do |link|
|
||||
%w[test@example.com mailto:test@example.com].each do |link|
|
||||
text = "Test #{link} is not made into a link"
|
||||
|
||||
html = linkify(text)
|
||||
|
|
|
@ -145,24 +145,24 @@ class BrowseHelperTest < ActionView::TestCase
|
|||
|
||||
tags = icon_tags(node)
|
||||
assert_equal 3, tags.count
|
||||
assert tags.include?(%w(building yes))
|
||||
assert tags.include?(%w(tourism museum))
|
||||
assert tags.include?(%w(shop gift))
|
||||
assert tags.include?(%w[building yes])
|
||||
assert tags.include?(%w[tourism museum])
|
||||
assert tags.include?(%w[shop gift])
|
||||
|
||||
add_old_tags_selection(node_v2)
|
||||
add_old_tags_selection(node_v1)
|
||||
|
||||
tags = icon_tags(node_v2)
|
||||
assert_equal 3, tags.count
|
||||
assert tags.include?(%w(building yes))
|
||||
assert tags.include?(%w(tourism museum))
|
||||
assert tags.include?(%w(shop gift))
|
||||
assert tags.include?(%w[building yes])
|
||||
assert tags.include?(%w[tourism museum])
|
||||
assert tags.include?(%w[shop gift])
|
||||
|
||||
tags = icon_tags(node_v1)
|
||||
assert_equal 3, tags.count
|
||||
assert tags.include?(%w(building yes))
|
||||
assert tags.include?(%w(tourism museum))
|
||||
assert tags.include?(%w(shop gift))
|
||||
assert tags.include?(%w[building yes])
|
||||
assert tags.include?(%w[tourism museum])
|
||||
assert tags.include?(%w[shop gift])
|
||||
end
|
||||
|
||||
def test_wiki_link
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# coding: utf-8
|
||||
|
||||
require "test_helper"
|
||||
|
||||
class TitleHelperTest < ActionView::TestCase
|
||||
|
|
|
@ -20,7 +20,7 @@ class PageLocaleTest < ActionDispatch::IntegrationTest
|
|||
assert_select "html[lang=?]", "en"
|
||||
|
||||
get "/diary/new", {}, { "HTTP_ACCEPT_LANGUAGE" => "fr, en" }
|
||||
assert_equal %w(fr en), User.find(user.id).languages
|
||||
assert_equal %w[fr en], User.find(user.id).languages
|
||||
assert_select "html[lang=?]", "fr"
|
||||
end
|
||||
|
||||
|
|
|
@ -19,20 +19,20 @@ class BoundingBoxTest < ActiveSupport::TestCase
|
|||
@max_lon = 3.0
|
||||
@max_lat = 4.0
|
||||
|
||||
@bad_positive_boundary_bbox = %w(181,91,0,0 0,0,181,91)
|
||||
@bad_negative_boundary_bbox = %w(-181,-91,0,0 0,0,-181,-91)
|
||||
@bad_big_bbox = %w(-0.1,-0.1,1.1,1.1 10,10,11,11)
|
||||
@bad_malformed_bbox = %w(-0.1 hello 10N2W10.1N2.1W)
|
||||
@bad_lat_mixed_bbox = %w(0,0.1,0.1,0 -0.1,80,0.1,70 0.24,54.34,0.25,54.33)
|
||||
@bad_lon_mixed_bbox = %w(80,-0.1,70,0.1 54.34,0.24,54.33,0.25)
|
||||
@bad_limit_bbox = %w(-180.1,-90,180,90 -180,-90.1,180,90 -180,-90,180.1,90 -180,-90,180,90.1)
|
||||
@good_bbox = %w(-0.1,-0.1,0.1,0.1 51.1,-0.1,51.2,0 -0.1,%20-0.1,%200.1,%200.1
|
||||
-0.1edcd,-0.1d,0.1,0.1 -0.1E,-0.1E,0.1S,0.1N S0.1,W0.1,N0.1,E0.1)
|
||||
@bad_positive_boundary_bbox = %w[181,91,0,0 0,0,181,91]
|
||||
@bad_negative_boundary_bbox = %w[-181,-91,0,0 0,0,-181,-91]
|
||||
@bad_big_bbox = %w[-0.1,-0.1,1.1,1.1 10,10,11,11]
|
||||
@bad_malformed_bbox = %w[-0.1 hello 10N2W10.1N2.1W]
|
||||
@bad_lat_mixed_bbox = %w[0,0.1,0.1,0 -0.1,80,0.1,70 0.24,54.34,0.25,54.33]
|
||||
@bad_lon_mixed_bbox = %w[80,-0.1,70,0.1 54.34,0.24,54.33,0.25]
|
||||
@bad_limit_bbox = %w[-180.1,-90,180,90 -180,-90.1,180,90 -180,-90,180.1,90 -180,-90,180,90.1]
|
||||
@good_bbox = %w[-0.1,-0.1,0.1,0.1 51.1,-0.1,51.2,0 -0.1,%20-0.1,%200.1,%200.1
|
||||
-0.1edcd,-0.1d,0.1,0.1 -0.1E,-0.1E,0.1S,0.1N S0.1,W0.1,N0.1,E0.1]
|
||||
|
||||
@expand_min_lon_array = %w(2,10,10,10 1,10,10,10 0,10,10,10 -1,10,10,10 -2,10,10,10 -8,10,10,10)
|
||||
@expand_min_lat_array = %w(10,2,10,10 10,1,10,10 10,0,10,10 10,-1,10,10 10,-2,10,10 10,-8,10,10)
|
||||
@expand_max_lon_array = %w(-2,-2,-1,-2 -2,-2,0,-2 -2,-2,1,-2 -2,-2,2,-2)
|
||||
@expand_max_lat_array = %w(-2,-2,-2,-1 -2,-2,-2,0 -2,-2,-2,1 -2,-2,-2,2)
|
||||
@expand_min_lon_array = %w[2,10,10,10 1,10,10,10 0,10,10,10 -1,10,10,10 -2,10,10,10 -8,10,10,10]
|
||||
@expand_min_lat_array = %w[10,2,10,10 10,1,10,10 10,0,10,10 10,-1,10,10 10,-2,10,10 10,-8,10,10]
|
||||
@expand_max_lon_array = %w[-2,-2,-1,-2 -2,-2,0,-2 -2,-2,1,-2 -2,-2,2,-2]
|
||||
@expand_max_lat_array = %w[-2,-2,-2,-1 -2,-2,-2,0 -2,-2,-2,1 -2,-2,-2,2]
|
||||
@expand_min_lon_margin_response = [[2, 10, 10, 10], [-7, 10, 10, 10], [-7, 10, 10, 10], [-7, 10, 10, 10], [-7, 10, 10, 10], [-25, 10, 10, 10]]
|
||||
@expand_min_lat_margin_response = [[10, 2, 10, 10], [10, -7, 10, 10], [10, -7, 10, 10], [10, -7, 10, 10], [10, -7, 10, 10], [10, -25, 10, 10]]
|
||||
@expand_max_lon_margin_response = [[-2, -2, -1, -2], [-2, -2, 1, -2], [-2, -2, 1, -2], [-2, -2, 5, -2]]
|
||||
|
|
|
@ -49,7 +49,7 @@ class I18nTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
assert %w(ltr rtl).include?(I18n.t("html.dir", :locale => locale)), "html.dir must be ltr or rtl"
|
||||
assert %w[ltr rtl].include?(I18n.t("html.dir", :locale => locale)), "html.dir must be ltr or rtl"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ class ChangesetCommentTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_body_valid
|
||||
ok = %W(Name vergrößern foo\nbar
|
||||
ルシステムにも対応します 輕觸搖晃的遊戲)
|
||||
ok = %W[Name vergrößern foo\nbar
|
||||
ルシステムにも対応します 輕觸搖晃的遊戲]
|
||||
bad = ["foo\x00bar", "foo\x08bar", "foo\x1fbar", "foo\x7fbar",
|
||||
"foo\ufffebar", "foo\uffffbar"]
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# coding: utf-8
|
||||
|
||||
require "test_helper"
|
||||
|
||||
class LanguageTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -65,10 +65,8 @@ class MessageTest < ActiveSupport::TestCase
|
|||
# its OK to accept invalid UTF-8 as long as we return it unmodified.
|
||||
db_msg = msg.class.find(msg.id)
|
||||
assert_equal char, db_msg.title, "Database silently truncated message title"
|
||||
|
||||
rescue ArgumentError => ex
|
||||
assert_equal ex.to_s, "invalid byte sequence in UTF-8"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,8 +3,8 @@ require "test_helper"
|
|||
|
||||
class NoteCommentTest < ActiveSupport::TestCase
|
||||
def test_event_valid
|
||||
ok = %w(opened closed reopened commented hidden)
|
||||
bad = %w(expropriated fubared)
|
||||
ok = %w[opened closed reopened commented hidden]
|
||||
bad = %w[expropriated fubared]
|
||||
|
||||
ok.each do |event|
|
||||
note_comment = create(:note_comment)
|
||||
|
@ -20,8 +20,8 @@ class NoteCommentTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_body_valid
|
||||
ok = %W(Name vergrößern foo\nbar
|
||||
ルシステムにも対応します 輕觸搖晃的遊戲)
|
||||
ok = %W[Name vergrößern foo\nbar
|
||||
ルシステムにも対応します 輕觸搖晃的遊戲]
|
||||
bad = ["foo\x00bar", "foo\x08bar", "foo\x1fbar", "foo\x7fbar",
|
||||
"foo\ufffebar", "foo\uffffbar"]
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ require "test_helper"
|
|||
|
||||
class NoteTest < ActiveSupport::TestCase
|
||||
def test_status_valid
|
||||
ok = %w(open closed hidden)
|
||||
bad = %w(expropriated fubared)
|
||||
ok = %w[open closed hidden]
|
||||
bad = %w[expropriated fubared]
|
||||
|
||||
ok.each do |status|
|
||||
note = create(:note)
|
||||
|
|
|
@ -11,9 +11,9 @@ class UserTest < ActiveSupport::TestCase
|
|||
assert user.errors[:pass_crypt].any?
|
||||
assert user.errors[:display_name].any?
|
||||
assert user.errors[:email].any?
|
||||
assert !user.errors[:home_lat].any?
|
||||
assert !user.errors[:home_lon].any?
|
||||
assert !user.errors[:home_zoom].any?
|
||||
assert user.errors[:home_lat].none?
|
||||
assert user.errors[:home_lon].none?
|
||||
assert user.errors[:home_zoom].none?
|
||||
end
|
||||
|
||||
def test_unique_email
|
||||
|
@ -45,10 +45,10 @@ class UserTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_email_valid
|
||||
ok = %w(a@s.com test@shaunmcdonald.me.uk hello_local@ping-d.ng
|
||||
test_local@openstreetmap.org test-local@example.com)
|
||||
bad = %w(hi ht@ n@ @.com help@.me.uk help"hi.me.uk も対@応します
|
||||
輕觸搖晃的遊戲@ah.com も対応します@s.name)
|
||||
ok = %w[a@s.com test@shaunmcdonald.me.uk hello_local@ping-d.ng
|
||||
test_local@openstreetmap.org test-local@example.com]
|
||||
bad = %w[hi ht@ n@ @.com help@.me.uk help"hi.me.uk も対@応します
|
||||
輕觸搖晃的遊戲@ah.com も対応します@s.name]
|
||||
|
||||
ok.each do |name|
|
||||
user = build(:user)
|
||||
|
@ -217,13 +217,13 @@ class UserTest < ActiveSupport::TestCase
|
|||
|
||||
user = create(:user, :languages => ["en"])
|
||||
assert_equal ["en"], user.languages
|
||||
user.languages = %w(de fr en)
|
||||
assert_equal %w(de fr en), user.languages
|
||||
user.languages = %w(fr de sl)
|
||||
user.languages = %w[de fr en]
|
||||
assert_equal %w[de fr en], user.languages
|
||||
user.languages = %w[fr de sl]
|
||||
assert_equal "de", user.preferred_language
|
||||
assert_equal %w(fr de sl), user.preferred_languages.map(&:to_s)
|
||||
user = create(:user, :languages => %w(en de))
|
||||
assert_equal %w(en de), user.languages
|
||||
assert_equal %w[fr de sl], user.preferred_languages.map(&:to_s)
|
||||
user = create(:user, :languages => %w[en de])
|
||||
assert_equal %w[en de], user.languages
|
||||
end
|
||||
|
||||
def test_visible?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue