From: Tom Hughes Date: Wed, 21 Dec 2016 11:55:19 +0000 (+0000) Subject: Merge remote-tracking branch 'openstreetmap/pull/1395' X-Git-Tag: live~3759 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/109e69efc186113380eccca35bfdb4bd83365db5?hp=1bea49103f198ab2a8ddbb3e034282939a79174c Merge remote-tracking branch 'openstreetmap/pull/1395' --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f1e93f25b..a7b456aec 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -64,7 +64,7 @@ Metrics/BlockNesting: # Offense count: 62 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 1659 + Max: 1660 # Offense count: 69 Metrics/CyclomaticComplexity: diff --git a/Gemfile b/Gemfile index 829403819..ef93f0d8f 100644 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,7 @@ gem "omniauth-google-oauth2", ">= 0.2.7" gem "omniauth-facebook" gem "omniauth-windowslive" gem "omniauth-github" +gem "omniauth-mediawiki", ">= 0.0.3" # Markdown formatting support gem "redcarpet" diff --git a/Gemfile.lock b/Gemfile.lock index ccf1438ef..5ad974190 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,11 +43,11 @@ GEM public_suffix (~> 2.0, >= 2.0.2) arel (6.0.3) ast (2.3.0) - autoprefixer-rails (6.5.2) + autoprefixer-rails (6.5.3) execjs bigdecimal (1.1.0) builder (3.2.2) - capybara (2.10.1) + capybara (2.10.2) addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -65,15 +65,15 @@ GEM coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.11.1) colorize (0.8.1) composite_primary_keys (8.1.4) activerecord (~> 4.2.0) concurrent-ruby (1.0.2) - coveralls (0.8.15) + coveralls (0.8.16) json (>= 1.8, < 3) simplecov (~> 0.12.0) - term-ansicolor (~> 1.3) + term-ansicolor (~> 1.3.0) thor (~> 0.19.1) tins (>= 1.6.0, < 2) crack (0.4.3) @@ -97,24 +97,24 @@ GEM geoip (1.6.2) globalid (0.3.7) activesupport (>= 4.1.0) - hashdiff (0.3.0) + hashdiff (0.3.1) hashie (3.4.6) htmlentities (4.3.4) http_accept_language (2.0.5) i18n (0.7.0) i18n-js (3.0.0.rc14) i18n (~> 0.6, >= 0.6.6) - image_optim (0.24.0) + image_optim (0.24.1) exifr (~> 1.2, >= 1.2.2) fspath (~> 3.0) - image_size (~> 1.3) + image_size (~> 1.5) in_threads (~> 1.3) progress (~> 3.0, >= 3.0.1) image_optim_rails (0.2.0) image_optim (~> 0.24.0) rails sprockets - image_size (1.4.2) + image_size (1.5.0) in_threads (1.3.1) jquery-rails (4.2.1) rails-dom-testing (>= 1, < 3) @@ -140,10 +140,10 @@ GEM sprockets (>= 2, < 4) sprockets-rails (>= 2, < 4) tilt - libv8 (3.16.14.15) + libv8 (3.16.14.17) libxml-ruby (2.9.0) logstash-event (1.2.02) - logstasher (1.0.1) + logstasher (1.1.0) activerecord (>= 4.0) activesupport (>= 4.0) logstash-event (~> 1.2.0) @@ -157,7 +157,7 @@ GEM mime-types-data (3.2016.0521) mimemagic (0.3.0) mini_portile2 (2.1.0) - minitest (5.9.1) + minitest (5.10.1) multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) @@ -190,6 +190,12 @@ GEM multi_json (~> 1.3) omniauth (>= 1.1.1) omniauth-oauth2 (>= 1.3.1) + omniauth-mediawiki (0.0.3) + jwt (~> 1.0) + omniauth-oauth (~> 1.0) + omniauth-oauth (1.1.0) + oauth + omniauth (~> 1.0) omniauth-oauth2 (1.4.0) oauth2 (~> 1.0) omniauth (~> 1.2) @@ -205,7 +211,7 @@ GEM cocaine (~> 0.5.5) mime-types mimemagic (= 0.3.0) - parser (2.3.1.4) + parser (2.3.3.1) ast (~> 2.2) pg (0.19.0) poltergeist (1.11.0) @@ -214,10 +220,10 @@ GEM websocket-driver (>= 0.2.0) powerpack (0.1.1) progress (3.2.2) - psych (2.1.1) + psych (2.2.1) public_suffix (2.0.4) r2 (0.2.6) - rack (1.6.4) + rack (1.6.5) rack-cors (0.4.0) rack-openid (1.3.1) rack (>= 1.1.0) @@ -258,7 +264,7 @@ GEM ref (2.0.0) request_store (1.3.1) rinku (2.0.2) - rubocop (0.45.0) + rubocop (0.46.0) parser (>= 2.3.1.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) @@ -290,19 +296,19 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - term-ansicolor (1.4.0) + term-ansicolor (1.3.2) tins (~> 1.0) therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref - thor (0.19.1) + thor (0.19.4) thread_safe (0.3.5) tilt (2.0.5) timecop (0.8.1) - tins (1.12.0) + tins (1.13.0) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.3) + uglifier (3.0.4) execjs (>= 0.3.0, < 3) unicode-display_width (1.1.1) validates_email_format_of (1.6.3) @@ -353,6 +359,7 @@ DEPENDENCIES omniauth-facebook omniauth-github omniauth-google-oauth2 (>= 0.2.7) + omniauth-mediawiki (>= 0.0.3) omniauth-openid omniauth-windowslive paperclip (~> 4.0) diff --git a/INSTALL.md b/INSTALL.md index 53a783846..129b071f1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -138,7 +138,7 @@ instructions below as appropriate. ### PostgreSQL account setup -We need to create a PostgreSQL role (i.e. user account) for your current user, and it needs to be a superuser so that we can create more database. +We need to create a PostgreSQL role (i.e. user account) for your current user, and it needs to be a superuser so that we can create more databases. ``` sudo -u postgres -i diff --git a/app/assets/images/tab-icon.svg b/app/assets/images/tab-icon.svg new file mode 100644 index 000000000..5e8bb3119 --- /dev/null +++ b/app/assets/images/tab-icon.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/assets/images/wikipedia.png b/app/assets/images/wikipedia.png new file mode 100644 index 000000000..784c18477 Binary files /dev/null and b/app/assets/images/wikipedia.png differ diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 2a00f1b06..bb0e6f0d4 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1182,6 +1182,7 @@ tr.turn:hover { width: 50%; padding: 6px 10px; word-wrap: break-word; + white-space: pre-wrap; } .browse-tag-k { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0c50276b6..09a35beb3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -343,7 +343,7 @@ class ApplicationController < ActionController::Base ## # wrap an api call in a timeout def api_call_timeout - OSM::Timer.timeout(API_TIMEOUT) do + OSM::Timer.timeout(API_TIMEOUT, Timeout::Error) do yield end rescue Timeout::Error @@ -353,17 +353,13 @@ class ApplicationController < ActionController::Base ## # wrap a web page in a timeout def web_timeout - OSM::Timer.timeout(WEB_TIMEOUT) do + OSM::Timer.timeout(WEB_TIMEOUT, Timeout::Error) do yield end rescue ActionView::Template::Error => ex ex = ex.original_exception if ex.is_a?(ActiveRecord::StatementInvalid) && ex.message =~ /execution expired/ - ex = Timeout::Error.new - end - - if ex.is_a?(Timeout::Error) render :action => "timeout" else raise @@ -452,6 +448,5 @@ class ApplicationController < ActionController::Base end # override to stop oauth plugin sending errors - def invalid_oauth_response - end + def invalid_oauth_response; end end diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index bd020f29b..fa7944516 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -22,6 +22,5 @@ class ExportController < ApplicationController end end - def embed - end + def embed; end end diff --git a/app/controllers/redactions_controller.rb b/app/controllers/redactions_controller.rb index 31dd7273f..129318191 100644 --- a/app/controllers/redactions_controller.rb +++ b/app/controllers/redactions_controller.rb @@ -32,11 +32,9 @@ class RedactionsController < ApplicationController end end - def show - end + def show; end - def edit - end + def edit; end def update # note - don't update the user ID diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 5131629ac..1a4c9f148 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -95,20 +95,15 @@ class SiteController < ApplicationController @locale = params[:copyright_locale] || I18n.locale end - def welcome - end + def welcome; end - def help - end + def help; end - def about - end + def about; end - def export - end + def export; end - def offline - end + def offline; end def preview render :text => RichText.new(params[:format], params[:text]).to_html diff --git a/app/helpers/open_graph_helper.rb b/app/helpers/open_graph_helper.rb index e21a5648a..ab7e230cb 100644 --- a/app/helpers/open_graph_helper.rb +++ b/app/helpers/open_graph_helper.rb @@ -4,9 +4,9 @@ module OpenGraphHelper "og:site_name" => t("layouts.project_name.title"), "og:title" => [t("layouts.project_name.title"), title].compact.join(" | "), "og:type" => "website", - "og:image" => image_path("osm_logo_256.png", :host => SERVER_URL, :protocol => "http"), - "og:image:secure_url" => image_path("osm_logo_256.png", :host => SERVER_URL, :protocol => "https"), - "og:url" => url_for(:host => SERVER_URL), + "og:image" => image_url("osm_logo_256.png", :protocol => "http"), + "og:image:secure_url" => image_url("osm_logo_256.png", :protocol => "https"), + "og:url" => url_for(:only_path => false), "og:description" => t("layouts.intro_text") } diff --git a/app/models/node.rb b/app/models/node.rb index 2a64259c1..f8559dca7 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -232,10 +232,14 @@ class Node < ActiveRecord::Base def save_with_history! t = Time.now.getutc + + self.version += 1 + self.timestamp = t + Node.transaction do - self.version += 1 - self.timestamp = t - save! + # clone the object before saving it so that the original is + # still marked as dirty if we retry the transaction + clone.save! # Create a NodeTag tags = self.tags diff --git a/app/models/notifier.rb b/app/models/notifier.rb index a498e4edf..0539bdeb7 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -107,7 +107,7 @@ class Notifier < ActionMailer::Base :display_name => comment.user.display_name, :title => "Re: #{comment.diary_entry.title}") - mail :from => from_address(comment.user.display_name, "c", comment.id, comment.digest), + mail :from => from_address(comment.user.display_name, "c", comment.id, comment.digest, recipient.id), :to => recipient.email, :subject => I18n.t("notifier.diary_comment_notification.subject", :user => comment.user.display_name) end @@ -180,9 +180,13 @@ class Notifier < ActionMailer::Base end end - def from_address(name, type, id, digest) + def from_address(name, type, id, digest, user_id = nil) if Object.const_defined?(:MESSAGES_DOMAIN) && domain = MESSAGES_DOMAIN - "#{name} <#{type}-#{id}-#{digest[0, 6]}@#{domain}>" + if user_id + "#{name} <#{type}-#{id}-#{user_id}-#{digest[0, 6]}@#{domain}>" + else + "#{name} <#{type}-#{id}-#{digest[0, 6]}@#{domain}>" + end else EMAIL_FROM end diff --git a/app/models/relation.rb b/app/models/relation.rb index e5e4ec894..b78c95ce4 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -281,15 +281,19 @@ class Relation < ActiveRecord::Base private def save_with_history! + t = Time.now.getutc + + self.version += 1 + self.timestamp = t + Relation.transaction do # have to be a little bit clever here - to detect if any tags # changed then we have to monitor their before and after state. tags_changed = false - t = Time.now.getutc - self.version += 1 - self.timestamp = t - save! + # clone the object before saving it so that the original is + # still marked as dirty if we retry the transaction + clone.save! tags = self.tags.clone relation_tags.each do |old_tag| diff --git a/app/models/way.rb b/app/models/way.rb index 98c4902f9..9877b8bb8 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -255,6 +255,9 @@ class Way < ActiveRecord::Base def save_with_history! t = Time.now.getutc + self.version += 1 + self.timestamp = t + # update the bounding box, note that this has to be done both before # and after the save, so that nodes from both versions are included in the # bbox. we use a copy of the changeset so that it isn't reloaded @@ -263,9 +266,9 @@ class Way < ActiveRecord::Base cs.update_bbox!(bbox) unless nodes.empty? Way.transaction do - self.version += 1 - self.timestamp = t - save! + # clone the object before saving it so that the original is + # still marked as dirty if we retry the transaction + clone.save! tags = self.tags WayTag.delete_all(:way_id => id) diff --git a/app/views/changeset/list.atom.builder b/app/views/changeset/list.atom.builder index 979a7492f..68b4a1985 100644 --- a/app/views/changeset/list.atom.builder +++ b/app/views/changeset/list.atom.builder @@ -5,12 +5,12 @@ atom_feed(:language => I18n.locale, :schema_date => 2009, feed.title changeset_list_title(params, @user) feed.updated @edits.map { |e| [e.created_at, e.closed_at].max }.max - feed.icon "http://#{SERVER_URL}/favicon.ico" - feed.logo "http://#{SERVER_URL}/images/mag_map-rss2.0.png" + feed.icon image_url("favicon.ico") + feed.logo image_url("mag_map-rss2.0.png") feed.rights :type => "xhtml" do |xhtml| xhtml.a :href => "http://creativecommons.org/licenses/by-sa/2.0/" do |a| - a.img :src => "http://#{SERVER_URL}/images/cc_button.png", :alt => "CC by-sa 2.0" + a.img :src => image_url("cc_button.png"), :alt => "CC by-sa 2.0" end end diff --git a/app/views/diary_entry/rss.rss.builder b/app/views/diary_entry/rss.rss.builder index d9cc40797..6ff2ed9f3 100644 --- a/app/views/diary_entry/rss.rss.builder +++ b/app/views/diary_entry/rss.rss.builder @@ -1,29 +1,30 @@ xml.instruct! xml.rss("version" => "2.0", + "xmlns:dc" => "http://purl.org/dc/elements/1.1/", "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#", "xmlns:georss" => "http://www.georss.org/georss") do xml.channel do xml.title @title xml.description @description - xml.link url_for(:action => "list", :host => SERVER_URL) + xml.link url_for(:action => "list", :only_path => false) xml.image do - xml.url image_path("mag_map-rss2.0.png") + xml.url image_url("mag_map-rss2.0.png") xml.title @title xml.width "100" xml.height "100" - xml.link url_for(:action => "list", :host => SERVER_URL) + xml.link url_for(:action => "list", :only_path => false) end @entries.each do |entry| xml.item do xml.title entry.title - xml.link url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :host => SERVER_URL) - xml.guid url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :host => SERVER_URL) + xml.link url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :only_path => false) + xml.guid url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :only_path => false) xml.description entry.body.to_html xml.dc :creator, entry.user.display_name xml.pubDate entry.created_at.to_s(:rfc822) - xml.comments url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :anchor => "comments", :host => SERVER_URL) + xml.comments url_for(:action => "view", :id => entry.id, :display_name => entry.user.display_name, :anchor => "comments", :only_path => false) if entry.latitude && entry.longitude xml.geo :lat, entry.latitude.to_s diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 118100df6..8830a8692 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -18,6 +18,7 @@ <%= favicon_link_tag "favicon-96x96.png", :rel => "icon", :sizes => "96x96", :type => "image/png" %> <%= favicon_link_tag "android-chrome-192x192.png", :rel => "icon", :sizes => "192x192", :type => "image/png" %> <%= favicon_link_tag "favicon-16x16.png", :rel => "icon", :sizes => "16x16", :type => "image/png" %> + <%= tag("link", { :rel => "mask-icon", :href => asset_path("tag-icon.svg"), :color => "#7ebc6f" }) %> <%= tag("link", { :rel => "manifest", :href => asset_path("manifest.json") }) %> <%= tag("meta", { :name => "msapplication-config", :content => asset_path("browserconfig.xml") }) %> <%= tag("meta", { :name => "msapplication-TileColor", :content => "#00a300" }) %> diff --git a/app/views/notes/_note.gpx.builder b/app/views/notes/_note.gpx.builder index 9d8ede249..f6bb39d27 100644 --- a/app/views/notes/_note.gpx.builder +++ b/app/views/notes/_note.gpx.builder @@ -6,7 +6,7 @@ xml.wpt("lon" => note.lon, "lat" => note.lat) do xml.cdata! render(:partial => "description", :object => note, :formats => [:html]) end - xml.link("href" => browse_note_url(note, :host => SERVER_URL)) + xml.link("href" => browse_note_url(note, :only_path => false)) xml.extensions do xml.id note.id diff --git a/app/views/notes/_note.json.jsonify b/app/views/notes/_note.json.jsonify index 74ff5ccec..5e3ac518e 100644 --- a/app/views/notes/_note.json.jsonify +++ b/app/views/notes/_note.json.jsonify @@ -26,7 +26,7 @@ json.properties do if comment.author json.uid comment.author.id json.user comment.author.display_name - json.user_url user_url(:display_name => comment.author.display_name, :host => SERVER_URL) + json.user_url user_url(:display_name => comment.author.display_name, :only_path => false) end json.action comment.event diff --git a/app/views/notes/_note.xml.builder b/app/views/notes/_note.xml.builder index fb6738aaa..adb4e6a52 100644 --- a/app/views/notes/_note.xml.builder +++ b/app/views/notes/_note.xml.builder @@ -22,7 +22,7 @@ xml.note("lon" => note.lon, "lat" => note.lat) do if comment.author xml.uid comment.author.id xml.user comment.author.display_name - xml.user_url user_url(:display_name => comment.author.display_name, :host => SERVER_URL) + xml.user_url user_url(:display_name => comment.author.display_name, :only_path => false) end xml.action comment.event diff --git a/app/views/notes/index.rss.builder b/app/views/notes/index.rss.builder index ecbbb7326..e912b9921 100644 --- a/app/views/notes/index.rss.builder +++ b/app/views/notes/index.rss.builder @@ -1,6 +1,7 @@ xml.instruct! xml.rss("version" => "2.0", + "xmlns:dc" => "http://purl.org/dc/elements/1.1/", "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#", "xmlns:georss" => "http://www.georss.org/georss") do xml.channel do diff --git a/app/views/trace/georss.rss.builder b/app/views/trace/georss.rss.builder index 6d3aeebe0..8470e85cb 100644 --- a/app/views/trace/georss.rss.builder +++ b/app/views/trace/georss.rss.builder @@ -10,7 +10,7 @@ xml.rss("version" => "2.0", xml.link url_for(:controller => :trace, :action => :list, :only_path => false) xml.image do - xml.url image_path("mag_map-rss2.0.png", :host => SERVER_URL) + xml.url image_url("mag_map-rss2.0.png") xml.title t("trace.georss.title") xml.width 100 xml.height 100 diff --git a/app/views/user/login.html.erb b/app/views/user/login.html.erb index 3d28a770a..26bb80895 100644 --- a/app/views/user/login.html.erb +++ b/app/views/user/login.html.erb @@ -58,6 +58,9 @@ <% if defined?(GITHUB_AUTH_ID) -%>
  • <%= auth_button "github", "github" %>
  • <% end -%> + <% if defined?(WIKIPEDIA_AUTH_ID) -%> +
  • <%= auth_button "wikipedia", "wikipedia" %>
  • + <% end -%>
  • <%= auth_button "yahoo", "openid", :openid_url => "yahoo.com" %>
  • <%= auth_button "wordpress", "openid", :openid_url => "wordpress.com" %>
  • <%= auth_button "aol", "openid", :openid_url => "aol.com" %>
  • diff --git a/config/example.application.yml b/config/example.application.yml index b5d4db363..fd388ad88 100644 --- a/config/example.application.yml +++ b/config/example.application.yml @@ -107,6 +107,8 @@ defaults: &defaults #windowslive_auth_secret: "" #github_auth_id: "" #github_auth_secret: "" + #wikipedia_auth_id: "" + #wikipedia_auth_secret: "" # MapQuest authentication details #mapquest_key: "" # Mapzen authentication details @@ -134,3 +136,5 @@ test: windowslive_auth_secret: "dummy" github_auth_id: "dummy" github_auth_secret: "dummy" + wikipedia_auth_id: "dummy" + wikipedia_auth_secret: "dummy" diff --git a/config/initializers/abstract_adapter.rb b/config/initializers/abstract_adapter.rb index 89d384567..6bb5d10c0 100644 --- a/config/initializers/abstract_adapter.rb +++ b/config/initializers/abstract_adapter.rb @@ -6,23 +6,15 @@ if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdapter) alias old_log log - def log(sql, name) - if block_given? - old_log(sql, name) do - yield - end + def translate_exception_class_with_timeout(e, sql) + if e.is_a?(Timeout::Error) || e.is_a?(OSM::APITimeoutError) + e else - old_log(sql, name) - end - rescue ActiveRecord::StatementInvalid => ex - if ex.message =~ /^OSM::APITimeoutError: / - raise OSM::APITimeoutError.new - elsif ex.message =~ /^Timeout::Error: / - raise Timeout::Error.new("time's up!") - else - raise + translate_exception_class_without_timeout(e, sql) end end + + alias_method_chain :translate_exception_class, :timeout end end end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index f7d0c5f6a..790413721 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -24,6 +24,7 @@ google_options = { :name => "google", :scope => "email", :access_type => "online facebook_options = { :name => "facebook", :scope => "email" } windowslive_options = { :name => "windowslive", :scope => "wl.signin,wl.emails" } github_options = { :name => "github", :scope => "user:email" } +wikipedia_options = { :name => "wikipedia", :client_options => { :site => "https://commons.wikimedia.org" } } if defined?(GOOGLE_OPENID_REALM) google_options[:openid_realm] = GOOGLE_OPENID_REALM @@ -35,6 +36,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook, FACEBOOK_AUTH_ID, FACEBOOK_AUTH_SECRET, facebook_options if defined?(FACEBOOK_AUTH_ID) provider :windowslive, WINDOWSLIVE_AUTH_ID, WINDOWSLIVE_AUTH_SECRET, windowslive_options if defined?(WINDOWSLIVE_AUTH_ID) provider :github, GITHUB_AUTH_ID, GITHUB_AUTH_SECRET, github_options if defined?(GITHUB_AUTH_ID) + provider :mediawiki, WIKIPEDIA_AUTH_ID, WIKIPEDIA_AUTH_SECRET, wikipedia_options if defined?(WIKIPEDIA_AUTH_ID) end # Pending fix for: https://github.com/intridea/omniauth/pull/795 diff --git a/config/locales/be.yml b/config/locales/be.yml index b341a3b47..f9619c73e 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -1518,6 +1518,8 @@ be: private: Прыватны доступ destination: Мэтавы доступ construction: Дарогі ў стадыі будаўніцтва + bicycle_shop: Крама ровараў + bicycle_parking: Паркоўка для ровараў toilets: Прыбіральні richtext_area: edit: Рэдагаваць @@ -1789,6 +1791,7 @@ be: alt: Увайсці праз рахунак Windows Live github: title: Уваход праз GitHub + alt: Увайсці праз уліковы запіс GitHub yahoo: title: Уваход праз Yahoo alt: Уваход праз Yahoo OpenID @@ -1992,6 +1995,8 @@ be: gravatar: gravatar: Выкарыстоўваць Gravatar link text: што гэта? + disabled: Граватар быў адключаны. + enabled: Паказ вашага Граватара быў уключаны. new image: Дадаць выяву keep image: Захаваць бягучую выяву delete image: Выдаліць бягучую выяву diff --git a/config/locales/ca.yml b/config/locales/ca.yml index a984943df..171fd03c5 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1254,16 +1254,19 @@ ca: de copyright i llicència per a més detalls.' legal_title: Avisos legals legal_html: "Aquest lloc web i molts altres serveis relacionats són operats formalment - per l' \nOpenStreetMap Fundació (OSMF) - \ en nom de la comunitat.\n
    \nSi us plau contacteu + per la \nFundació OpenStreetMap (OSMF) + \ en nom de la comunitat. L'ús de tots els serveis operats per l'OSMF es troba + subjecte a les nostres \npolítiques + d'ús acceptable i a les nostres polítiques + de privadesa\n
    \nContacteu amb l'OSMF \nsi teniu qüestions sobre llicències, drets d'autor o altres aspectes legals." partners_title: Socis notifier: diary_comment_notification: - subject: '[OpenStreetMap] %{user}, va comentar sobre la vostra entrada del diari' + subject: '[OpenStreetMap] %{user} ha comentat en una entrada de diari' hi: Hola %{to_user}, - header: '%{from_user} ha comentat en la vostra recent entrada del diari OpenStreetMap + header: '%{from_user} ha comentat en una entrada de diari de l''OpenStreetMap amb el tema %{subject}:' footer: També podeu llegir el comentari a les %{readurl} i es pot comentar als %{commenturl} o respondre a les %{replyurl} @@ -1883,9 +1886,10 @@ ca: de col·laboracio. email address: 'Adreça de correu:' confirm email address: 'Confirmeu l''adreça de correu electrònic:' - not displayed publicly: No es mostrarà públicament (vegeu la política - de privacitat) + not displayed publicly: La vostra adreça no es mostrarà públicament (vegeu la + nostra política de privadesa + per a més informació) display name: 'Nom visible:' display name description: El nom d'usuari que es motrarà públicament. El podeu canviar més endavant a les preferències. @@ -2333,7 +2337,7 @@ ca: key: title: Llegenda tooltip: Llegenda - tooltip_disabled: La llegenda només està disponible per a la capa estàndard + tooltip_disabled: La llegenda no és disponible per a aquesta capa map: zoom: in: Amplia @@ -2407,11 +2411,23 @@ ca: instructions: continue_without_exit: Continuar a %{name} slight_right_without_exit: Gira lleugerament a la dreta a %{name} + offramp_right_without_exit: Agafeu el carril de la dreta a %{name} + onramp_right_without_exit: Gireu a la dreta al carril a %{name} + endofroad_right_without_exit: Al final de la carretera gireu a la dreta a + %{name} + merge_right_without_exit: Incorporeu-vos a la dreta a %{name} + fork_right_without_exit: A la cruïlla gireu a la dreta a %{name} turn_right_without_exit: Gira a la dreta per %{name} sharp_right_without_exit: Gira a la dreta a %{name} uturn_without_exit: Canvi de sentit a %{name} sharp_left_without_exit: Gira a l'esquerra a %{name} turn_left_without_exit: Gira a l'esquerra per %{name} + offramp_left_without_exit: Agafeu el carril de l'esquerra a %{name} + onramp_left_without_exit: Gireu a l'esquerra al carril a %{name} + endofroad_left_without_exit: Al final de la carretera gireu a l'esquerra a + %{name} + merge_left_without_exit: Incorporeu-vos a l'esquerra a %{name} + fork_left_without_exit: A la cruïlla gireu a l'esquerra a %{name} slight_left_without_exit: Gira lleugerament a l'esquerra a %{name} via_point_without_exit: (pel punt) follow_without_exit: Segueix %{name} @@ -2447,7 +2463,7 @@ ca: description: Descripció heading: Introduïu informació per una nova redacció submit: Crea una redacció - title: Creant una nova redacció + title: Creació d’una versió nova show: description: 'Descripció:' heading: Mostrant la redacció "%{title}" diff --git a/config/locales/de.yml b/config/locales/de.yml index 713a13c9f..e2adbeefa 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1079,10 +1079,12 @@ de: Mehr Informationen dazu, wie unsere Daten verwendet werden können und wie man auf unsere Urheberschaft hinweist, kann man auf unserer OSMF-Lizenzseite und in den Häufigen rechtlichen Fragen (Legal FAQ) nachlesen. - more_2_html: "Obwohl OpenStreetMap „Open Data“ ist, können wir keine \nunentgeltliche - Karten-API für Drittparteienentwickler bereitstellen.\nSiehe unsere API-Verwendungsrichtlinie,\nKachelverwendungsrichtlinie\nund - Nominatim-Verwendungsrichtlinie." + more_2_html: |- + Obwohl OpenStreetMap „Open Data“ ist, können wir keine + unentgeltliche Karten-API für Drittparteien bereitstellen. + Siehe unsere API-Verwendungsrichtlinie, + die Kachelverwendungsrichtlinie + und die Nominatim-Verwendungsrichtlinie. contributors_title_html: Unsere Mitwirkenden contributors_intro_html: 'Unsere Mitwirkenden sind tausende einzelne Menschen. Wir beziehen auch offen lizenzierte Daten von nationalen Kartenagenturen und diff --git a/config/locales/diq.yml b/config/locales/diq.yml index e08613604..64deccef1 100644 --- a/config/locales/diq.yml +++ b/config/locales/diq.yml @@ -1018,8 +1018,8 @@ diq: confirm: Tesdiq ke user_block: new: - title: '%{name} i bloqe vırazeno' - heading: '%{name} i bloqe vırazeno' + title: '%{name}i rê blok vırazeno.' + heading: '%{name}i ro blok vırazeno.' submit: Bloqe vırazê back: Bloqan pêron bıvin edit: diff --git a/config/locales/en.yml b/config/locales/en.yml index 17d161c87..a6bbf655f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1013,7 +1013,7 @@ en: FAQ. more_2_html: | Although OpenStreetMap is open data, we cannot provide a - free-of-charge map API for third-party developers. + free-of-charge map API for third-parties. See our API Usage Policy, Tile Usage Policy and Nominatim Usage Policy. @@ -1746,6 +1746,9 @@ en: github: title: Login with GitHub alt: Login with a GitHub Account + wikipedia: + title: Login with Wikipedia + alt: Login with a Wikipedia Account yahoo: title: Login with Yahoo alt: Login with a Yahoo OpenID diff --git a/config/locales/fi.yml b/config/locales/fi.yml index f10d87f1f..f5f263be4 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1199,6 +1199,7 @@ fi: title: IRC description: Interaktiivinen chat monilla eri kielillä ja monista eri aiheista. switch2osm: + title: switch2osm (Vaihda OSM:iin) description: Auta yrityksiä ja organisaatioita vaihtamaan OpenStreetMapiin pohjautuviin karttoihin ja muihin palveluihin. wiki: @@ -1229,9 +1230,12 @@ fi: tai muuunnellaan, sitä saa levittää eteenpäin vain samalla lisenssillä. Lisätietoja on Tekijänoikeus ja lisenssi -sivulla.' legal_title: Lakitekninen jako - legal_html: |- - Tämä ja monet muut OSM-sivustot ovat muodollisesti OpenStreetMap-säätiön (OSMF) hallinnoimia OSM-yhteisön puolesta. - Ota yhteys OSMF:ään lisensointi-, tekijänoikeus- ja muissa lakiteknisissä kysymyksissä. + legal_html: "Tämä ja monet muut OSM-sivustot ovat muodollisesti OpenStreetMap-säätiön + (OSMF) hallinnoimia OSM-yhteisön puolesta. Kaikkien näiden sivustojen käyttöön + sovelletaan \nhyväksytyn + käytön käytäntöjä ja tietosuojakäytäntöä + (molemmat sisällöt saatavilla vain englanniksi).\n
    \nOta + yhteys OSMF:ään lisensointi-, tekijänoikeus- ja muissa lakiteknisissä kysymyksissä." partners_title: Kumppanit notifier: diary_comment_notification: @@ -2338,11 +2342,21 @@ fi: instructions: continue_without_exit: Jatka tiellä %{name} slight_right_without_exit: Kaarra oikealle tielle %{name} + offramp_right_without_exit: Poistu oikealle liittymään tielle %{name} + onramp_right_without_exit: Käänny oikealle liittymään tielle %{name} + endofroad_right_without_exit: Tienpäässä käänny oikealle tielle %{name} + merge_right_without_exit: Liity oikealle tielle %{name} + fork_right_without_exit: Liittymässä ryhmity oikealle suuntaan %{name} turn_right_without_exit: Käänny oikealle tielle %{name} sharp_right_without_exit: Käänny jyrkästi oikealle tielle %{name} uturn_without_exit: Tee U-käännös tiellä %{name} sharp_left_without_exit: Käänny jyrkästi vasemmalle tielle %{name} turn_left_without_exit: Käänny vasemmalle tielle %{name} + offramp_left_without_exit: Poistu vasemmalle liittymään tielle %{name} + onramp_left_without_exit: Käänny vasemmalle liittymään tielle %{name} + endofroad_left_without_exit: Tienpäässä käänny vasemmalle tielle %{name} + merge_left_without_exit: Liity vasemmalle tielle %{name} + fork_left_without_exit: Liittymässä ryhmity vasemmalle suuntaan %{name} slight_left_without_exit: Kaarra vasemmalle tielle %{name} via_point_without_exit: (reittipiste) follow_without_exit: Seuraa tietä %{name} diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 09203c2ce..54ce5904e 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1243,7 +1243,7 @@ fr: description: Aide pour les entreprises et les organisations de commutation à OpenStreetMap, en fonction des cartes et d’autres services. wiki: - url: http://wiki.openstreetmap.org/ + url: https://wiki.openstreetmap.org/wiki/FR:Page_principale title: wiki.openstreetmap.org description: Parcourez le wiki pour la documentation approfondie d’OSM about_page: diff --git a/config/locales/ia.yml b/config/locales/ia.yml index 902695cb0..6dddc7286 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -1086,9 +1086,9 @@ ia: de remotion o submitte un plancto immediate usante nostre formulario in linea. trademarks_title_html: Marcas commercial - trademarks_1_html: OpenStreetMap e le logotypo con le lupa es marcas registrate - del Fundation OpenStreetMap. Si vos ha questiones sur le uso de iste marcas, - invia los al gruppo + trademarks_1_html: OpenStreetMap, le logotypo con le lupa e "State of the Map" + es marcas registrate del Fundation OpenStreetMap. Si vos ha questiones sur + le uso de iste marcas, invia los al gruppo de labor sur licentias. welcome_page: title: Benvenite! @@ -1218,15 +1218,18 @@ ia: legal_title: Juridic legal_html: "Iste sito e multe altere servicios associate es formalmente gerite per le \nFundation OpenStreetMap - (OSMF) \nin nomine del communitate.\n
    \nContacta + (OSMF) \nin nomine del communitate. Le uso de tote le servicios gerite per OSMF + es subjecte a nostre \npoliticas + de uso acceptabile e a nostre politica + de confidentialitate\n
    \nContacta OSMF \nsi vos ha questiones sur licentias, derectos de autor o altere themas juridic." partners_title: Partners notifier: diary_comment_notification: - subject: '[OpenStreetMap] %{user} commentava un entrata de tu diario' + subject: '[OpenStreetMap] %{user} commentava un entrata de diario' hi: Salute %{to_user}, - header: '%{from_user} ha commentate le entrata recente de tu diario de OpenStreetMap + header: '%{from_user} ha commentate le entrata recente de diario OpenStreetMap con le subjecto %{subject}:' footer: Tu pote tamben leger le commento a %{readurl} e tu pote commentar a %{commenturl} o responder a %{replyurl} @@ -1464,6 +1467,9 @@ ia: track: Pista bridleway: Sentiero pro cavallos cycleway: Via cyclabile + cycleway_national: Pista cyclabile national + cycleway_regional: Pista cyclabile regional + cycleway_local: Pista cyclabile local footway: Sentiero pro pedones rail: Ferrovia subway: Metro @@ -1516,6 +1522,9 @@ ia: private: Accesso private destination: Traffico local construction: Vias in construction + bicycle_shop: Magazin de bicyclettas + bicycle_parking: Parcamento de bicyclettas + toilets: Toilettes richtext_area: edit: Modificar preview: Previsualisation @@ -1789,6 +1798,9 @@ ia: windowslive: title: Aperir session con Windows Live alt: Aperir session con un conto de Windows Live + github: + title: Aperir session con GitHub + alt: Aperir session con un conto de GitHub yahoo: title: Aperir session con Yahoo alt: Aperir session con un OpenID de Yahoo @@ -1837,9 +1849,10 @@ ia: de contributor. email address: 'Adresse de e-mail:' confirm email address: 'Confirmar adresse de e-mail:' - not displayed publicly: Non monstrate publicamente (vide le politica de confidentialitate) + not displayed publicly: Tu adresse non es monstrate publicamente. Vide nostre + politica + de confidentialitate pro plus information. display name: 'Nomine public:' display name description: Tu nomine de usator monstrate publicamente. Tu pote cambiar lo plus tarde in le preferentias. @@ -1995,6 +2008,8 @@ ia: gravatar: gravatar: Usar Gravatar link text: que es isto? + disabled: Gravatar ha essite disactivate. + enabled: Tu Gravatar ha essite activate e essera monstrate desde ora. new image: Adder un imagine keep image: Retener le imagine actual delete image: Remover le imagine actual @@ -2278,7 +2293,7 @@ ia: key: title: Legenda tooltip: Legenda - tooltip_disabled: Le legenda es disponibile solmente pro le strato Standard + tooltip_disabled: Le legenda non es disponibile pro iste strato map: zoom: in: Zoom avante @@ -2351,11 +2366,21 @@ ia: instructions: continue_without_exit: Continuar sur %{name} slight_right_without_exit: Curva suave a dextra verso %{name} + offramp_right_without_exit: Prende le rampa a dextra verso %{name} + onramp_right_without_exit: Girar a dextra sur le rampa verso %{name} + endofroad_right_without_exit: Al fin del strata, girar a dextra verso %{name} + merge_right_without_exit: Junger a dextra verso %{name} + fork_right_without_exit: Al bifurcation, girar a dextra verso %{name} turn_right_without_exit: Girar a dextra verso %{name} sharp_right_without_exit: Curva acute a dextra verso %{name} uturn_without_exit: Retornar preter %{name} sharp_left_without_exit: Curva acute a sinistra verso %{name} turn_left_without_exit: Girar a sinistra verso %{name} + offramp_left_without_exit: Prende le rampa al sinistra verso %{name} + onramp_left_without_exit: Girar a sinistra sur le rampa verso %{name} + endofroad_left_without_exit: Al fin del strata, girar a sinistra verso %{name} + merge_left_without_exit: Junger a sinistra verso %{name} + fork_left_without_exit: Al bifurcation, girar a sinistra verso %{name} slight_left_without_exit: Curva suave a sinistra verso %{name} via_point_without_exit: (puncto intermedie) follow_without_exit: Sequer %{name} diff --git a/config/locales/is.yml b/config/locales/is.yml index c2668f668..a8d1323d0 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -56,8 +56,8 @@ is: diary_entry: user: Notandi title: Fyrirsögn - latitude: Lengdargráða - longitude: Breiddargráða + latitude: Breiddargráða + longitude: Lengdargráða language: Tungumál friend: user: Notandi @@ -67,9 +67,9 @@ is: visible: Sýnileg name: Nafn size: Stærð - latitude: Lengdargráða - longitude: Breiddargráða - public: Sýnileg öllum + latitude: Breiddargráða + longitude: Lengdargráða + public: Opinbert description: Lýsing message: sender: Sendandi @@ -77,7 +77,7 @@ is: body: Texti recipient: Móttakandi user: - email: Netfang + email: Tölvupóstfang active: Virkur display_name: Sýnilegt nafn description: Lýsing @@ -88,8 +88,15 @@ is: with_name_html: '%{name} (%{id})' editor: default: Sjálfgefið (núna %{name}) + potlatch: + name: Potlatch 1 + description: Potlatch 1 (ritill í vafra) id: name: iD + description: iD (ritill í vafra) + potlatch2: + name: Potlatch 2 + description: Potlatch 2 (ritill í vafra) remote: name: Fjarstýring description: Fjarstýring (JOSM eða Merkaartor) @@ -97,6 +104,12 @@ is: created: Búið til closed: Lokað created_html: Bjó til %{time} síðan + closed_html: Lokað fyrir %{time} síðan + created_by_html: Búið til fyrir %{time} síðan af + %{user} + deleted_by_html: Eytt fyrir %{time} síðan af %{user} + edited_by_html: Breytt fyrir %{time} síðan af %{user} + closed_by_html: Lokað fyrir %{time} síðan af %{user} version: Útgáfa in_changeset: Breytingasett anonymous: nafnlaus @@ -116,6 +129,9 @@ is: relation: Vensl (%{count}) relation_paginated: Vensl (%{x}-%{y} af %{count}) comment: Athugasemdir (%{count}) + hidden_commented_by: Falin umsögn frá %{user} %{when} + síðan + commented_by: Umsögn frá %{user} %{when} síðan changesetxml: Breytingasetts XML sniði osmchangexml: osmChange XML sniði feed: @@ -131,6 +147,8 @@ is: history_title: 'Saga leiðar: %{name}' nodes: Hnútar relation: + title: 'Vensl: %{name}' + history_title: 'Ferill vensla: %{name}' members: Meðlimir relation_member: entry: '%{type} %{name}' @@ -165,6 +183,9 @@ is: way: leið relation: venslum start_rjs: + feature_warning: Hleð inn %{num_features} fitjum (kortahlutum), sem gæti valdið + því að vafrinn þinn verði hægur eða svari ekki. Ertu viss um að þú viljir + birta þessi gögn? load_data: Hlaða inn gögnum loading: Hleð inn gögnum... tag_details: @@ -180,13 +201,18 @@ is: new_note: Nýr minnispunktur description: Lýsing hidden_title: 'Falinn minnispunktur #%{note_name}' + query: + title: Rannsaka fitjur + introduction: Smelltu á kortið til að finna fitjur í nágrenninu. + nearby: Nálægar fitjur + enclosing: Umlykjandi fitjur changeset: changeset_paging_nav: showing_page: Síða %{page} next: Næsta » - previous: « Fyrri + previous: « Fyrra changeset: - anonymous: Ónafngreindur + anonymous: Nafnlaus no_edits: (engar breytingar) view_changeset_details: Skoða breytingasett changesets: @@ -235,7 +261,7 @@ is: user_title: Blogg %{user} leave_a_comment: Bæta við athugasemd login_to_leave_a_comment: '%{login_link} til að bæta við athugasemd' - login: Innskráðu þig + login: Innskrá save_button: Vista no_such_entry: title: Þessi bloggfærsla er ekki til @@ -300,14 +326,14 @@ is: other: title: Aðrar heimildir options: Valmöguleikar - format: 'Snið:' - scale: Skali + format: Snið + scale: Kvarði max: hámark - image_size: 'Stærð myndar:' + image_size: Stærð myndar zoom: Aðdráttur add_marker: Bæta punkti á kortið - latitude: 'Lengdargráða:' - longitude: 'Breiddargráða:' + latitude: 'Lengd:' + longitude: 'Breidd:' output: Úttak paste_html: Notaðu þennan HTML kóða til að bæta kortinu á vefsíðu export_button: Niðurhala @@ -342,6 +368,7 @@ is: taxiway: Akstursbraut terminal: Flugstöð amenity: + animal_shelter: Dýraheimili arts_centre: Listamiðstöð atm: Hraðbanki bank: Banki @@ -355,13 +382,13 @@ is: brothel: Hóruhús bureau_de_change: Gjaldeyrisskipti bus_station: Strætóstöð - cafe: Kaffihúsið + cafe: Kaffihús car_rental: Bílaleigan car_wash: Bílaþvottastöðin casino: Spilavíti charging_station: Hleðslustöð childcare: Barnagæsla - cinema: Kvikmyndarhús + cinema: Kvikmyndahús clinic: Heilsugæsla clock: Klukka college: Framhaldskóli @@ -432,6 +459,7 @@ is: village_hall: Hreppsskrifstofa waste_basket: Ruslafata waste_disposal: Ruslsöfnun + youth_centre: Ungmennamiðstöð boundary: administrative: Stjórnsýslumörk census: Manntalsmörk @@ -452,7 +480,7 @@ is: gardener: Garðyrkjumaður painter: Málari photographer: Ljósmyndari - plumber: Pípari + plumber: Pípulagningamaður shoemaker: Skósmiður tailor: Klæðskeri "yes": Handverkshús @@ -477,6 +505,8 @@ is: platform: Kerfishögun primary: Stofnvegur primary_link: Stofnvegur + proposed: Tillaga um veglagningu + raceway: Keppnisbraut residential: Íbúðagata rest_area: Hvíldarsvæði road: Vegur @@ -487,6 +517,7 @@ is: steps: Tröppur street_lamp: Ljósastaur track: Spor + traffic_signals: Umferðarljós trail: Slóði trunk: Stofnbraut trunk_link: Stofnbraut @@ -506,9 +537,11 @@ is: heritage: Sögulegur staður house: Hús icon: Táknmynd + manor: Herragarður memorial: Minnismerki mine: Náma monument: Minnisvarði + roman_road: Rómverskur vegur ruins: Rústir stone: Steinn tomb: Gröf @@ -518,6 +551,7 @@ is: "yes": Tenging landuse: allotments: Úthlutuð svæði + basin: Lægð cemetery: Grafreitur commercial: Verslunarsvæði farm: Býli @@ -535,13 +569,16 @@ is: railway: Lestarteinar reservoir: Uppistöðulón residential: Íbúðasvæði + vineyard: Vínekra + "yes": Landnotkun leisure: bird_hide: Fuglaskoðunarhús club: Klúbbur + common: Almenningur fitness_centre: Líkamsræktarstöð garden: Garður golf_course: Golfvöllur - horse_riding: Festaferðir + horse_riding: Hestaferðir ice_rink: Skautahöll marina: Bátalægi miniature_golf: Mínigolf @@ -588,6 +625,7 @@ is: land: Land marsh: Votlendi moor: Mýri + mud: Leir peak: Tindur point: Nes reef: Sker @@ -595,6 +633,7 @@ is: rock: Rokk saddle: Söðull sand: Sandur + scrub: Kjarr spring: Lind stone: Steinn strait: Sund @@ -603,14 +642,15 @@ is: volcano: Eldfjall water: Vatn wetland: Votlendi - wood: Náttúrulegur skógur + wood: Skógur office: accountant: Bókari administrative: Stjórnsýsla architect: Arkítektar company: Fyrirtæki estate_agent: Fasteignasali - travel_agent: Ferðaskrifstofan + lawyer: Lögmaður + travel_agent: Ferðaskrifstofa "yes": Skrifstofa place: allotments: Úthlutuð svæði @@ -618,8 +658,8 @@ is: airport: Flugvöllur city: Borg country: Land - county: Landið - farm: Sveitabærinn + county: Sýsla + farm: Býli hamlet: Byggðakjarni house: Hús houses: Hús @@ -650,6 +690,7 @@ is: books: Bókabúð butcher: Slátrari car: Bílavöruverslun + car_parts: Bílapartar carpet: Teppabúð clothes: Fataverslun computer: Tölvuverslun @@ -662,7 +703,7 @@ is: florist: Blómabúð food: Matvöruverslun funeral_directors: Útfararstjóri - furniture: Húsgagnaverslun + furniture: Húsgögn gallery: Gallerí garden_centre: Garðyrkja general: Almenn verslun @@ -733,7 +774,7 @@ is: rapids: Flúðir river: Á stream: Lækur - waterfall: Fossinn + waterfall: Foss "yes": Siglingaleið admin_levels: level5: Héraðsmörk @@ -764,7 +805,7 @@ is: start_mapping: Hefja kortlagningu sign_up_tooltip: Stofnaðu aðgang til að geta breytt kortinu edit: Breyta - history: Breytingaskrá + history: Sagnfræði export: Niðurhala data: Gögn export_data: Flytja út gögn @@ -948,7 +989,7 @@ is: outbox: úthólf from: Frá subject: Titill - date: Dagsetning + date: Döðlur no_messages_yet: Þú hefur ekki fengið nein skilboð. Hví ekki að hafa samband við einhverja %{people_mapping_nearby_link}? people_mapping_nearby: nálæga notendur @@ -1038,7 +1079,7 @@ is: to: Til where_am_i: Hvar er ég? where_am_i_title: Notar leitarvélina til að lýsa núverandi staðsetningu á kortinu - submit_text: Ok + submit_text: Fara key: table: entry: @@ -1058,7 +1099,7 @@ is: - Smálest - sporvagn cable: - - Skíðalyfta + - Kláflyfta - stólalyfta runway: - Flugbraut @@ -1100,7 +1141,7 @@ is: - tindur tunnel: Umkringt punktalínum = göng bridge: Umkringt svartri línu = brú - private: Í einkaeigu + private: Einkaaðgangur destination: Umferð leyfileg á ákveðinn áfangastað construction: Vegir í byggingu richtext_area: @@ -1327,6 +1368,8 @@ is: windowslive: title: Skrá inn með Windows Live alt: Skrá inn með Windows Live aðgangi + github: + title: Skrá inn með GitHub yahoo: title: Skrá inn með Yahoo alt: Skrá inn með Yahoo OpenID-aðgangi @@ -1733,6 +1776,8 @@ is: createnote_tooltip: Bæta við minnispunkti á kortið map_notes_zoom_in_tooltip: Renndu að til að sjá minnispunkta á kortinu map_data_zoom_in_tooltip: Renndu að til að skoða gögn kortsins + queryfeature_tooltip: Rannsaka fitjur + queryfeature_disabled_tooltip: Renndu inn til að rannsaka fitjur changesets: show: comment: Athugasemd @@ -1767,6 +1812,7 @@ is: node: Hnútur way: Leið relation: Vensl + nothing_found: Engar fitjur fundust redaction: edit: description: Lýsing diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 274889adb..c2f7ad2ee 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -969,7 +969,7 @@ ko: copyright: 저작권 community: 커뮤니티 community_blogs: 커뮤니티 블로그 - community_blogs_title: OpenStreetMap 커뮤니티의 구성원에서의 블로그 + community_blogs_title: OpenStreetMap 커뮤니티의 회원에서의 블로그 foundation: 재단 foundation_title: OpenStreetMap 재단 make_a_donation: @@ -1443,6 +1443,7 @@ ko: bridleway: 승마로 cycleway: 자전거 도로 cycleway_national: 국립 자전거 도로 + cycleway_regional: 지역별 자전거 도로 cycleway_local: 일반 자전거 도로 footway: 보도 rail: 철도 @@ -1803,8 +1804,9 @@ ko: 약관에 동의해야합니다. email address: '이메일 주소:' confirm email address: '이메일 주소 확인:' - not displayed publicly: 공개적으로 표시되지 않습니다 (개인 정보 정책을 참조하세요) + not displayed publicly: 당신의 주소는 공개되지 않습니다. 자세한 내용은 개인정보 정책을 + 참조하시기 바랍니다. display name: '표시 이름:' display name description: 공개적으로 표시되는 사용자 이름입니다. 나중에 환경 설정에서 바꿀 수 있습니다. external auth: '제3자 인증:' @@ -1956,7 +1958,7 @@ ko: latitude: '위도:' longitude: '경도:' update home location on click: 지도에서 클릭하면 집 위치로 업데이트할까요? - save changes button: 변경 사항 저장 + save changes button: 변경사항 저장 make edits public button: 내 편집을 공개하기 return to profile: 프로필로 돌아가기 flash update success confirm needed: 사용자 정보를 성공적으로 업데이트했습니다. 새 이메일 주소를 확인하기 @@ -2277,16 +2279,20 @@ ko: instructions: continue_without_exit: '%{name}(으)로 계속 가세요' slight_right_without_exit: '%{name}을(를) 따라 오른쪽으로 완만하게 도세요' + offramp_right_without_exit: '%{name}을(를) 향해 램프로 우회전' onramp_right_without_exit: 경사로에서 %{name}(으)로 우회전 endofroad_right_without_exit: 길 끝쪽에서 %{name}(으)로 우회전 + merge_right_without_exit: '%{name}을(를) 따라 우회전' fork_right_without_exit: 분기점에서 %{name}(으)로 우회전 turn_right_without_exit: '%{name}을(를) 따라 오른쪽으로 도세요' sharp_right_without_exit: '%{name}을(를) 따라 오른쪽으로 꺾으세요' uturn_without_exit: '%{name}을(를) 따라 유턴하세요' sharp_left_without_exit: '%{name}을(를) 따라 왼쪽으로 꺾으세요' turn_left_without_exit: '%{name}을(를) 따라 왼쪽으로 도세요' + offramp_left_without_exit: '%{name}을(를) 향해 램프로 좌회전' onramp_left_without_exit: 경사로에서 %{name}(으)로 좌회전 endofroad_left_without_exit: 길 끝쪽에서 %{name}(으)로 좌회전 + merge_left_without_exit: '%{name}을(를) 따라 좌회전' fork_left_without_exit: 분기점에서 %{name}(으)로 좌회전 slight_left_without_exit: '%{name}을(를) 따라 왼쪽으로 완만하게 도세요' via_point_without_exit: (점을 통해) diff --git a/config/locales/nb.yml b/config/locales/nb.yml index b44d0897b..2dd25cbe3 100644 --- a/config/locales/nb.yml +++ b/config/locales/nb.yml @@ -1226,16 +1226,16 @@ nb: og lisenssiden for detaljer.' legal_title: Juridisk legal_html: |- - Dette nettstedet og mange tilknyttede tjenester drives formelt av OpenStreetMap Foundation (OSMF) på vegne av fellesskapet. + Dette nettstedet og mange tilknyttede tjenester drives formelt av OpenStreetMap Foundation (OSMF) på vegne av fellesskapet. Bruken av alle OSMF-drevne tjenester er gjenstand for vår politikk for akseptabel bruk og vår personvernspolitikk
    Vennligst kontakt OSMF om du har spørsmål knyttet til lisensiering, opphavsrett eller andre juridiske spørsmål. partners_title: Partnere notifier: diary_comment_notification: - subject: '[OpenStreetMap] %{user} kommenterte et innlegg i dagboka di' + subject: '[OpenStreetMap] %{user} kommenterte et dagbokinnlegg' hi: Hei %{to_user}, - header: '%{from_user} har kommentert på ditt siste OpenStreetMap-dagbokinnlegg - med emnet %{subject}:' + header: '%{from_user} har kommentert på OpenStreetMap-dagbokinnlegget med emnet + %{subject}:' footer: Du kan også lese kommentaren på %{readurl} og du kan kommentere på %{commenturl} eller svare på %{replyurl} message_notification: @@ -1840,9 +1840,9 @@ nb: license_agreement: Når du bekrefter kontoen din må du godkjenne bidragsytervilkårene. email address: 'E-postadresse:' confirm email address: 'Bekreft e-postadresse:' - not displayed publicly: Ikke vist offentlig (se vår - personvernpolitikk) + personvernpolitikk for mer informasjon. display name: 'Visningsnavn:' display name description: Ditt offentlig fremviste brukernavn. Du kan endre dette senere i innstillingene. @@ -2273,7 +2273,7 @@ nb: key: title: Kartsymbol tooltip: Kartsymbol - tooltip_disabled: Kartnøkkel bare tilgjengelig for standardlag + tooltip_disabled: Kartnøkkel ikke tilgjengelig for dette laget map: zoom: in: Forstørr utvalg diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 2b46b49a9..6058a6325 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -753,7 +753,7 @@ nl: volcano: Vulkaan water: Water wetland: Moeras - wood: Bos + wood: Bomen office: accountant: Boekhouder administrative: Administratie @@ -1266,15 +1266,18 @@ nl: legal_title: Juridisch legal_html: "Deze site en tal van andere diensten worden formeel beheerd door \nOpenStreetMap Foundation (OSMF) - \nnamens de gemeenschap.\n
    \nNeem - contact op met de OSMF \nals u vragen of problemen hebt in verband met licenties, - auteursrechten of andere juridische zaken." + \nnamens de gemeenschap. Het gebruik van alle door OSMF aangeboden diensten + is onderworpen\naan ons \nBeleid + voor aanvaardbaar gebruik en ons Privacybeleid.\n
    + \nNeem contact op met de OSMF + \nals u vragen of problemen hebt in verband met licenties, auteursrechten of + andere juridische zaken." partners_title: Partners notifier: diary_comment_notification: subject: '[OpenStreetMap] %{user} heeft een reactie bij uw dagboek geplaatst' hi: Hallo %{to_user}, - header: '%{from_user} heeft een reactie geplaatst bij uw recente OpenStreetMap-dagboekbericht + header: '%{from_user} heeft een reactie geplaatst bij uw OpenStreetMap-dagboekbericht met het onderwerp %{subject}:' footer: U kunt de reactie ook lezen op %{readurl} en u kunt zelf ook reageren op %{commenturl} of antwoorden op %{replyurl} @@ -1514,11 +1517,11 @@ nl: track: Spoor bridleway: Ruiterpad cycleway: Fietspad - cycleway_national: Nationale fietsweg - cycleway_regional: Regionale fietsweg - cycleway_local: Lokaal fietspad - footway: Voetpad - rail: Spoor + cycleway_national: Nationale fietsroute + cycleway_regional: Regionale fietsroute + cycleway_local: Lokale fietsroute + footway: Wandelpad of voetpad + rail: Spoorweg subway: Metro tram: - Licht spoor @@ -1534,16 +1537,16 @@ nl: - terminal admin: Bestuurlijke grens forest: Bos - wood: Bos + wood: Bomen golf: Golfbaan park: Park resident: Bewoond gebied common: - - Algemeen + - Gemene grond - weide retail: Winkelgebied industrial: Industriegebied - commercial: Winkelgebied + commercial: Commercieel gebied heathland: Heide lake: - Meer @@ -1884,7 +1887,7 @@ nl: no_auto_account_create: Helaas is het niet mogelijk om automatisch een gebruiker voor u aan te maken. contact_webmaster: Neem contact op met de webmaster - om een gebruiker te laten maken. We proberen uw aanvraag dan zo snel mogelijk + om een account te laten maken. We proberen uw aanvraag dan zo snel mogelijk af te handelen. about: header: Open en te bewerken @@ -1896,8 +1899,9 @@ nl: voor bijdragen. email address: 'E-mailadres:' confirm email address: 'E-mailadres bevestigen:' - not displayed publicly: Niet openbaar gemaakt. Zie Privacyovereenkomst. + not displayed publicly: Uw adres wordt niet openbaar gemaakt, zie ons Privacybeleid + voor meer informatie. display name: 'Weergavenaam:' display name description: Uw openbare gebruikersnaam. U kunt deze later in uw voorkeuren wijzigen. @@ -2088,7 +2092,7 @@ nl: opnieuw laten verzenden. confirm_resend: success: Er is ter bevestiging een e-mail verstuurd naar %{email} en als u uw - gebruiker hebt bevestigd, kunt u gaan mappen.

    Als u een spamfilter + account hebt bevestigd, kunt u gaan mappen.

    Als u een spamfilter gebruikt die per e-mail een bevestiging stuurt, zorg er dan voor dat u %{sender} toestaat. Dit systeem stuurt geen antwoord op bevestigingsverzoeken. failure: De gebruiker %{name} is niet gevonden. @@ -2336,7 +2340,7 @@ nl: key: title: Legenda tooltip: Legenda - tooltip_disabled: Legenda is alleen beschikbaar voor standaardlaag + tooltip_disabled: Legenda is niet beschikbaar voor deze laag map: zoom: in: Inzoomen @@ -2412,9 +2416,9 @@ nl: slight_right_without_exit: Flauwe bocht naar rechts naar %{name} offramp_right_without_exit: Neem de oprit aan de rechterkant naar %{name} onramp_right_without_exit: Sla rechtsaf op de oprit naar %{name} - endofroad_right_without_exit: Sla op het einde van de weg rechtsaf naar %{name} + endofroad_right_without_exit: Sla rechtsaf aan het einde van de weg naar %{name} merge_right_without_exit: Voeg rechts in naar %{name} - fork_right_without_exit: Sla bij de splitsing rechtsaf naar %{name} + fork_right_without_exit: Sla rechtsaf bij de splitsing naar %{name} turn_right_without_exit: Sla rechtsaf naar %{name} sharp_right_without_exit: Scherp rechtsaf naar %{name} uturn_without_exit: U-bocht langs %{name} @@ -2422,9 +2426,9 @@ nl: turn_left_without_exit: Sla linksaf naar %{name} offramp_left_without_exit: Neem de oprit aan de linkerkant naar %{name} onramp_left_without_exit: Sla linksaf op de oprit naar %{name} - endofroad_left_without_exit: Sla op het einde van de weg linksaf naar %{name} + endofroad_left_without_exit: Sla linksaf bij het einde van de weg naar %{name} merge_left_without_exit: Voeg links in naar %{name} - fork_left_without_exit: Sla bij de splitsing linksaf naar %{name} + fork_left_without_exit: Sla linksaf bij de splitsing naar %{name} slight_left_without_exit: Flauwe bocht naar links naar %{name} via_point_without_exit: (via punt) follow_without_exit: Volg %{name} diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 806b72c9c..7f3ac0294 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -133,7 +133,7 @@ pl: name: Potlatch 2 description: Potlatch 2 (w przeglądarce) remote: - name: Zewnętrzny edytor + name: Zdalny program description: Zdalny program (JOSM lub Merkaartor) browse: created: Utworzone @@ -2310,7 +2310,7 @@ pl: javascripts: close: Zamknij share: - title: Udostępnij + title: Udostępnianie cancel: Anuluj image: Obraz link: Odnośnik lub HTML @@ -2344,9 +2344,9 @@ pl: popup: Jesteś w promieniu {distance} {unit} od tego punktu base: standard: Podstawowa - cycle_map: Mapa rowerowa - transport_map: Transport publiczny - hot: Pomoc humanitarna + cycle_map: Rowerowa + transport_map: Transportu publicznego + hot: Pomocy humanitarnej layers: header: Warstwy mapy notes: Uwagi diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 32ec470d5..e80f89695 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1151,7 +1151,7 @@ pt-BR: como o nome de um restaurante ou o limite de velocidade de uma rodovia. rules: title: Regras! - paragraph_1_html: O OpenStreetMap tem poucas regras formas mas espera que todos + paragraph_1_html: O OpenStreetMap tem poucas regras formais mas espera que todos os participantes contribuam e se comuniquem com a comunidade. Se estiver pensando em atividades que não sejam editar manualmente, lei a e siga as orientações em Importações diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index 16dd0fc3c..8aaf8bc13 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1239,16 +1239,19 @@ pt-PT: legal_title: Termos legais legal_html: "Este site e outros serviços relacionados são formalmente geridos pela \nOpenStreetMap Foundation (OSMF) - \nem nome da comunidade.\n
    \nPor favor contacte - a OSMF \nse tiver questões sobre a licença, direitos de autor, questões - legais ou problemas." + \nem nome da comunidade. A utilização de todos os serviços operados pela OSMF + está sujeita às nossas normas de Utilização + Aceitável e de Privacidade\n
    + \nPor favor contacte a OSMF \nse + tiver questões relacionadas com licenças, direitos de autor, questões legais + ou problemas." partners_title: Parceiros notifier: diary_comment_notification: - subject: '[OpenStreetMap] %{user} comentou numa entrada do seu diário' + subject: '[OpenStreetMap] %{user} comentou uma entrada de diário' hi: Olá %{to_user}, - header: '%{from_user} comentou na sua entrada recente do diário no OpenStreetMap - com o assunto %{subject}:' + header: '%{from_user} comentou a entrada do diário OpenStreetMap com o assunto + %{subject}:' footer: Também pode ler o comentário em %{readurl} e comentar em %{commenturl} ou responder em %{replyurl} message_notification: @@ -1959,16 +1962,16 @@ pt-PT: revoke: administrator: Retirar acesso de administrador moderator: Retirar acesso de moderador - block_history: bloqueios recebidos - moderator_history: bloqueios feitos + block_history: Bloqueios ativos + moderator_history: Bloqueios feitos comments: Comentários - create_block: bloquear este utilizador - activate_user: ativar este utilizador - deactivate_user: desativar este utilizador + create_block: Bloquear este utilizador + activate_user: Ativar este utilizador + deactivate_user: Desativar este utilizador confirm_user: Confirmar esse utilizador - hide_user: ocultar este utilizador - unhide_user: descobrir este utilizador - delete_user: eliminar este utilizador + hide_user: Ocultar este utilizador + unhide_user: Desocultar este utilizador + delete_user: Eliminar este utilizador confirm: Confirmar friends_changesets: alterações dos amigos friends_diaries: ver as entradas em diários dos amigos @@ -2309,7 +2312,7 @@ pt-PT: key: title: Legenda do mapa tooltip: Legenda do mapa - tooltip_disabled: Legenda do Mapa disponível apenas no Mapa Padrão + tooltip_disabled: Legenda do Mapa indisponível para esta camada map: zoom: in: Aproximar diff --git a/config/locales/ru.yml b/config/locales/ru.yml index da17a474f..e1826e75e 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -2363,7 +2363,7 @@ ru: key: title: Легенда карты tooltip: Условные знаки - tooltip_disabled: Ключевые карты не доступны для этого слоя + tooltip_disabled: Условные знаки не доступны для этого слоя map: zoom: in: Приблизить @@ -2414,8 +2414,8 @@ ru: hide: Скрыть resolve: Обработать reactivate: Переоткрыть - comment_and_resolve: Прокомментировать и обработать - comment: Прокомментировать + comment_and_resolve: Ответить и обработать + comment: Ответить edit_help: Передвиньте карту и увеличьте место, которые вы хотите править, затем кликните здесь. directions: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 0dd9afa50..ea25dd56c 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -164,12 +164,13 @@ sl: entry: Zveza %{relation_name} entry_role: Zveza %{relation_name} (kot %{relation_role}) not_found: - sorry: 'Oprostite, %{type} #%{id} ni mogoče najti.' + sorry: 'Žal %{type} #%{id} ni mogoče najti.' type: node: vozlišče way: pot relation: zveza changeset: Paket sprememb + note: opomba timeout: sorry: Oprostite, podatki za %{type} z ID-jem %{id} se predolgo prenaÅ¡ajo. type: @@ -177,6 +178,7 @@ sl: way: pot relation: zveza changeset: Paket sprememb + note: opomba redacted: redaction: Redakcija %{id} message_html: Verzija %{version} te %{type} ne more biti prikazana, ker je bila @@ -239,12 +241,19 @@ sl: title_user: Paketi sprememb uporabnika %{user} title_friend: Paket sprememb vaÅ¡ih prijateljev title_nearby: Paketi sprememb bližnjih uporabnikov - empty: Ni najdenih množic sprememb. - empty_area: Na tem področju ni množic sprememb. + empty: Ni najdenih paketov sprememb. + empty_area: Na tem področju ni paketov sprememb. + empty_user: Ni paketov sprememb tega uporabnika. + no_more: Ni najdenih več paketov sprememb. + no_more_area: Ni več paketov sprememb na tem področju. + no_more_user: Ni več paketov sprememb tega uporabnika. load_more: Naloži več timeout: sorry: Žal je seznam zahtevanih sprememb predolg za prenos. rss: + title_all: Razprava o paketu sprememb OpenStreetMap + title_particular: 'Razprava o paketu sprememb OpenStreetMap #%{changeset_id}' + comment: 'Nov komentar o paketu sprememb #%{changeset_id} uporabnika %{author}' commented_at_html: Posodobljeno %{when} nazaj commented_at_by_html: Posodobil %{user} %{when} nazaj full: Celoten pogovor @@ -346,6 +355,10 @@ sl: planet: title: Planet OSM description: Redno posodabljane kopije celotne podatkovne zbirke OpenStreetMap + overpass: + title: Overpass API + description: Prenesi to območje iz zrcalnega strežnika podatkovne zbirke + OpenStreetMap geofabrik: title: Prenosi Geofabrik description: Redno posodabljani izvlečki celin, držav in izbranih mest @@ -422,7 +435,7 @@ sl: cinema: Kinematograf clinic: Klinika clock: Ura - college: Srednja Å¡ola + college: Fakulteta community_centre: Center skupnosti courthouse: Sodišče crematorium: Krematorij @@ -454,12 +467,12 @@ sl: motorcycle_parking: Parkirišče motornih koles nightclub: Nočni klub nursery: Vrtec - nursing_home: Dom za ostarele + nursing_home: Dom za starejÅ¡e office: Pisarne parking: Parkirišče parking_entrance: Vhod v parkirišče pharmacy: Lekarna - place_of_worship: Cerkev + place_of_worship: Mesto za čaščenje police: Policija post_box: PoÅ¡tni nabiralnik post_office: PoÅ¡ta @@ -493,7 +506,7 @@ sl: waste_basket: KoÅ¡ za odpadke youth_centre: Mladinski center boundary: - administrative: Upravne meje + administrative: Upravna meja census: Popisna meja national_park: Nacionalni Park protected_area: Zavarovano območje @@ -525,7 +538,7 @@ sl: bridleway: Jahalna pot bus_guideway: Turistični avtobus bus_stop: Avtobusna postaja - construction: Autocesta v izgradnji + construction: Cesta v izgradnji cycleway: Kolesarska steza elevator: Dvigalo emergency_access_point: Dostop za interventna vozila @@ -604,7 +617,7 @@ sl: garages: Garaže grass: Travnik greenfield: Pripravljeno za gradbišče - industrial: Industrijska cona + industrial: Industrijsko podočje landfill: Smetišče meadow: Travnik military: VojaÅ¡ko območje @@ -676,7 +689,7 @@ sl: island: Otok land: Otok marsh: Močvirje - moor: Močvirje + moor: Pušča mud: Blato peak: Vrh point: Točka @@ -697,7 +710,7 @@ sl: wetland: Mokrišče wood: Pragozd office: - accountant: Računovodja + accountant: Računovodstvo administrative: Administracija architect: Arhitekt company: Podjetje @@ -724,7 +737,7 @@ sl: islet: Otoček isolated_dwelling: Osamljena hiÅ¡a locality: Krajevno ime - moor: Muring + moor: Pušča municipality: Občina neighbourhood: Mestna četrt postcode: PoÅ¡tna Å¡tevilka @@ -769,7 +782,7 @@ sl: bakery: Pekarna beauty: Salon lepote beverages: Trgovina pijač - bicycle: Trgovina koles + bicycle: Kolesarska trgovina books: Knjigarna boutique: Butik butcher: Mesar @@ -777,20 +790,20 @@ sl: car_parts: Avtomobilski deli car_repair: Avtoservis carpet: Prodajalna preprog - charity: Dobrodelni trgovina + charity: Trgovina za dobrodelne namene chemist: Kemična trgovina clothes: Trgovina z oblekami computer: RačunalniÅ¡ka trgovina - confectionery: Trgovina sladkarij + confectionery: Slaščičarna convenience: Minimarket copyshop: Kopirnica - cosmetics: Drogerija + cosmetics: Trgovina s kozmetiko deli: Delikatesna trgovina department_store: Trgovska hiÅ¡a discount: Outlet doityourself: Orodjarna dry_cleaning: Čistilnica - electronics: Elektronska trgovina + electronics: Trgovina z elektroniko estate_agent: Nepremičninska agencija farm: Kmečka trgovina fashion: Modna trgovina @@ -820,7 +833,7 @@ sl: newsagent: Trafika optician: Optik organic: Trgovina z ekoloÅ¡ko hrano - outdoor: Trgovina na prostem + outdoor: Trgovina za dejavnosti na prostem pet: Trgovina za male živali pharmacy: Lekarna photo: Fotograf @@ -846,7 +859,7 @@ sl: cabin: Nočitev camp_site: Kamp caravan_site: Kamp - chalet: Apartma + chalet: PočitniÅ¡ka hiÅ¡ica gallery: Galerija guest_house: Penzion hostel: Hostel @@ -870,8 +883,8 @@ sl: ditch: Jarek dock: Dok drain: Jarek - lock: Zapornica - lock_gate: Velika zapornica + lock: Velika zapornica + lock_gate: Zapornica mooring: Sidrišče rapids: Brzice river: Reka @@ -912,7 +925,7 @@ sl: sign_up_tooltip: Ustvarite si nov uporabniÅ¡ki račun za urejanje edit: Uredi history: Zgodovina - export: Izvoz + export: Izvozi data: Podatki export_data: Izvoz podatkov gps_traces: Sledi GPS @@ -942,7 +955,7 @@ sl: community_blogs: Blogi skupnosti community_blogs_title: Blogi članov skupnosti OpenStreetMap foundation: Fundacija - foundation_title: OpenStreetMap Fubdacija + foundation_title: Fundacija OpenStreetMap make_a_donation: title: Podprite OpenStreetMap z denarnim prispevkom text: Prispevajte finančna sredstva @@ -1314,7 +1327,7 @@ sl: - Travniki - travnik retail: Trgovsko območje - industrial: Industrijsko območje + industrial: Industrijsko področje commercial: Poslovno območje heathland: Grmičevje lake: @@ -1341,6 +1354,9 @@ sl: private: Zasebni dostop destination: Dovoljeno za dostavo construction: Ceste v gradnji + bicycle_shop: Kolesarska trgovina + bicycle_parking: Parkirišče za kolesa + toilets: Stranišče richtext_area: edit: Uredi preview: Predogled @@ -1838,7 +1854,7 @@ sl: poÅ¡te pred sprejemom sporočil neznanih poÅ¡iljateljev zahteva potrditev, vas prosimo, da poÅ¡iljatelja %{sender} uvrstite na seznam dovoljenih poÅ¡iljateljev. Sistem pač ne zmore dovolj inteligentno odgovarjati na vse take zahtevke. - failure: Ne najdem uporabnika %{name}. + failure: Uporabnika %{name} ni bilo mogoče najti. confirm_email: heading: Potrdite spremembo naslova e-poÅ¡te press confirm button: Za potrditev spremembe vaÅ¡ega naslova elektronske poÅ¡te @@ -1874,7 +1890,7 @@ sl: summary_no_ip: '%{name} ustvarjen dne %{date}' confirm: Potrdi izbrane uporabnike hide: Skrij izbrane uporabnike - empty: Ne najdem nobenega uporabnika + empty: Nobenega uporabnika ni bilo mogoče najti suspended: title: Račun zaklenjen heading: Račun zaklenjen @@ -1913,7 +1929,7 @@ sl: non_moderator_update: Morate biti moderator da ustvarite ali popravite blokado. non_moderator_revoke: Morate biti moderator da prekličete blokado. not_found: - sorry: Žal blokade uporabnika z ID %{id} ni bilo mogoče najti. + sorry: Žal blokade uporabnika z ID-jem %{id} ni bilo mogoče najti. back: Nazaj na kazalo new: title: Ustvarjanje blokade za %{name} @@ -2088,10 +2104,11 @@ sl: edit_tooltip: Urejanje zemljevida edit_disabled_tooltip: Povečajte za urejanje zemljevida createnote_tooltip: Dodaj opombo na zemljevid - createnote_disabled_tooltip: Povečaj za dodati opombo na zemljevid - map_notes_zoom_in_tooltip: Povečaj za prikaz opomb zemljevida - map_data_zoom_in_tooltip: Povečaj za prikaz podatkov zemljevida + createnote_disabled_tooltip: Povečajte za dodajanje opomb na zemljevid + map_notes_zoom_in_tooltip: Povečajte za prikaz opomb zemljevida + map_data_zoom_in_tooltip: Povečajte za prikaz podatkov zemljevida queryfeature_tooltip: Poišči značilnosti + queryfeature_disabled_tooltip: Povečajte za iskanje značilnosti changesets: show: comment: Komentiraj @@ -2141,6 +2158,7 @@ sl: node: Vozlišče way: Pot relation: Zveza + nothing_found: Značilnosti ni bilo mogoče najti redaction: edit: description: Opis diff --git a/config/locales/sq.yml b/config/locales/sq.yml index f73c985aa..dcc6e827b 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -782,19 +782,24 @@ sq: disused_station: Stacion hekurudhor jashtë përdorimi funicular: Linjë teleferiku halt: Stacion hekerudhor + historic_station: Stacion hekurudhor historik junction: Nyje hekurudhore level_crossing: Kryqzim hekurudhor light_rail: Hekurudhë e lehtë + miniature: Hekurudhudhë në miniaturë monorail: Hekurudhë me një shinë + narrow_gauge: Ngushticë hekurudhe platform: Platformë hekurudhore preserved: Hekurudhë muze proposed: Hekurudhë e planifikuar + spur: Hekurudhë stop: Stacion hekurudhor subway: Metro subway_entrance: Hyrje metroje shop: bakery: Furrë buke butcher: Mishtore + car: Sallon automobilash car_parts: Autopjesë car_repair: Autoservis carpet: Dyqan qilimash @@ -930,15 +935,18 @@ sq: legal_babble: title_html: Të drejtat autoriale dhe licensa intro_1_html: |- - OpenStreetMap is open data, licensed under the ® përmban të dhëna të hapura, të licencuara nën Open Data - Commons Open Database License (ODbL). - intro_2_html: " Ju jeni të lirë të kopjoni, shpërndani, transmetoni dhe adoptoni - hartat\n dhe të dhënat tona, duke pasur parasysh citimin e OpenStreetMap - dhe \n kontribuuesve të saj. Nëse ndryshoni apo ndërtoni mbi hartat apo të - dhënat tona, ju\n mund të shpërndani rezultatet nën licencën e njëjtë. Licenca - e\n e plotë legal\n + Commons Open Database License (ODbL) by the OpenStreetMap Foundation (OSMF). + intro_2_html: "Ju jeni të lirë të kopjoni, shpërndani, transmetoni dhe adoptoni + dhe të dhënat tona, \nduke pasur parasysh citimin e OpenStreetMap dhe kontribuuesve + të saj. Nëse ndryshoni apo ndërtoni mbi hartat apo të dhënat tona, ju\nmund + të shpërndani rezultatet nën licencën e njëjtë. Licenca e plotë legal\n \ code shpjegon të drejtat dhe përgjegjësitë tuaja." + intro_3_html: |- + Hartografimi i pjesëve tona, dhe dokumantacioni ynë, janë të licencuara nën licensë të Creative + Commons Attribution-ShareAlike 2.0(CC BY-SA). credit_title_html: Si të citoni OpenStreetMap credit_1_html: Ne kërkojmë që ju të përdorni kreditet e “© OpenStreetMap contributors”. @@ -984,6 +992,16 @@ sq: title: Mirësevjen whats_on_the_map: title: Çfarë ka në hartë? + basic_terms: + title: Termat bazë për hartografim + paragraph_1_html: OpenStreetMap ka disa shprehje në zhargonin e vet. Këtu janë + disa fjalë kyçe mund të jenë të dobishme. + editor_html: Një redaktor është një program apo faqe të cilën + mund ta përdorni për ta redaktuar hartën. + node_html: Një nyje është një pikë në hartë, si një restorant + i vetëm ose një pemë. + way_html: Një rrugë është një linjë apo fushë, si një rrugë, + lumë, liqen apo ndërtesë. rules: title: Rregullat! start_mapping: Fillo hartografimin @@ -991,10 +1009,21 @@ sq: title: Nuk ke kohë për të redaktuar? Shto një shënim! help_page: title: Merr ndihmë + welcome: + url: Mirësevjen + title: Mirësevjen në OSM beginners_guide: url: http://wiki.openstreetmap.org/wiki/Sq:Beginners%27_guide + title: Udhëzues për fillestarë. + description: Një udhëzues për fillestarë që mirëmbahet nga komuniteti. + help: + url: https://help.openstreetmap.org/ + title: help.openstreetmap.org forums: title: Forumet + about_page: + next: Tjetra + copyright_html: ©OpenStreetMap
    kontribuesit notifier: diary_comment_notification: hi: Përshëndetje %{to_user}, @@ -1024,6 +1053,8 @@ sq: greeting: Përshëndetje, changeset_comment_notification: greeting: Përshëndetje, + commented: + partial_changeset_without_comment: pa koment message: inbox: title: Kutia mbërritëse diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 7f1ac3311..f9ef716a1 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1261,9 +1261,12 @@ sv: legal_title: Juridik legal_html: "Denna sida och många andra liknande tjänster drivs formellt av \nOpenStreetMap Foundation (OSMF) \npå - gemenskapens vägnar.\n
    \nVänligen kontakta - OSMF \nom du har frågor eller funderingar om licenser, upphovsrätt eller - andra rättsliga frågor." + gemenskapens vägnar. Användning av alla OSMF-opererade tjänster är föremål\nför + våra \npolicyer + för acceptabel användning och vår integritetspolicy\n
    + \nVänligen kontakta OSMF \nom + du har frågor eller funderingar om licenser, upphovsrätt eller andra rättsliga + frågor." partners_title: Partners notifier: diary_comment_notification: @@ -1691,7 +1694,7 @@ sv: title: OpenStreetMap GPS-spår description: description_with_count: - one: GPX-fil med %{count} punkter från %{user} + one: GPX-fil med %{count} punkt från %{user} other: GPX-fil med %{count} punkter från %{user} description_without_count: GPX-fil från %{user} application: @@ -1880,8 +1883,9 @@ sv: license_agreement: När du bekräftar ditt konto måste du samtycka till bidragsgivarvillkoren. email address: 'E-postadress:' confirm email address: 'Bekräfta e-postadress:' - not displayed publicly: Visas inte offentligt (se integritetspolicyn) + not displayed publicly: Din adress visas inte offentligt, se vår integritetspolicy + för mer information display name: 'Visat namn:' display name description: Ditt offentligt visade användarnamn. Du kan ändra detta senare i inställningarna. diff --git a/config/locales/te.yml b/config/locales/te.yml index 9a4cb23c3..01b684276 100644 --- a/config/locales/te.yml +++ b/config/locales/te.yml @@ -16,6 +16,7 @@ te: activerecord: models: acl: అనుమతి నియంత్రణ జాబితా + changeset: మార్పుల సమితి country: దేశం diary_comment: డైరీ వ్యాఖ్య diary_entry: దినచర్య పద్దు @@ -90,7 +91,10 @@ te: relation: సంబంధాలు (%{count}) relation_paginated: '%{count} లో %{x}-%{y} యొక్క సంబంధాలు' comment: వ్యాఖ్యలు (%{count}) + commented_by: '%{user} నుండి వ్యాఖ్య %{when} క్రితం' discussion: చర్చ + node: + title: 'బిందువు: %{name}' relation: title: 'సంబంధం: %{name}' history_title: 'సంబంధపు చరిత్ర: %{name}' @@ -124,7 +128,7 @@ te: new_note: కొత్త గమనిక description: వివరణ query: - nearby: daggarlo unna lakshanalu + nearby: దగ్గర్లోని విశేషాలు changeset: changeset_paging_nav: showing_page: పేజీ %{page} @@ -147,9 +151,11 @@ te: diary_entry: new: title: కొత్త దినచర్య పద్దు + publish_button: ప్రచురించు list: title: వాడుకరుల డైరీలు title_friends: స్నేహితుల దినచర్యలు + title_nearby: చుట్టుపక్కల వాడుకరుల డైరీలు user_title: '%{user} యొక్క దినచర్య' in_language_title: '%{language}లో ఉన్న డైరీ పద్దులు' new: కొత్త దినచర్య పద్దు @@ -158,7 +164,7 @@ te: older_entries: పాత పద్దులు newer_entries: కొత్త పద్దులు edit: - title: dairy lo unna entry ni marchu + title: డైరీ పద్దును మార్చు subject: 'విషయం:' body: 'వివరణ:' language: 'భాష:' @@ -281,6 +287,7 @@ te: marketplace: సంత nursery: పిల్లల బడి office: కార్యాలయం + parking: పార్కింగు pharmacy: మందుల దుకాణం place_of_worship: పూజా స్థలం police: పోలీసు @@ -306,7 +313,7 @@ te: building: "yes": భవనం craft: - painter: chitrakarudu + painter: పెయింటర్ photographer: చాయాగ్రాహకుడు tailor: దర్జీ highway: @@ -323,6 +330,7 @@ te: secondary_link: ద్వితీయ శ్రేణి రహదారి steps: మెట్లు street_lamp: వీధి దీపం + "yes": దారి historic: battlefield: యుద్ధరంగం boundary_stone: సరిహద్దు రాయి @@ -339,6 +347,8 @@ te: ruins: శిథిలాలు tomb: సమాధి tower: గోపురం + junction: + "yes": కూడలి landuse: cemetery: శ్మశానం commercial: వాణిజ్య ప్రదేశం @@ -359,6 +369,7 @@ te: reservoir: జలాశయం reservoir_watershed: జలాశయం residential: నివాస ప్రాంతం + "yes": భూఉపయోగం leisure: beach_resort: బీచి రిసార్టు bird_hide: పక్షులకు ఆవాసం @@ -419,6 +430,7 @@ te: toys: బొమ్మల అంగడి "yes": దుకాణం tourism: + apartment: అపార్టుమెంట్ hotel: హోటెల్ information: సమాచారం museum: ప్రదర్శన శాల @@ -503,6 +515,10 @@ te: local_knowledge_title: స్థానిక పరిజ్ఞానం partners_title: భాగస్వాములు notifier: + diary_comment_notification: + hi: హలో %{to_user}, + message_notification: + hi: హలో %{to_user}, gpx_notification: with_description: వివరణతో signup_confirm: @@ -583,6 +599,7 @@ te: building: ప్రముఖ కట్టడము station: రైల్వే స్టేషన్ construction: నిర్మాణంలో ఉన్న రహదార్లు + toilets: మరుగుదొడ్లు richtext_area: edit: మార్చు preview: మునుజూపు @@ -667,9 +684,9 @@ te: title: నమోదవ్వండి email address: 'ఈమెయిలు చిరునామా:' confirm email address: 'ఈమెయిలు చిరునామాని నిర్ధారించండి:' - not displayed publicly: బహిరంగంగా చూపించబడదు (గోప్యతా విధానాన్ని - చూడండి) + not displayed publicly: మీ చిరునామా బహిరంగంగా చూపబడదు, మరింత సమాచారం కోసం మా + గోప్యతా విధానాన్ని చూడండి display name: 'చూపించే పేరు:' password: 'సంకేతపదం:' confirm password: 'సంకేతపదాన్ని నిర్ధారించండి:' @@ -731,8 +748,10 @@ te: new email address: 'కొత్త ఈమెయిల్ చిరునామా:' email never displayed publicly: (బహిరంగంగా ఎన్నటికీ చూపించబడదు) openid: + link: https://wiki.openstreetmap.org/wiki/OpenID link text: ఇది ఏమిటి? public editing: + enabled link: https://wiki.openstreetmap.org/wiki/Anonymous_edits enabled link text: ఇది ఏమిటి? disabled link text: నేను ఎందుకు మార్చలేను? contributor terms: @@ -845,6 +864,7 @@ te: layers: notes: పటపు గమనికలు data: పటం భోగట్టా + copyright: © ఓపెన్‌స్ట్రీట్‌మాప్ తోడ్పాటుదార్లు donate_link_text: changesets: show: @@ -854,6 +874,11 @@ te: hide: దాచు comment_and_resolve: వ్యాఖ్యానించి పరిష్కరించండి comment: వ్యాఖ్యానించండి + directions: + distance: దూరం + time: సమయం + query: + relation: సంబంధం redaction: edit: description: వివరణ diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 70398557b..51a3ceb5f 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -1018,7 +1018,7 @@ zh-CN: 请在OSMF许可协议页面和法律常见问题阅读更多关于使用我们的数据,以及如何表明我们是作者的信息。 - more_2_html: 尽管 OpenStreetMap 开放数据,但是我们无法为第三方开发人员提供免费的地图 API。详见我们的 API使用政策、API使用政策、地图图块使用政策及名称服务使用政策。 contributors_title_html: 我们的贡献者 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 579d419a2..3529d2b7c 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -337,7 +337,7 @@ zh-TW: description: OpenStreetMap 使用者最近的日記項目 comments: has_commented_on: '%{display_name} 在以下的日記項目發表了評論' - post: 發表 + post: 貼文 when: 於 comment: 評論 ago: '%{ago} 前' @@ -1009,7 +1009,7 @@ zh-TW: 在OSMF 授權條款頁面與法律上的常見問題中,可閱讀更多關於使用我們的資料,以及如何標明我們是作者的資料。 - more_2_html: 雖然 OpenStreetMap 是開放資料,但我們無法為第三方開發人員提供免費的地圖 API。詳見我們的API + more_2_html: 雖然 OpenStreetMap 是開放資料,但我們無法為第三方提供免費的地圖 API。詳見我們的API 使用政策、地圖影像塊使用政策及Nominatim 服務使用政策。 diff --git a/db/migrate/20150111192335_subscribe_old_changesets.rb b/db/migrate/20150111192335_subscribe_old_changesets.rb index cd0938318..cca8293f5 100644 --- a/db/migrate/20150111192335_subscribe_old_changesets.rb +++ b/db/migrate/20150111192335_subscribe_old_changesets.rb @@ -5,6 +5,5 @@ class SubscribeOldChangesets < ActiveRecord::Migration end end - def down - end + def down; end end diff --git a/db/migrate/20161011010929_subscribe_authors_to_diary_entries.rb b/db/migrate/20161011010929_subscribe_authors_to_diary_entries.rb index 2dfbbf2c8..3fcbdf5fb 100644 --- a/db/migrate/20161011010929_subscribe_authors_to_diary_entries.rb +++ b/db/migrate/20161011010929_subscribe_authors_to_diary_entries.rb @@ -5,6 +5,5 @@ class SubscribeAuthorsToDiaryEntries < ActiveRecord::Migration end end - def down - end + def down; end end diff --git a/lib/auth.rb b/lib/auth.rb index 16102ed20..434994329 100644 --- a/lib/auth.rb +++ b/lib/auth.rb @@ -4,5 +4,6 @@ module Auth providers["Facebook"] = "facebook" if defined?(FACEBOOK_AUTH_ID) providers["Windows Live"] = "windowslive" if defined?(WINDOWSLIVE_AUTH_ID) providers["GitHub"] = "github" if defined?(GITHUB_AUTH_ID) + providers["Wikipedia"] = "wikipedia" if defined?(WIKIPEDIA_AUTH_ID) end.freeze end diff --git a/lib/password_hash.rb b/lib/password_hash.rb index 4faac4da8..c65df2c4f 100644 --- a/lib/password_hash.rb +++ b/lib/password_hash.rb @@ -6,7 +6,7 @@ require "digest/md5" module PasswordHash SALT_BYTE_SIZE = 32 HASH_BYTE_SIZE = 32 - PBKDF2_ITERATIONS = 1000 + PBKDF2_ITERATIONS = 10000 DIGEST_ALGORITHM = "sha512".freeze def self.create(password) diff --git a/script/deliver-message b/script/deliver-message index 04dcb881b..c15d36596 100755 --- a/script/deliver-message +++ b/script/deliver-message @@ -2,23 +2,25 @@ require File.dirname(__FILE__) + "/../config/environment" -exit 0 unless recipient = ARGV[0].match(/^([cm])-(\d+)-(.*)$/) - -if recipient[1] == "c" - comment = DiaryComment.find(recipient[2]) +if recipient = ARGV[0].match(/^c-(\d+)-(\d+)-(.*)$/) + comment = DiaryComment.find(recipient[1]) digest = comment.digest - date = diary_comment.created_at - from = comment.diary_entry.user + date = comment.created_at + from = User.find(recipient[2]) to = comment.user -else - message = Message.find(recipient[2]) + token = recipient[3] +elsif recipient = ARGV[0].match(/^m-(\d+)-(.*)$/) + message = Message.find(recipient[1]) digest = message.digest date = message.sent_on from = message.recipient to = message.sender + token = recipient[2] +else + exit 0 end -exit 0 unless recipient[3] == digest[0, 6] +exit 0 unless token == digest[0, 6] exit 0 if date < 1.month.ago message.update_attribute(:message_read, true) if message diff --git a/test/controllers/amf_controller_test.rb b/test/controllers/amf_controller_test.rb index 7c8c64ba0..fde8883b0 100644 --- a/test/controllers/amf_controller_test.rb +++ b/test/controllers/amf_controller_test.rb @@ -531,7 +531,10 @@ class AmfControllerTest < ActionController::TestCase def test_findrelations_by_tags visible_relation = current_relations(:visible_relation) + create(:relation_tag, :relation => visible_relation, :k => "test", :v => "yes") used_relation = current_relations(:used_relation) + create(:relation_tag, :relation => used_relation, :k => "test", :v => "yes") + create(:relation_tag, :relation => used_relation, :k => "name", :v => "Test Relation") amf_content "findrelations", "/1", ["yes"] post :amf_read diff --git a/test/controllers/api_controller_test.rb b/test/controllers/api_controller_test.rb index 0a185baae..bcc544263 100644 --- a/test/controllers/api_controller_test.rb +++ b/test/controllers/api_controller_test.rb @@ -53,6 +53,7 @@ class ApiControllerTest < ActionController::TestCase def test_map node = current_nodes(:used_node_1) + tag = create(:node_tag, :node => node) # Need to split the min/max lat/lon out into their own variables here # so that we can test they are returned later. minlon = node.lon - 0.1 @@ -70,7 +71,7 @@ class ApiControllerTest < ActionController::TestCase assert_select "bounds[minlon='#{minlon}'][minlat='#{minlat}'][maxlon='#{maxlon}'][maxlat='#{maxlat}']", :count => 1 assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do # This should really be more generic - assert_select "tag[k='test'][v='yes']" + assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" end assert_select "way", :count => 2 assert_select "way[id='1']", :count => 1 @@ -84,6 +85,7 @@ class ApiControllerTest < ActionController::TestCase # the same as the node we are looking at def test_map_inclusive node = current_nodes(:used_node_1) + tag = create(:node_tag, :node => node) bbox = "#{node.lon},#{node.lat},#{node.lon},#{node.lat}" get :map, :bbox => bbox assert_response :success, "The map call should have succeeded" @@ -91,7 +93,7 @@ class ApiControllerTest < ActionController::TestCase assert_select "bounds[minlon='#{node.lon}'][minlat='#{node.lat}'][maxlon='#{node.lon}'][maxlat='#{node.lat}']", :count => 1 assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do # This should really be more generic - assert_select "tag[k='test'][v='yes']" + assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" end assert_select "way", :count => 2 assert_select "way[id='1']", :count => 1 diff --git a/test/controllers/changeset_controller_test.rb b/test/controllers/changeset_controller_test.rb index efdf22e54..ca2ff8e15 100644 --- a/test/controllers/changeset_controller_test.rb +++ b/test/controllers/changeset_controller_test.rb @@ -1388,7 +1388,10 @@ EOF end def test_changeset_download + tag = create(:old_node_tag, :old_node => nodes(:used_node_2)) + get :download, :id => changesets(:normal_user_first_change).id + assert_response :success assert_template nil # print @response.body @@ -1396,7 +1399,7 @@ EOF assert_select "osmChange[version='#{API_VERSION}'][generator='#{GENERATOR}']" do assert_select "create", :count => 5 assert_select "create>node[id='#{nodes(:used_node_2).node_id}'][visible='#{nodes(:used_node_2).visible?}'][version='#{nodes(:used_node_2).version}']" do - assert_select "tag[k='#{node_tags(:t3).k}'][v='#{node_tags(:t3).v}']" + assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" end assert_select "create>node[id='#{nodes(:visible_node).node_id}']" end diff --git a/test/controllers/node_controller_test.rb b/test/controllers/node_controller_test.rb index 0cfc2267c..ffc86b2f6 100644 --- a/test/controllers/node_controller_test.rb +++ b/test/controllers/node_controller_test.rb @@ -437,13 +437,14 @@ class NodeControllerTest < ActionController::TestCase ## # test adding tags to a node def test_duplicate_tags + existing = create(:node_tag, :node => current_nodes(:public_visible_node)) # setup auth basic_authorization(users(:public_user).email, "test") # add an identical tag to the node tag_xml = XML::Node.new("tag") - tag_xml["k"] = current_node_tags(:public_v_t1).k - tag_xml["v"] = current_node_tags(:public_v_t1).v + tag_xml["k"] = existing.k + tag_xml["v"] = existing.v # add the tag into the existing xml node_xml = current_nodes(:public_visible_node).to_xml @@ -454,7 +455,7 @@ class NodeControllerTest < ActionController::TestCase put :update, :id => current_nodes(:public_visible_node).id assert_response :bad_request, "adding duplicate tags to a node should fail with 'bad request'" - assert_equal "Element node/#{current_nodes(:public_visible_node).id} has duplicate tags with key #{current_node_tags(:t1).k}", @response.body + assert_equal "Element node/#{current_nodes(:public_visible_node).id} has duplicate tags with key #{existing.k}", @response.body end # test whether string injection is possible diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb index 4b1d9f4ad..ab63bbca2 100644 --- a/test/controllers/notes_controller_test.rb +++ b/test/controllers/notes_controller_test.rb @@ -545,7 +545,7 @@ class NotesControllerTest < ActionController::TestCase assert_select "time", :count => 1 assert_select "name", "Note: #{open_note.id}" assert_select "desc", :count => 1 - assert_select "link[href='http://www.openstreetmap.org/note/#{open_note.id}']", :count => 1 + assert_select "link[href='http://test.host/note/#{open_note.id}']", :count => 1 assert_select "extensions", :count => 1 do assert_select "id", open_note.id.to_s assert_select "url", note_url(open_note, :format => "gpx") diff --git a/test/controllers/old_node_controller_test.rb b/test/controllers/old_node_controller_test.rb index f2658b123..181d13291 100644 --- a/test/controllers/old_node_controller_test.rb +++ b/test/controllers/old_node_controller_test.rb @@ -86,10 +86,14 @@ class OldNodeControllerTest < ActionController::TestCase basic_authorization(users(:public_user).email, "test") # setup a simple XML node + create_list(:node_tag, 2, :node => current_nodes(:node_with_versions)) xml_doc = current_nodes(:node_with_versions).to_xml xml_node = xml_doc.find("//osm/node").first nodeid = current_nodes(:node_with_versions).id + # Ensure that the current tags are propagated to the history too + propagate_tags(current_nodes(:node_with_versions), nodes(:node_with_versions_v4)) + # keep a hash of the versions => string, as we'll need something # to test against later versions = {} @@ -161,6 +165,17 @@ class OldNodeControllerTest < ActionController::TestCase # Test that getting the current version is identical to picking # that version with the version URI call. def test_current_version + create(:node_tag, :node => current_nodes(:visible_node)) + create(:node_tag, :node => current_nodes(:used_node_1)) + create(:node_tag, :node => current_nodes(:used_node_2)) + create(:node_tag, :node => current_nodes(:node_used_by_relationship)) + create(:node_tag, :node => current_nodes(:node_with_versions)) + propagate_tags(current_nodes(:visible_node), nodes(:visible_node)) + propagate_tags(current_nodes(:used_node_1), nodes(:used_node_1)) + propagate_tags(current_nodes(:used_node_2), nodes(:used_node_2)) + propagate_tags(current_nodes(:node_used_by_relationship), nodes(:node_used_by_relationship)) + propagate_tags(current_nodes(:node_with_versions), nodes(:node_with_versions_v4)) + check_current_version(current_nodes(:visible_node)) check_current_version(current_nodes(:used_node_1)) check_current_version(current_nodes(:used_node_2)) @@ -377,4 +392,10 @@ class OldNodeControllerTest < ActionController::TestCase def precision(f) (f * GeoRecord::SCALE).round.to_f / GeoRecord::SCALE end + + def propagate_tags(node, old_node) + node.tags.each do |k, v| + create(:old_node_tag, :old_node => old_node, :k => k, :v => v) + end + end end diff --git a/test/controllers/old_way_controller_test.rb b/test/controllers/old_way_controller_test.rb index 612b4a6a4..8d3bc6955 100644 --- a/test/controllers/old_way_controller_test.rb +++ b/test/controllers/old_way_controller_test.rb @@ -46,6 +46,13 @@ class OldWayControllerTest < ActionController::TestCase ## # check that we can retrieve versions of a way def test_version + create(:way_tag, :way => current_ways(:visible_way)) + create(:way_tag, :way => current_ways(:used_way)) + create(:way_tag, :way => current_ways(:way_with_versions)) + propagate_tags(current_ways(:visible_way), ways(:visible_way)) + propagate_tags(current_ways(:used_way), ways(:used_way)) + propagate_tags(current_ways(:way_with_versions), ways(:way_with_versions_v4)) + check_current_version(current_ways(:visible_way).id) check_current_version(current_ways(:used_way).id) check_current_version(current_ways(:way_with_versions).id) @@ -276,4 +283,10 @@ class OldWayControllerTest < ActionController::TestCase # now redact it post :redact, :id => way.way_id, :version => way.version, :redaction => redaction.id end + + def propagate_tags(way, old_way) + way.tags.each do |k, v| + create(:old_way_tag, :old_way => old_way, :k => k, :v => v) + end + end end diff --git a/test/controllers/relation_controller_test.rb b/test/controllers/relation_controller_test.rb index ab0aca45e..0366ceef0 100644 --- a/test/controllers/relation_controller_test.rb +++ b/test/controllers/relation_controller_test.rb @@ -337,6 +337,7 @@ class RelationControllerTest < ActionController::TestCase def test_update_relation_tags basic_authorization "test@example.com", "test" rel_id = current_relations(:multi_tag_relation).id + create_list(:relation_tag, 4, :relation => current_relations(:multi_tag_relation)) cs_id = changesets(:public_user_first_change).id with_relation(rel_id) do |rel| @@ -366,6 +367,7 @@ class RelationControllerTest < ActionController::TestCase def test_update_relation_tags_via_upload basic_authorization users(:public_user).email, "test" rel_id = current_relations(:multi_tag_relation).id + create_list(:relation_tag, 4, :relation => current_relations(:multi_tag_relation)) cs_id = changesets(:public_user_first_change).id with_relation(rel_id) do |rel| diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb index d3300452b..2e835a587 100644 --- a/test/controllers/search_controller_test.rb +++ b/test/controllers/search_controller_test.rb @@ -43,6 +43,11 @@ class SearchControllerTest < ActionController::TestCase ## # test searching ways def test_search_ways + [:visible_way, :invisible_way, :used_way].each do |way| + create(:way_tag, :way => current_ways(way), :k => "test", :v => "yes") + end + create(:way_tag, :way => current_ways(:used_way), :k => "name", :v => "Test Way") + get :search_ways, :type => "test" assert_response :service_unavailable assert_equal "Searching for a key without value is currently unavailable", response.headers["Error"] @@ -59,6 +64,11 @@ class SearchControllerTest < ActionController::TestCase ## # test searching relations def test_search_relations + [:visible_relation, :invisible_relation, :used_relation].each do |relation| + create(:relation_tag, :relation => current_relations(relation), :k => "test", :v => "yes") + end + create(:relation_tag, :relation => current_relations(:used_relation), :k => "name", :v => "Test Relation") + get :search_relations, :type => "test" assert_response :service_unavailable assert_equal "Searching for a key without value is currently unavailable", response.headers["Error"] diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index e309b1662..95eccb2c5 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -1384,7 +1384,7 @@ class UserControllerTest < ActionController::TestCase get :list, :page => 3 assert_response :success assert_template :list - assert_select "table#user_list tr", :count => 25 + assert_select "table#user_list tr", :count => 26 end def test_list_post_confirm diff --git a/test/controllers/way_controller_test.rb b/test/controllers/way_controller_test.rb index ccf299455..650977078 100644 --- a/test/controllers/way_controller_test.rb +++ b/test/controllers/way_controller_test.rb @@ -538,10 +538,12 @@ class WayControllerTest < ActionController::TestCase # setup auth basic_authorization(users(:normal_user).email, "test") + existing = create(:way_tag, :way => current_ways(:visible_way)) + # add an identical tag to the way tag_xml = XML::Node.new("tag") - tag_xml["k"] = current_way_tags(:t1).k - tag_xml["v"] = current_way_tags(:t1).v + tag_xml["k"] = existing.k + tag_xml["v"] = existing.v # add the tag into the existing xml way_xml = current_ways(:visible_way).to_xml @@ -559,8 +561,8 @@ class WayControllerTest < ActionController::TestCase # add an identical tag to the way tag_xml = XML::Node.new("tag") - tag_xml["k"] = current_way_tags(:t1).k - tag_xml["v"] = current_way_tags(:t1).v + tag_xml["k"] = existing.k + tag_xml["v"] = existing.v # add the tag into the existing xml way_xml = current_ways(:visible_way).to_xml @@ -571,7 +573,7 @@ class WayControllerTest < ActionController::TestCase put :update, :id => current_ways(:visible_way).id assert_response :bad_request, "adding a duplicate tag to a way should fail with 'bad request'" - assert_equal "Element way/#{current_ways(:visible_way).id} has duplicate tags with key #{current_way_tags(:t1).k}", @response.body + assert_equal "Element way/#{current_ways(:visible_way).id} has duplicate tags with key #{existing.k}", @response.body end ## diff --git a/test/factories/node_tags.rb b/test/factories/node_tags.rb new file mode 100644 index 000000000..267309e90 --- /dev/null +++ b/test/factories/node_tags.rb @@ -0,0 +1,9 @@ +FactoryGirl.define do + factory :node_tag do + sequence(:k) { |n| "Key #{n}" } + sequence(:v) { |n| "Value #{n}" } + + # Fixme requires node factory + node_id 1 + end +end diff --git a/test/factories/old_node_tags.rb b/test/factories/old_node_tags.rb new file mode 100644 index 000000000..5c63f3242 --- /dev/null +++ b/test/factories/old_node_tags.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :old_node_tag do + sequence(:k) { |n| "Key #{n}" } + sequence(:v) { |n| "Value #{n}" } + + # Fixme requires old_node factory + node_id 1 + version 1 + end +end diff --git a/test/factories/old_relation_tags.rb b/test/factories/old_relation_tags.rb new file mode 100644 index 000000000..08e417187 --- /dev/null +++ b/test/factories/old_relation_tags.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :old_relation_tag do + sequence(:k) { |n| "Key #{n}" } + sequence(:v) { |n| "Value #{n}" } + + # Fixme requires old_relation factory + relation_id 1 + version 1 + end +end diff --git a/test/factories/old_way_tags.rb b/test/factories/old_way_tags.rb new file mode 100644 index 000000000..c639c06db --- /dev/null +++ b/test/factories/old_way_tags.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :old_way_tag do + sequence(:k) { |n| "Key #{n}" } + sequence(:v) { |n| "Value #{n}" } + + # Fixme requires old_way factory + way_id 1 + version 1 + end +end diff --git a/test/factories/relation_tags.rb b/test/factories/relation_tags.rb new file mode 100644 index 000000000..00ad4dbdc --- /dev/null +++ b/test/factories/relation_tags.rb @@ -0,0 +1,9 @@ +FactoryGirl.define do + factory :relation_tag do + sequence(:k) { |n| "Key #{n}" } + sequence(:v) { |n| "Value #{n}" } + + # Fixme requires relation factory + relation_id 1 + end +end diff --git a/test/factories/way_tags.rb b/test/factories/way_tags.rb new file mode 100644 index 000000000..3bc3192f5 --- /dev/null +++ b/test/factories/way_tags.rb @@ -0,0 +1,9 @@ +FactoryGirl.define do + factory :way_tag do + sequence(:k) { |n| "Key #{n}" } + sequence(:v) { |n| "Value #{n}" } + + # Fixme requires way factory + way_id 1 + end +end diff --git a/test/fixtures/current_node_tags.yml b/test/fixtures/current_node_tags.yml deleted file mode 100644 index d299998b5..000000000 --- a/test/fixtures/current_node_tags.yml +++ /dev/null @@ -1,64 +0,0 @@ -t1: - node_id: 1 - k: 'testvisible' - v: 'yes' - -t2: - node_id: 2 - k: 'testused' - v: 'yes' - -t3: - node_id: 3 - k: 'test' - v: 'yes' - -t4: - node_id: 4 - k: 'test' - v: 'yes' - -nv_t1: - node_id: 15 - k: 'testing' - v: 'added in node version 3' - -nv_t2: - node_id: 15 - k: 'testing two' - v: 'modified in node version 4' - -public_v_t1: - node_id: 16 - k: 'testvisible' - v: 'yes' - -nwn_name: - node_id: 18 - k: 'name' - v: 'Test Node' - -nwn_name_pt: - node_id: 18 - k: 'name:pt' - v: 'Nó teste' - -nwn_building: - node_id: 18 - k: 'building' - v: 'yes' - -nwn_tourism: - node_id: 18 - k: 'tourism' - v: 'museum' - -nwn_shop: - node_id: 18 - k: 'shop' - v: 'gift' - -nwrwn_ref: - node_id: 19 - k: 'ref' - v: '3.1415926' diff --git a/test/fixtures/current_relation_tags.yml b/test/fixtures/current_relation_tags.yml deleted file mode 100644 index 505a76130..000000000 --- a/test/fixtures/current_relation_tags.yml +++ /dev/null @@ -1,49 +0,0 @@ -t1: - relation_id: 1 - k: 'test' - v: 'yes' - -t2: - relation_id: 2 - k: 'test' - v: 'yes' - -t3: - relation_id: 3 - k: 'test' - v: 'yes' - -t3_2: - relation_id: 3 - k: 'name' - v: 'Test Relation' - -mt_1: - relation_id: 4 - k: 'tag1' - v: 'val1' - -mt_2: - relation_id: 4 - k: 'tag2' - v: 'val2' - -mt_3: - relation_id: 4 - k: 'tag3' - v: 'val3' - -mt_4: - relation_id: 4 - k: 'tag4' - v: 'val4' - -rv_t1: - relation_id: 8 - k: 'testing' - v: 'added in relation version 3' - -rv_t2: - relation_id: 8 - k: 'testing two' - v: 'modified in relation version 4' diff --git a/test/fixtures/current_way_tags.yml b/test/fixtures/current_way_tags.yml deleted file mode 100644 index 2566c5484..000000000 --- a/test/fixtures/current_way_tags.yml +++ /dev/null @@ -1,29 +0,0 @@ -t1: - way_id: 1 - k: 'test' - v: 'yes' - -t2: - way_id: 2 - k: 'test' - v: 'yes' - -t3: - way_id: 3 - k: 'test' - v: 'yes' - -t3_t2: - way_id: 3 - k: 'name' - v: 'Test Way' - -wv_t1: - way_id: 4 - k: 'testing' - v: 'added in way version 3' - -wv_t2: - way_id: 4 - k: 'testing two' - v: 'modified in way version 4' diff --git a/test/fixtures/node_tags.yml b/test/fixtures/node_tags.yml deleted file mode 100644 index d9001b720..000000000 --- a/test/fixtures/node_tags.yml +++ /dev/null @@ -1,113 +0,0 @@ -t1: - node_id: 1 - k: 'testvisible' - v: 'yes' - version: 1 - -t2: - node_id: 3 - k: 'test' - v: 'yes' - version: 1 - -t3: - node_id: 4 - k: 'test' - v: 'yes' - version: 1 - -nv3_t1: - node_id: 15 - k: 'testing' - v: 'added in node version 3' - version: 3 - -nv3_t2: - node_id: 15 - k: 'testing two' - v: 'added in node version 3' - version: 3 - -nv3_t3: - node_id: 15 - k: 'testing three' - v: 'added in node version 3' - version: 3 - -nv4_t1: - node_id: 15 - k: 'testing' - v: 'added in node version 3' - version: 4 - -nv4_t2: - node_id: 15 - k: 'testing two' - v: 'modified in node version 4' - version: 4 - -public_v_t1: - node_id: 16 - k: 'testvisible' - v: 'yes' - version: 1 - -nwnv1_name: - node_id: 18 - k: 'name' - v: 'Test Node' - version: 1 - -nwnv1_name_pt: - node_id: 18 - k: 'name:pt' - v: 'Nó teste' - version: 1 - -nwnv1_building: - node_id: 18 - k: 'building' - v: 'yes' - version: 1 - -nwnv1_tourism: - node_id: 18 - k: 'tourism' - v: 'museum' - version: 1 - -nwnv1_shop: - node_id: 18 - k: 'shop' - v: 'gift' - version: 1 - -nwnv2_name: - node_id: 18 - k: 'name' - v: 'Test Node' - version: 2 - -nwnv2_name_pt: - node_id: 18 - k: 'name:pt' - v: 'Nó teste' - version: 2 - -nwnv2_building: - node_id: 18 - k: 'building' - v: 'yes' - version: 2 - -nwnv2_tourism: - node_id: 18 - k: 'tourism' - v: 'museum' - version: 2 - -nwnv2_shop: - node_id: 18 - k: 'shop' - v: 'gift' - version: 2 diff --git a/test/fixtures/relation_tags.yml b/test/fixtures/relation_tags.yml deleted file mode 100644 index daf3c6d0a..000000000 --- a/test/fixtures/relation_tags.yml +++ /dev/null @@ -1,77 +0,0 @@ -t1: - relation_id: 1 - k: 'test' - v: 'yes' - version: 1 - -t2: - relation_id: 2 - k: 'test' - v: 'yes' - version: 1 - -t3: - relation_id: 3 - k: 'test' - v: 'yes' - version: 1 - -t3_2: - relation_id: 3 - k: 'name' - v: 'Test Relation' - version: 1 - -mt_1: - relation_id: 4 - k: 'tag1' - v: 'val1' - version: 1 - -mt_2: - relation_id: 4 - k: 'tag2' - v: 'val2' - version: 1 - -mt_3: - relation_id: 4 - k: 'tag3' - v: 'val3' - version: 1 - -mt_4: - relation_id: 4 - k: 'tag4' - v: 'val4' - version: 1 - -rv3_t1: - relation_id: 8 - k: 'testing' - v: 'added in relation version 3' - version: 3 - -rv3_t2: - relation_id: 8 - k: 'testing two' - v: 'added in relation version 3' - version: 3 - -rv3_t3: - relation_id: 8 - k: 'testing three' - v: 'added in relation version 3' - version: 3 - -rv4_t1: - relation_id: 8 - k: 'testing' - v: 'added in relation version 3' - version: 4 - -rv4_t2: - relation_id: 8 - k: 'testing two' - v: 'modified in relation version 4' - version: 4 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index bee5aa282..18b33f6bf 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -333,3 +333,17 @@ second_gravatar_user: terms_agreed: "2010-01-01 11:22:33" terms_seen: true creation_ip: "1.2.3.4" + +wikipedia_user: + id: 25 + email: wikipedia-user@example.com + status: active + pass_crypt: <%= Digest::MD5.hexdigest('test') %> + creation_time: "2008-05-01 01:23:45" + display_name: wikipediauser + data_public: true + auth_provider: wikipedia + auth_uid: 123456789 + terms_agreed: "2010-01-01 11:22:33" + terms_seen: true + languages: en diff --git a/test/fixtures/way_tags.yml b/test/fixtures/way_tags.yml deleted file mode 100644 index 3361f74cb..000000000 --- a/test/fixtures/way_tags.yml +++ /dev/null @@ -1,77 +0,0 @@ -t1: - way_id: 1 - k: 'test' - v: 'yes' - version: 1 - -t2: - way_id: 2 - k: 'test' - v: 'yes' - version: 1 - -t3: - way_id: 3 - k: 'test' - v: 'yes' - version: 1 - -t3_t2: - way_id: 3 - k: 'name' - v: 'Test Way' - version: 1 - -wv3_t1: - way_id: 4 - k: 'testing' - v: 'added in way version 3' - version: 3 - -wv3_t2: - way_id: 4 - k: 'testing two' - v: 'added in way version 3' - version: 3 - -wv3_t3: - way_id: 4 - k: 'testing three' - v: 'added in way version 3' - version: 3 - -wv4_t1: - way_id: 4 - k: 'testing' - v: 'added in way version 3' - version: 4 - -wv4_t2: - way_id: 4 - k: 'testing two' - v: 'modified in way version 4' - version: 4 - -t6_v1: - way_id: 6 - k: 'test' - v: 'yes' - version: 1 - -t6_v2: - way_id: 6 - k: 'test' - v: 'yes' - version: 2 - -t6_v3: - way_id: 6 - k: 'test' - v: 'yes' - version: 3 - -t6_v4: - way_id: 6 - k: 'test' - v: 'yes' - version: 4 diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 97b35467b..a25bae99d 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -183,9 +183,7 @@ class ApplicationHelperTest < ActionView::TestCase assert_match %r{^4 months$}, date end - def test_body_class - end + def test_body_class; end - def test_current_page_class - end + def test_current_page_class; end end diff --git a/test/helpers/browse_helper_test.rb b/test/helpers/browse_helper_test.rb index 798c69b43..32cf96c6b 100644 --- a/test/helpers/browse_helper_test.rb +++ b/test/helpers/browse_helper_test.rb @@ -17,6 +17,12 @@ class BrowseHelperTest < ActionView::TestCase end def test_printable_name + add_tags_selection(current_nodes(:node_with_name)) + create(:node_tag, :node => current_nodes(:node_with_ref_without_name), :k => "ref", :v => "3.1415926") + add_old_tags_selection(nodes(:node_with_name_current_version)) + add_old_tags_selection(nodes(:node_with_name_redacted_version)) + + # current_nodes(:redacted_node) is deleted, so has no tags. assert_dom_equal "17", printable_name(current_nodes(:redacted_node)) assert_dom_equal "Test Node (18)", printable_name(current_nodes(:node_with_name)) assert_dom_equal "Test Node (18)", printable_name(nodes(:node_with_name_current_version)) @@ -57,19 +63,29 @@ class BrowseHelperTest < ActionView::TestCase end def test_link_class + add_tags_selection(current_nodes(:node_with_name)) + assert_equal "node", link_class("node", current_nodes(:visible_node)) assert_equal "node deleted", link_class("node", current_nodes(:invisible_node)) assert_equal "node deleted", link_class("node", current_nodes(:redacted_node)) assert_equal "node building yes shop gift tourism museum", link_class("node", current_nodes(:node_with_name)) + + add_old_tags_selection(nodes(:node_with_name_current_version)) + add_old_tags_selection(nodes(:node_with_name_redacted_version)) assert_equal "node building yes shop gift tourism museum", link_class("node", nodes(:node_with_name_current_version)) assert_equal "node deleted", link_class("node", nodes(:node_with_name_redacted_version)) end def test_link_title + add_tags_selection(current_nodes(:node_with_name)) + assert_equal "", link_title(current_nodes(:visible_node)) assert_equal "", link_title(current_nodes(:invisible_node)) assert_equal "", link_title(current_nodes(:redacted_node)) assert_equal "building=yes, shop=gift, and tourism=museum", link_title(current_nodes(:node_with_name)) + + add_old_tags_selection(nodes(:node_with_name_current_version)) + add_old_tags_selection(nodes(:node_with_name_redacted_version)) assert_equal "building=yes, shop=gift, and tourism=museum", link_title(nodes(:node_with_name_current_version)) assert_equal "", link_title(nodes(:node_with_name_redacted_version)) end @@ -106,12 +122,17 @@ class BrowseHelperTest < ActionView::TestCase end def test_icon_tags + add_tags_selection(current_nodes(:node_with_name)) + tags = icon_tags(current_nodes(:node_with_name)) assert_equal 3, tags.count assert tags.include?(%w(building yes)) assert tags.include?(%w(tourism museum)) assert tags.include?(%w(shop gift)) + add_old_tags_selection(nodes(:node_with_name_current_version)) + add_old_tags_selection(nodes(:node_with_name_redacted_version)) + tags = icon_tags(nodes(:node_with_name_current_version)) assert_equal 3, tags.count assert tags.include?(%w(building yes)) @@ -306,4 +327,24 @@ class BrowseHelperTest < ActionView::TestCase link = telephone_link("phone", "+1 (234) 567-890") assert_equal "tel:+1(234)567-890", link end + + def add_old_tags_selection(old_node) + { "building" => "yes", + "shop" => "gift", + "tourism" => "museum", + "name" => "Test Node", + "name:pt" => "Nó teste" }.each do |key, value| + create(:old_node_tag, :old_node => old_node, :k => key, :v => value) + end + end + + def add_tags_selection(node) + { "building" => "yes", + "shop" => "gift", + "tourism" => "museum", + "name" => "Test Node", + "name:pt" => "Nó teste" }.each do |key, value| + create(:node_tag, :node => node, :k => key, :v => value) + end + end end diff --git a/test/integration/oauth_test.rb b/test/integration/oauth_test.rb index 2452e6e6b..c10699f2a 100644 --- a/test/integration/oauth_test.rb +++ b/test/integration/oauth_test.rb @@ -333,7 +333,7 @@ class OAuthTest < ActionDispatch::IntegrationTest assert_not_nil token.created_at assert_nil token.authorized_at assert_nil token.invalidated_at - assert_equal options[:oauth_callback], token.callback_url + assert_equal_allowing_nil options[:oauth_callback], token.callback_url assert_allowed token, client.permissions token diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index cdf4fcfe9..db35be5f3 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -19,6 +19,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest OmniAuth.config.mock_auth[:facebook] = nil OmniAuth.config.mock_auth[:windowslive] = nil OmniAuth.config.mock_auth[:github] = nil + OmniAuth.config.mock_auth[:wikipedia] = nil OmniAuth.config.test_mode = false end @@ -725,4 +726,117 @@ class UserCreationTest < ActionDispatch::IntegrationTest assert_response :success assert_template "site/welcome" end + + def test_user_create_wikipedia_success + OmniAuth.config.add_mock(:wikipedia, :uid => "123454321") + + new_email = "newtester-wikipedia@osm.org" + display_name = "new_tester-wikipedia" + password = "testtest" + assert_difference("User.count") do + assert_difference("ActionMailer::Base.deliveries.size", 1) do + post "/user/new", + :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :auth_provider => "wikipedia", :pass_crypt => "", :pass_crypt_confirmation => "" } + assert_response :redirect + assert_redirected_to auth_path(:provider => "wikipedia", :origin => "/user/new") + follow_redirect! + assert_response :redirect + assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new") + follow_redirect! + assert_response :redirect + assert_redirected_to "/user/terms" + post "/user/save", + :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :auth_provider => "wikipedia", :auth_uid => "123454321", :pass_crypt => password, :pass_crypt_confirmation => password } + assert_response :redirect + follow_redirect! + end + end + + # Check the page + assert_response :success + assert_template "user/confirm" + + ActionMailer::Base.deliveries.clear + end + + def test_user_create_wikipedia_failure + OmniAuth.config.mock_auth[:wikipedia] = :connection_failed + + new_email = "newtester-wikipedia2@osm.org" + display_name = "new_tester-wikipedia2" + assert_difference("User.count", 0) do + assert_difference("ActionMailer::Base.deliveries.size", 0) do + post "/user/new", + :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :auth_provider => "wikipedia", :pass_crypt => "", :pass_crypt_confirmation => "" } + assert_response :redirect + assert_redirected_to auth_path(:provider => "wikipedia", :origin => "/user/new") + follow_redirect! + assert_response :redirect + assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new") + follow_redirect! + assert_response :redirect + assert_redirected_to auth_failure_path(:strategy => "wikipedia", :message => "connection_failed", :origin => "/user/new") + follow_redirect! + assert_response :redirect + follow_redirect! + assert_response :success + assert_template "user/new" + end + end + + ActionMailer::Base.deliveries.clear + end + + def test_user_create_wikipedia_redirect + OmniAuth.config.add_mock(:wikipedia, :uid => "123454321") + + new_email = "redirect_tester_wikipedia@osm.org" + display_name = "redirect_tester_wikipedia" + # nothing special about this page, just need a protected page to redirect back to. + referer = "/traces/mine" + assert_difference("User.count") do + assert_difference("ActionMailer::Base.deliveries.size", 1) do + post "/user/new", + :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :auth_provider => "wikipedia", :pass_crypt => "", :pass_crypt_confirmation => "" }, :referer => referer + assert_response :redirect + assert_redirected_to auth_path(:provider => "wikipedia", :origin => "/user/new") + follow_redirect! + assert_response :redirect + assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/user/new") + follow_redirect! + assert_response :redirect + assert_redirected_to "/user/terms" + post_via_redirect "/user/save", + :user => { :email => new_email, :email_confirmation => new_email, :display_name => display_name, :auth_provider => "wikipedia", :auth_uid => "http://localhost:1123/new.tester", :pass_crypt => "testtest", :pass_crypt_confirmation => "testtest" } + end + end + + # Check the e-mail + register_email = ActionMailer::Base.deliveries.first + + assert_equal register_email.to[0], new_email + # Check that the confirm account url is correct + confirm_regex = Regexp.new("/user/redirect_tester_wikipedia/confirm\\?confirm_string=([a-zA-Z0-9]*)") + register_email.parts.each do |part| + assert_match confirm_regex, part.body.to_s + end + confirm_string = register_email.parts[0].body.match(confirm_regex)[1] + + # Check the page + assert_response :success + assert_template "user/confirm" + + ActionMailer::Base.deliveries.clear + + # Go to the confirmation page + get "/user/#{display_name}/confirm", :confirm_string => confirm_string + assert_response :success + assert_template "user/confirm" + + post "/user/#{display_name}/confirm", :confirm_string => confirm_string + assert_response :redirect + follow_redirect! + assert_response :success + assert_template "site/welcome" + end end diff --git a/test/integration/user_login_test.rb b/test/integration/user_login_test.rb index d027334d0..e442eba68 100644 --- a/test/integration/user_login_test.rb +++ b/test/integration/user_login_test.rb @@ -13,6 +13,7 @@ class UserLoginTest < ActionDispatch::IntegrationTest OmniAuth.config.mock_auth[:facebook] = nil OmniAuth.config.mock_auth[:windowslive] = nil OmniAuth.config.mock_auth[:github] = nil + OmniAuth.config.mock_auth[:wikipedia] = nil OmniAuth.config.test_mode = false end @@ -824,6 +825,94 @@ class UserLoginTest < ActionDispatch::IntegrationTest assert_select "span.username", false end + def test_login_wikipedia_success + OmniAuth.config.add_mock(:wikipedia, :uid => "123456789") + + get "/login", :referer => "/history" + assert_response :redirect + assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + follow_redirect! + assert_response :success + assert_template "user/login" + get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_response :redirect + assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + follow_redirect! + assert_response :redirect + follow_redirect! + assert_response :success + assert_template "changeset/history" + assert_select "span.username", "wikipediauser" + end + + def test_login_wikipedia_connection_failed + OmniAuth.config.mock_auth[:wikipedia] = :connection_failed + + get "/login", :referer => "/history" + assert_response :redirect + assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + follow_redirect! + assert_response :success + assert_template "user/login" + get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_response :redirect + assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + follow_redirect! + assert_response :redirect + assert_redirected_to auth_failure_path(:strategy => "wikipedia", :message => "connection_failed", :origin => "/login?referer=%2Fhistory") + follow_redirect! + assert_response :redirect + follow_redirect! + assert_response :success + assert_template "login" + assert_select "div.flash.error", "Connection to authentication provider failed" + assert_select "span.username", false + end + + def test_login_wikipedia_invalid_credentials + OmniAuth.config.mock_auth[:wikipedia] = :invalid_credentials + + get "/login", :referer => "/history" + assert_response :redirect + assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + follow_redirect! + assert_response :success + assert_template "user/login" + get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_response :redirect + assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + follow_redirect! + assert_response :redirect + assert_redirected_to auth_failure_path(:strategy => "wikipedia", :message => "invalid_credentials", :origin => "/login?referer=%2Fhistory") + follow_redirect! + assert_response :redirect + follow_redirect! + assert_response :success + assert_template "login" + assert_select "div.flash.error", "Invalid authentication credentials" + assert_select "span.username", false + end + + def test_login_wikipedia_unknown + OmniAuth.config.add_mock(:wikipedia, :uid => "987654321") + + get "/login", :referer => "/history" + assert_response :redirect + assert_redirected_to "controller" => "user", "action" => "login", "cookie_test" => "true", "referer" => "/history" + follow_redirect! + assert_response :success + assert_template "user/login" + get auth_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + assert_response :redirect + assert_redirected_to auth_success_path(:provider => "wikipedia", :origin => "/login?referer=%2Fhistory", :referer => "/history") + follow_redirect! + assert_response :redirect + follow_redirect! + assert_response :success + assert_template "user/new" + assert_select "span.username", false + end + private def try_password_login(username, password, remember_me = nil) diff --git a/test/lib/bounding_box_test.rb b/test/lib/bounding_box_test.rb index 5fb81a4cb..dc62531f5 100644 --- a/test/lib/bounding_box_test.rb +++ b/test/lib/bounding_box_test.rb @@ -312,9 +312,9 @@ class BoundingBoxTest < ActiveSupport::TestCase end def check_bbox(bbox, result) - assert_equal result[0], bbox.min_lon, "min_lon" - assert_equal result[1], bbox.min_lat, "min_lat" - assert_equal result[2], bbox.max_lon, "max_lon" - assert_equal result[3], bbox.max_lat, "max_lat" + assert_equal_allowing_nil result[0], bbox.min_lon, "min_lon" + assert_equal_allowing_nil result[1], bbox.min_lat, "min_lat" + assert_equal_allowing_nil result[2], bbox.max_lon, "max_lon" + assert_equal_allowing_nil result[3], bbox.max_lat, "max_lat" end end diff --git a/test/lib/locale_test.rb b/test/lib/locale_test.rb index a100515c8..65c7ea398 100644 --- a/test/lib/locale_test.rb +++ b/test/lib/locale_test.rb @@ -32,39 +32,39 @@ class LocaleTest < ActiveSupport::TestCase end def test_script - assert_equal EN.script, Locale.tag("en").script - assert_equal EN_GB.script, Locale.tag("en-GB").script - assert_equal FR.script, Locale.tag("fr").script - assert_equal ZH_HANS.script, Locale.tag("zh-Hans").script - assert_equal ZH_HANT_TW.script, Locale.tag("zh-Hant-TW").script - assert_equal ZH_YUE.script, Locale.tag("zh-yue").script - assert_equal ZH_YUE.script, Locale.tag("zh-YUE").script - assert_equal BE_TARASK.script, Locale.tag("be-tarask").script - assert_equal BE_TARASK.script, Locale.tag("be-Tarask").script + assert_equal_allowing_nil EN.script, Locale.tag("en").script + assert_equal_allowing_nil EN_GB.script, Locale.tag("en-GB").script + assert_equal_allowing_nil FR.script, Locale.tag("fr").script + assert_equal_allowing_nil ZH_HANS.script, Locale.tag("zh-Hans").script + assert_equal_allowing_nil ZH_HANT_TW.script, Locale.tag("zh-Hant-TW").script + assert_equal_allowing_nil ZH_YUE.script, Locale.tag("zh-yue").script + assert_equal_allowing_nil ZH_YUE.script, Locale.tag("zh-YUE").script + assert_equal_allowing_nil BE_TARASK.script, Locale.tag("be-tarask").script + assert_equal_allowing_nil BE_TARASK.script, Locale.tag("be-Tarask").script end def test_region - assert_equal EN.region, Locale.tag("en").region - assert_equal EN_GB.region, Locale.tag("en-GB").region - assert_equal FR.region, Locale.tag("fr").region - assert_equal ZH_HANS.region, Locale.tag("zh-Hans").region - assert_equal ZH_HANT_TW.region, Locale.tag("zh-Hant-TW").region - assert_equal ZH_YUE.region, Locale.tag("zh-yue").region - assert_equal ZH_YUE.region, Locale.tag("zh-YUE").region - assert_equal BE_TARASK.region, Locale.tag("be-tarask").region - assert_equal BE_TARASK.region, Locale.tag("be-Tarask").region + assert_equal_allowing_nil EN.region, Locale.tag("en").region + assert_equal_allowing_nil EN_GB.region, Locale.tag("en-GB").region + assert_equal_allowing_nil FR.region, Locale.tag("fr").region + assert_equal_allowing_nil ZH_HANS.region, Locale.tag("zh-Hans").region + assert_equal_allowing_nil ZH_HANT_TW.region, Locale.tag("zh-Hant-TW").region + assert_equal_allowing_nil ZH_YUE.region, Locale.tag("zh-yue").region + assert_equal_allowing_nil ZH_YUE.region, Locale.tag("zh-YUE").region + assert_equal_allowing_nil BE_TARASK.region, Locale.tag("be-tarask").region + assert_equal_allowing_nil BE_TARASK.region, Locale.tag("be-Tarask").region end def test_variant - assert_equal EN.variant, Locale.tag("en").variant - assert_equal EN_GB.variant, Locale.tag("en-GB").variant - assert_equal FR.variant, Locale.tag("fr").variant - assert_equal ZH_HANS.variant, Locale.tag("zh-Hans").variant - assert_equal ZH_HANT_TW.variant, Locale.tag("zh-Hant-TW").variant - assert_equal ZH_YUE.variant, Locale.tag("zh-yue").variant - assert_equal ZH_YUE.variant, Locale.tag("zh-YUE").variant - assert_equal BE_TARASK.variant, Locale.tag("be-tarask").variant - assert_equal BE_TARASK.variant, Locale.tag("be-Tarask").variant + assert_equal_allowing_nil EN.variant, Locale.tag("en").variant + assert_equal_allowing_nil EN_GB.variant, Locale.tag("en-GB").variant + assert_equal_allowing_nil FR.variant, Locale.tag("fr").variant + assert_equal_allowing_nil ZH_HANS.variant, Locale.tag("zh-Hans").variant + assert_equal_allowing_nil ZH_HANT_TW.variant, Locale.tag("zh-Hant-TW").variant + assert_equal_allowing_nil ZH_YUE.variant, Locale.tag("zh-yue").variant + assert_equal_allowing_nil ZH_YUE.variant, Locale.tag("zh-YUE").variant + assert_equal_allowing_nil BE_TARASK.variant, Locale.tag("be-tarask").variant + assert_equal_allowing_nil BE_TARASK.variant, Locale.tag("be-Tarask").variant end def test_list diff --git a/test/lib/password_hash_test.rb b/test/lib/password_hash_test.rb index c481cc767..6f54a0d7a 100644 --- a/test/lib/password_hash_test.rb +++ b/test/lib/password_hash_test.rb @@ -14,6 +14,20 @@ class PasswordHashTest < ActiveSupport::TestCase assert_equal true, PasswordHash.upgrade?("67a1e09bb1f83f5007dc119c14d663aa", "salt") end + def test_pbkdf2_1000_32_sha512 + assert_equal true, PasswordHash.check("ApT/28+FsTBLa/J8paWfgU84SoRiTfeY8HjKWhgHy08=", "sha512!1000!HR4z+hAvKV2ra1gpbRybtoNzm/CNKe4cf7bPKwdUNrk=", "password") + assert_equal false, PasswordHash.check("ApT/28+FsTBLa/J8paWfgU84SoRiTfeY8HjKWhgHy08=", "sha512!1000!HR4z+hAvKV2ra1gpbRybtoNzm/CNKe4cf7bPKwdUNrk=", "wrong") + assert_equal false, PasswordHash.check("ApT/28+FsTBLa/J8paWfgU84SoRiTfeY8HjKWhgHy08=", "sha512!1000!HR4z+hAvKV2ra1gwrongtoNzm/CNKe4cf7bPKwdUNrk=", "password") + assert_equal true, PasswordHash.upgrade?("ApT/28+FsTBLa/J8paWfgU84SoRiTfeY8HjKWhgHy08=", "sha512!1000!HR4z+hAvKV2ra1gpbRybtoNzm/CNKe4cf7bPKwdUNrk=") + end + + def test_pbkdf2_10000_32_sha512 + assert_equal true, PasswordHash.check("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtM7eD8huvanFT5/WtWaCwdOdrir8QOtFwxhO0A=", "password") + assert_equal false, PasswordHash.check("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtM7eD8huvanFT5/WtWaCwdOdrir8QOtFwxhO0A=", "wrong") + assert_equal false, PasswordHash.check("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtMwronguvanFT5/WtWaCwdOdrir8QOtFwxhO0A=", "password") + assert_equal false, PasswordHash.upgrade?("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtM7eD8huvanFT5/WtWaCwdOdrir8QOtFwxhO0A=") + end + def test_default hash1, salt1 = PasswordHash.create("password") hash2, salt2 = PasswordHash.create("password") diff --git a/test/models/node_tag_test.rb b/test/models/node_tag_test.rb index 0196b6fef..f1d8750a0 100644 --- a/test/models/node_tag_test.rb +++ b/test/models/node_tag_test.rb @@ -3,62 +3,34 @@ require "test_helper" class NodeTagTest < ActiveSupport::TestCase api_fixtures - def test_tag_count - assert_equal 13, NodeTag.count - node_tag_count(:visible_node, 1) - node_tag_count(:invisible_node, 1) - node_tag_count(:used_node_1, 1) - node_tag_count(:used_node_2, 1) - node_tag_count(:node_with_versions, 2) - end - - def node_tag_count(node, count) - nod = current_nodes(node) - assert_equal count, nod.node_tags.count - end - def test_length_key_valid - key = "k" + tag = create(:node_tag) (0..255).each do |i| - tag = NodeTag.new - tag.node_id = current_node_tags(:t1).node_id - tag.k = key * i - tag.v = "v" + tag.k = "k" * i assert tag.valid? end end def test_length_value_valid - val = "v" + tag = create(:node_tag) (0..255).each do |i| - tag = NodeTag.new - tag.node_id = current_node_tags(:t1).node_id - tag.k = "k" - tag.v = val * i + tag.v = "v" * i assert tag.valid? end end def test_length_key_invalid - ["k" * 256].each do |i| - tag = NodeTag.new - tag.node_id = current_node_tags(:t1).node_id - tag.k = i - tag.v = "v" - assert !tag.valid?, "Key should be too long" - assert tag.errors[:k].any? - end + tag = create(:node_tag) + tag.k = "k" * 256 + assert !tag.valid?, "Key should be too long" + assert tag.errors[:k].any? end def test_length_value_invalid - ["k" * 256].each do |i| - tag = NodeTag.new - tag.node_id = current_node_tags(:t1).node_id - tag.k = "k" - tag.v = i - assert !tag.valid?, "Value should be too long" - assert tag.errors[:v].any? - end + tag = create(:node_tag) + tag.v = "v" * 256 + assert !tag.valid?, "Value should be too long" + assert tag.errors[:v].any? end def test_empty_node_tag_invalid @@ -68,10 +40,11 @@ class NodeTagTest < ActiveSupport::TestCase end def test_uniqueness + existing = create(:node_tag) tag = NodeTag.new - tag.node_id = current_node_tags(:t1).node_id - tag.k = current_node_tags(:t1).k - tag.v = current_node_tags(:t1).v + tag.node_id = existing.node_id + tag.k = existing.k + tag.v = existing.v assert tag.new_record? assert !tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } diff --git a/test/models/node_test.rb b/test/models/node_test.rb index ff833d0ed..7d43362d2 100644 --- a/test/models/node_test.rb +++ b/test/models/node_test.rb @@ -316,20 +316,23 @@ class NodeTest < ActiveSupport::TestCase def test_node_tags node = current_nodes(:node_with_versions) + taglist = create_list(:node_tag, 2, :node => node) tags = Node.find(node.id).node_tags.order(:k) - assert_equal 2, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in node version 3", tags[0].v - assert_equal "testing two", tags[1].k - assert_equal "modified in node version 4", tags[1].v + assert_equal taglist.count, tags.count + taglist.sort_by!(&:k).each_index do |i| + assert_equal taglist[i].k, tags[i].k + assert_equal taglist[i].v, tags[i].v + end end def test_tags node = current_nodes(:node_with_versions) + taglist = create_list(:node_tag, 2, :node => node) tags = Node.find(node.id).tags - assert_equal 2, tags.size - assert_equal "added in node version 3", tags["testing"] - assert_equal "modified in node version 4", tags["testing two"] + assert_equal taglist.count, tags.count + taglist.each do |tag| + assert_equal tag.v, tags[tag.k] + end end def test_containing_relation_members diff --git a/test/models/old_node_tag_test.rb b/test/models/old_node_tag_test.rb index 2ac60ab42..f49be9256 100644 --- a/test/models/old_node_tag_test.rb +++ b/test/models/old_node_tag_test.rb @@ -3,56 +3,34 @@ require "test_helper" class OldNodeTagTest < ActiveSupport::TestCase api_fixtures - def test_old_node_tag_count - assert_equal 19, OldNodeTag.count, "Unexpected number of fixtures loaded." - end - def test_length_key_valid - key = "k" + tag = create(:old_node_tag) (0..255).each do |i| - tag = OldNodeTag.new - tag.node_id = node_tags(:t1).node_id - tag.version = node_tags(:t1).version - tag.k = key * i - tag.v = "v" + tag.k = "k" * i assert tag.valid? end end def test_length_value_valid - val = "v" + tag = create(:old_node_tag) (0..255).each do |i| - tag = OldNodeTag.new - tag.node_id = node_tags(:t1).node_id - tag.version = node_tags(:t1).version - tag.k = "k" - tag.v = val * i + tag.v = "v" * i assert tag.valid? end end def test_length_key_invalid - ["k" * 256].each do |i| - tag = OldNodeTag.new - tag.node_id = node_tags(:t1).node_id - tag.version = node_tags(:t1).version - tag.k = i - tag.v = "v", "Key should be too long" - assert !tag.valid? - assert tag.errors[:k].any? - end + tag = create(:old_node_tag) + tag.k = "k" * 256 + assert !tag.valid? + assert tag.errors[:k].any? end def test_length_value_invalid - ["k" * 256].each do |i| - tag = OldNodeTag.new - tag.node_id = node_tags(:t1).node_id - tag.version = node_tags(:t1).version - tag.k = "k" - tag.v = i - assert !tag.valid?, "Value should be too long" - assert tag.errors[:v].any? - end + tag = create(:old_node_tag) + tag.v = "v" * 256 + assert !tag.valid?, "Value should be too long" + assert tag.errors[:v].any? end def test_empty_tag_invalid @@ -62,11 +40,12 @@ class OldNodeTagTest < ActiveSupport::TestCase end def test_uniqueness + existing = create(:old_node_tag) tag = OldNodeTag.new - tag.node_id = node_tags(:t1).node_id - tag.version = node_tags(:t1).version - tag.k = node_tags(:t1).k - tag.v = node_tags(:t1).v + tag.node_id = existing.node_id + tag.version = existing.version + tag.k = existing.k + tag.v = existing.v assert tag.new_record? assert !tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } diff --git a/test/models/old_node_test.rb b/test/models/old_node_test.rb index 03aead2e9..d7e363edb 100644 --- a/test/models/old_node_test.rb +++ b/test/models/old_node_test.rb @@ -76,6 +76,9 @@ class OldNodeTest < ActiveSupport::TestCase end def test_node_tags + taglist_v3 = create_list(:old_node_tag, 3, :old_node => nodes(:node_with_versions_v3)) + taglist_v4 = create_list(:old_node_tag, 2, :old_node => nodes(:node_with_versions_v4)) + node = nodes(:node_with_versions_v1) tags = OldNode.find(node.id).old_tags.order(:k) assert_equal 0, tags.count @@ -86,24 +89,25 @@ class OldNodeTest < ActiveSupport::TestCase node = nodes(:node_with_versions_v3) tags = OldNode.find(node.id).old_tags.order(:k) - assert_equal 3, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in node version 3", tags[0].v - assert_equal "testing three", tags[1].k - assert_equal "added in node version 3", tags[1].v - assert_equal "testing two", tags[2].k - assert_equal "added in node version 3", tags[2].v + assert_equal taglist_v3.count, tags.count + taglist_v3.sort_by!(&:k).each_index do |i| + assert_equal taglist_v3[i].k, tags[i].k + assert_equal taglist_v3[i].v, tags[i].v + end node = nodes(:node_with_versions_v4) tags = OldNode.find(node.id).old_tags.order(:k) - assert_equal 2, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in node version 3", tags[0].v - assert_equal "testing two", tags[1].k - assert_equal "modified in node version 4", tags[1].v + assert_equal taglist_v4.count, tags.count + taglist_v4.sort_by!(&:k).each_index do |i| + assert_equal taglist_v4[i].k, tags[i].k + assert_equal taglist_v4[i].v, tags[i].v + end end def test_tags + taglist_v3 = create_list(:old_node_tag, 3, :old_node => nodes(:node_with_versions_v3)) + taglist_v4 = create_list(:old_node_tag, 2, :old_node => nodes(:node_with_versions_v4)) + node = nodes(:node_with_versions_v1) tags = OldNode.find(node.id).tags assert_equal 0, tags.size @@ -114,15 +118,16 @@ class OldNodeTest < ActiveSupport::TestCase node = nodes(:node_with_versions_v3) tags = OldNode.find(node.id).tags - assert_equal 3, tags.size - assert_equal "added in node version 3", tags["testing"] - assert_equal "added in node version 3", tags["testing two"] - assert_equal "added in node version 3", tags["testing three"] + assert_equal taglist_v3.count, tags.count + taglist_v3.each do |tag| + assert_equal tag.v, tags[tag.k] + end node = nodes(:node_with_versions_v4) tags = OldNode.find(node.id).tags - assert_equal 2, tags.size - assert_equal "added in node version 3", tags["testing"] - assert_equal "modified in node version 4", tags["testing two"] + assert_equal taglist_v4.count, tags.count + taglist_v4.each do |tag| + assert_equal tag.v, tags[tag.k] + end end end diff --git a/test/models/old_relation_tag_test.rb b/test/models/old_relation_tag_test.rb index 2c9638a2d..5c27ef3ea 100644 --- a/test/models/old_relation_tag_test.rb +++ b/test/models/old_relation_tag_test.rb @@ -3,56 +3,34 @@ require "test_helper" class OldRelationTagTest < ActiveSupport::TestCase api_fixtures - def test_tag_count - assert_equal 13, OldRelationTag.count - end - def test_length_key_valid - key = "k" + tag = create(:old_relation_tag) (0..255).each do |i| - tag = OldRelationTag.new - tag.relation_id = relation_tags(:t1).relation_id - tag.version = 1 - tag.k = key * i - tag.v = "v" + tag.k = "k" * i assert tag.valid? end end def test_length_value_valid - val = "v" + tag = create(:old_relation_tag) (0..255).each do |i| - tag = OldRelationTag.new - tag.relation_id = relation_tags(:t1).relation_id - tag.version = 1 - tag.k = "k" - tag.v = val * i + tag.v = "v" * i assert tag.valid? end end def test_length_key_invalid - ["k" * 256].each do |i| - tag = OldRelationTag.new - tag.relation_id = relation_tags(:t1).relation_id - tag.version = 1 - tag.k = i - tag.v = "v" - assert !tag.valid?, "Key should be too long" - assert tag.errors[:k].any? - end + tag = create(:old_relation_tag) + tag.k = "k" * 256 + assert !tag.valid?, "Key should be too long" + assert tag.errors[:k].any? end def test_length_value_invalid - ["k" * 256].each do |i| - tag = OldRelationTag.new - tag.relation_id = relation_tags(:t1).relation_id - tag.version = 1 - tag.k = "k" - tag.v = i - assert !tag.valid?, "Value should be too long" - assert tag.errors[:v].any? - end + tag = create(:old_relation_tag) + tag.v = "v" * 256 + assert !tag.valid?, "Value should be too long" + assert tag.errors[:v].any? end def test_empty_tag_invalid @@ -62,11 +40,12 @@ class OldRelationTagTest < ActiveSupport::TestCase end def test_uniqueness + existing = create(:old_relation_tag) tag = OldRelationTag.new - tag.relation_id = relation_tags(:t1).relation_id - tag.version = relation_tags(:t1).version - tag.k = relation_tags(:t1).k - tag.v = relation_tags(:t1).v + tag.relation_id = existing.relation_id + tag.version = existing.version + tag.k = existing.k + tag.v = existing.v assert tag.new_record? assert !tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } diff --git a/test/models/old_relation_test.rb b/test/models/old_relation_test.rb index c11cdcf72..d2aa4b6b6 100644 --- a/test/models/old_relation_test.rb +++ b/test/models/old_relation_test.rb @@ -8,6 +8,9 @@ class OldRelationTest < ActiveSupport::TestCase end def test_relation_tags + taglist_v3 = create_list(:old_relation_tag, 3, :old_relation => relations(:relation_with_versions_v3)) + taglist_v4 = create_list(:old_relation_tag, 2, :old_relation => relations(:relation_with_versions_v4)) + relation = relations(:relation_with_versions_v1) tags = OldRelation.find(relation.id).old_tags.order(:k) assert_equal 0, tags.count @@ -18,21 +21,19 @@ class OldRelationTest < ActiveSupport::TestCase relation = relations(:relation_with_versions_v3) tags = OldRelation.find(relation.id).old_tags.order(:k) - assert_equal 3, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in relation version 3", tags[0].v - assert_equal "testing three", tags[1].k - assert_equal "added in relation version 3", tags[1].v - assert_equal "testing two", tags[2].k - assert_equal "added in relation version 3", tags[2].v + assert_equal taglist_v3.count, tags.count + taglist_v3.sort_by!(&:k).each_index do |i| + assert_equal taglist_v3[i].k, tags[i].k + assert_equal taglist_v3[i].v, tags[i].v + end relation = relations(:relation_with_versions_v4) tags = OldRelation.find(relation.id).old_tags.order(:k) - assert_equal 2, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in relation version 3", tags[0].v - assert_equal "testing two", tags[1].k - assert_equal "modified in relation version 4", tags[1].v + assert_equal taglist_v4.count, tags.count + taglist_v4.sort_by!(&:k).each_index do |i| + assert_equal taglist_v4[i].k, tags[i].k + assert_equal taglist_v4[i].v, tags[i].v + end end def test_relation_members @@ -100,6 +101,9 @@ class OldRelationTest < ActiveSupport::TestCase end def test_tags + taglist_v3 = create_list(:old_relation_tag, 3, :old_relation => relations(:relation_with_versions_v3)) + taglist_v4 = create_list(:old_relation_tag, 2, :old_relation => relations(:relation_with_versions_v4)) + relation = relations(:relation_with_versions_v1) tags = OldRelation.find(relation.id).tags assert_equal 0, tags.size @@ -110,15 +114,16 @@ class OldRelationTest < ActiveSupport::TestCase relation = relations(:relation_with_versions_v3) tags = OldRelation.find(relation.id).tags - assert_equal 3, tags.size - assert_equal "added in relation version 3", tags["testing"] - assert_equal "added in relation version 3", tags["testing two"] - assert_equal "added in relation version 3", tags["testing three"] + assert_equal taglist_v3.count, tags.count + taglist_v3.each do |tag| + assert_equal tag.v, tags[tag.k] + end relation = relations(:relation_with_versions_v4) tags = OldRelation.find(relation.id).tags - assert_equal 2, tags.size - assert_equal "added in relation version 3", tags["testing"] - assert_equal "modified in relation version 4", tags["testing two"] + assert_equal taglist_v4.count, tags.count + taglist_v4.each do |tag| + assert_equal tag.v, tags[tag.k] + end end end diff --git a/test/models/old_way_tag_test.rb b/test/models/old_way_tag_test.rb index b8757d572..9a258ffb9 100644 --- a/test/models/old_way_tag_test.rb +++ b/test/models/old_way_tag_test.rb @@ -3,56 +3,34 @@ require "test_helper" class OldWayTagTest < ActiveSupport::TestCase api_fixtures - def test_tag_count - assert_equal 13, OldWayTag.count - end - def test_length_key_valid - key = "k" + tag = create(:old_way_tag) (0..255).each do |i| - tag = OldWayTag.new - tag.way_id = way_tags(:t1).way_id - tag.version = 1 - tag.k = key * i - tag.v = "v" + tag.k = "k" * i assert tag.valid? end end def test_length_value_valid - val = "v" + tag = create(:old_way_tag) (0..255).each do |i| - tag = OldWayTag.new - tag.way_id = way_tags(:t1).way_id - tag.version = 1 - tag.k = "k" - tag.v = val * i + tag.v = "v" * i assert tag.valid? end end def test_length_key_invalid - ["k" * 256].each do |i| - tag = OldWayTag.new - tag.way_id = way_tags(:t1).way_id - tag.version = 1 - tag.k = i - tag.v = "v" - assert !tag.valid?, "Key should be too long" - assert tag.errors[:k].any? - end + tag = create(:old_way_tag) + tag.k = "k" * 256 + assert !tag.valid?, "Key should be too long" + assert tag.errors[:k].any? end def test_length_value_invalid - ["k" * 256].each do |i| - tag = OldWayTag.new - tag.way_id = way_tags(:t1).way_id - tag.version = 1 - tag.k = "k" - tag.v = i - assert !tag.valid?, "Value should be too long" - assert tag.errors[:v].any? - end + tag = create(:old_way_tag) + tag.v = "v" * 256 + assert !tag.valid?, "Value should be too long" + assert tag.errors[:v].any? end def test_empty_tag_invalid @@ -62,11 +40,12 @@ class OldWayTagTest < ActiveSupport::TestCase end def test_uniqueness + existing = create(:old_way_tag) tag = OldWayTag.new - tag.way_id = way_tags(:t1).way_id - tag.version = way_tags(:t1).version - tag.k = way_tags(:t1).k - tag.v = way_tags(:t1).v + tag.way_id = existing.way_id + tag.version = existing.version + tag.k = existing.k + tag.v = existing.v assert tag.new_record? assert !tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } diff --git a/test/models/old_way_test.rb b/test/models/old_way_test.rb index 37dfccad3..84255c880 100644 --- a/test/models/old_way_test.rb +++ b/test/models/old_way_test.rb @@ -38,6 +38,9 @@ class OldWayTest < ActiveSupport::TestCase end def test_way_tags + taglist_v3 = create_list(:old_way_tag, 3, :old_way => ways(:way_with_versions_v3)) + taglist_v4 = create_list(:old_way_tag, 2, :old_way => ways(:way_with_versions_v4)) + way = ways(:way_with_versions_v1) tags = OldWay.find(way.id).old_tags.order(:k) assert_equal 0, tags.count @@ -48,24 +51,25 @@ class OldWayTest < ActiveSupport::TestCase way = ways(:way_with_versions_v3) tags = OldWay.find(way.id).old_tags.order(:k) - assert_equal 3, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in way version 3", tags[0].v - assert_equal "testing three", tags[1].k - assert_equal "added in way version 3", tags[1].v - assert_equal "testing two", tags[2].k - assert_equal "added in way version 3", tags[2].v + assert_equal taglist_v3.count, tags.count + taglist_v3.sort_by!(&:k).each_index do |i| + assert_equal taglist_v3[i].k, tags[i].k + assert_equal taglist_v3[i].v, tags[i].v + end way = ways(:way_with_versions_v4) tags = OldWay.find(way.id).old_tags.order(:k) - assert_equal 2, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in way version 3", tags[0].v - assert_equal "testing two", tags[1].k - assert_equal "modified in way version 4", tags[1].v + assert_equal taglist_v4.count, tags.count + taglist_v4.sort_by!(&:k).each_index do |i| + assert_equal taglist_v4[i].k, tags[i].k + assert_equal taglist_v4[i].v, tags[i].v + end end def test_tags + taglist_v3 = create_list(:old_way_tag, 3, :old_way => ways(:way_with_versions_v3)) + taglist_v4 = create_list(:old_way_tag, 2, :old_way => ways(:way_with_versions_v4)) + way = ways(:way_with_versions_v1) tags = OldWay.find(way.id).tags assert_equal 0, tags.size @@ -76,29 +80,33 @@ class OldWayTest < ActiveSupport::TestCase way = ways(:way_with_versions_v3) tags = OldWay.find(way.id).tags - assert_equal 3, tags.size - assert_equal "added in way version 3", tags["testing"] - assert_equal "added in way version 3", tags["testing two"] - assert_equal "added in way version 3", tags["testing three"] + assert_equal taglist_v3.count, tags.count + taglist_v3.each do |tag| + assert_equal tag.v, tags[tag.k] + end way = ways(:way_with_versions_v4) tags = OldWay.find(way.id).tags - assert_equal 2, tags.size - assert_equal "added in way version 3", tags["testing"] - assert_equal "modified in way version 4", tags["testing two"] + assert_equal taglist_v4.count, tags.count + taglist_v4.each do |tag| + assert_equal tag.v, tags[tag.k] + end end def test_get_nodes_undelete way = ways(:way_with_versions_v3) + node_tag = create(:node_tag, :node => current_nodes(:node_with_versions)) + node_tag2 = create(:node_tag, :node => current_nodes(:used_node_1)) nodes = OldWay.find(way.id).get_nodes_undelete assert_equal 2, nodes.size - assert_equal [1.0, 1.0, 15, 4, { "testing" => "added in node version 3", "testing two" => "modified in node version 4" }, true], nodes[0] - assert_equal [3.0, 3.0, 3, 1, { "test" => "yes" }, true], nodes[1] + assert_equal [1.0, 1.0, 15, 4, { node_tag.k => node_tag.v }, true], nodes[0] + assert_equal [3.0, 3.0, 3, 1, { node_tag2.k => node_tag2.v }, true], nodes[1] way = ways(:way_with_redacted_versions_v2) + node_tag3 = create(:node_tag, :node => current_nodes(:invisible_node)) nodes = OldWay.find(way.id).get_nodes_undelete assert_equal 2, nodes.size - assert_equal [3.0, 3.0, 3, 1, { "test" => "yes" }, true], nodes[0] - assert_equal [2.0, 2.0, 2, 1, { "testused" => "yes" }, false], nodes[1] + assert_equal [3.0, 3.0, 3, 1, { node_tag2.k => node_tag2.v }, true], nodes[0] + assert_equal [2.0, 2.0, 2, 1, { node_tag3.k => node_tag3.v }, false], nodes[1] end end diff --git a/test/models/relation_tag_test.rb b/test/models/relation_tag_test.rb index ef635cc94..f221f78cc 100644 --- a/test/models/relation_tag_test.rb +++ b/test/models/relation_tag_test.rb @@ -3,52 +3,34 @@ require "test_helper" class RelationTagTest < ActiveSupport::TestCase api_fixtures - def test_relation_tag_count - assert_equal 10, RelationTag.count - end - def test_length_key_valid - key = "k" + tag = create(:relation_tag) (0..255).each do |i| - tag = RelationTag.new - tag.relation_id = 1 - tag.k = key * i - tag.v = "v" + tag.k = "k" * i assert tag.valid? end end def test_length_value_valid - val = "v" + tag = create(:relation_tag) (0..255).each do |i| - tag = RelationTag.new - tag.relation_id = 1 - tag.k = "k" - tag.v = val * i + tag.v = "v" * i assert tag.valid? end end def test_length_key_invalid - ["k" * 256].each do |i| - tag = RelationTag.new - tag.relation_id = 1 - tag.k = i - tag.v = "v" - assert !tag.valid?, "Key #{i} should be too long" - assert tag.errors[:k].any? - end + tag = create(:relation_tag) + tag.k = "k" * 256 + assert !tag.valid?, "Key should be too long" + assert tag.errors[:k].any? end def test_length_value_invalid - ["v" * 256].each do |i| - tag = RelationTag.new - tag.relation_id = 1 - tag.k = "k" - tag.v = i - assert !tag.valid?, "Value #{i} should be too long" - assert tag.errors[:v].any? - end + tag = create(:relation_tag) + tag.v = "v" * 256 + assert !tag.valid?, "Value should be too long" + assert tag.errors[:v].any? end def test_empty_tag_invalid @@ -58,10 +40,11 @@ class RelationTagTest < ActiveSupport::TestCase end def test_uniquness + existing = create(:relation_tag) tag = RelationTag.new - tag.relation_id = current_relation_tags(:t1).relation_id - tag.k = current_relation_tags(:t1).k - tag.v = current_relation_tags(:t1).v + tag.relation_id = existing.relation_id + tag.k = existing.k + tag.v = existing.v assert tag.new_record? assert !tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } diff --git a/test/models/relation_test.rb b/test/models/relation_test.rb index 028cd7d48..b095024a6 100644 --- a/test/models/relation_test.rb +++ b/test/models/relation_test.rb @@ -129,20 +129,25 @@ class RelationTest < ActiveSupport::TestCase def test_relation_tags relation = current_relations(:relation_with_versions) + taglist = create_list(:relation_tag, 2, :relation => relation) + tags = Relation.find(relation.id).relation_tags.order(:k) - assert_equal 2, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in relation version 3", tags[0].v - assert_equal "testing two", tags[1].k - assert_equal "modified in relation version 4", tags[1].v + assert_equal taglist.count, tags.count + taglist.sort_by!(&:k).each_index do |i| + assert_equal taglist[i].k, tags[i].k + assert_equal taglist[i].v, tags[i].v + end end def test_tags relation = current_relations(:relation_with_versions) + taglist = create_list(:relation_tag, 2, :relation => relation) + tags = Relation.find(relation.id).tags - assert_equal 2, tags.size - assert_equal "added in relation version 3", tags["testing"] - assert_equal "modified in relation version 4", tags["testing two"] + assert_equal taglist.count, tags.count + taglist.each do |tag| + assert_equal tag.v, tags[tag.k] + end end def test_containing_relation_members diff --git a/test/models/user_test.rb b/test/models/user_test.rb index d480849dd..f8f46cfaf 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -151,7 +151,7 @@ class UserTest < ActiveSupport::TestCase def test_user_preferred_editor user = users(:normal_user) - assert_equal nil, user.preferred_editor + assert_nil user.preferred_editor user.preferred_editor = "potlatch" assert_equal "potlatch", user.preferred_editor user.save! @@ -161,7 +161,7 @@ class UserTest < ActiveSupport::TestCase end def test_visible - assert_equal 22, User.visible.count + assert_equal 23, User.visible.count assert_raise ActiveRecord::RecordNotFound do User.visible.find(users(:suspended_user).id) end @@ -171,7 +171,7 @@ class UserTest < ActiveSupport::TestCase end def test_active - assert_equal 21, User.active.count + assert_equal 22, User.active.count assert_raise ActiveRecord::RecordNotFound do User.active.find(users(:inactive_user).id) end @@ -184,7 +184,7 @@ class UserTest < ActiveSupport::TestCase end def test_identifiable - assert_equal 23, User.identifiable.count + assert_equal 24, User.identifiable.count assert_raise ActiveRecord::RecordNotFound do User.identifiable.find(users(:normal_user).id) end @@ -244,8 +244,8 @@ class UserTest < ActiveSupport::TestCase user.delete assert_equal "user_#{user.id}", user.display_name assert user.description.blank? - assert_equal nil, user.home_lat - assert_equal nil, user.home_lon + assert_nil user.home_lat + assert_nil user.home_lon assert_equal false, user.image.file? assert_equal "deleted", user.status assert_equal false, user.visible? diff --git a/test/models/way_tag_test.rb b/test/models/way_tag_test.rb index 46be06c94..ae8be73b3 100644 --- a/test/models/way_tag_test.rb +++ b/test/models/way_tag_test.rb @@ -3,52 +3,34 @@ require "test_helper" class WayTagTest < ActiveSupport::TestCase api_fixtures - def test_way_tag_count - assert_equal 6, WayTag.count - end - def test_length_key_valid - key = "k" + tag = create(:way_tag) (0..255).each do |i| - tag = WayTag.new - tag.way_id = current_way_tags(:t1).way_id - tag.k = key * i - tag.v = current_way_tags(:t1).v + tag.k = "k" * i assert tag.valid? end end def test_length_value_valid - val = "v" + tag = create(:way_tag) (0..255).each do |i| - tag = WayTag.new - tag.way_id = current_way_tags(:t1).way_id - tag.k = "k" - tag.v = val * i + tag.v = "v" * i assert tag.valid? end end def test_length_key_invalid - ["k" * 256].each do |i| - tag = WayTag.new - tag.way_id = current_way_tags(:t1).way_id - tag.k = i - tag.v = "v" - assert !tag.valid?, "Key #{i} should be too long" - assert tag.errors[:k].any? - end + tag = create(:way_tag) + tag.k = "k" * 256 + assert !tag.valid?, "Key should be too long" + assert tag.errors[:k].any? end def test_length_value_invalid - ["v" * 256].each do |i| - tag = WayTag.new - tag.way_id = current_way_tags(:t1).way_id - tag.k = "k" - tag.v = i - assert !tag.valid?, "Value #{i} should be too long" - assert tag.errors[:v].any? - end + tag = create(:way_tag) + tag.v = "v" * 256 + assert !tag.valid?, "Value should be too long" + assert tag.errors[:v].any? end def test_empty_tag_invalid @@ -58,10 +40,11 @@ class WayTagTest < ActiveSupport::TestCase end def test_uniqueness + existing = create(:way_tag) tag = WayTag.new - tag.way_id = current_way_tags(:t1).way_id - tag.k = current_way_tags(:t1).k - tag.v = current_way_tags(:t1).v + tag.way_id = existing.way_id + tag.k = existing.k + tag.v = existing.v assert tag.new_record? assert !tag.valid? assert_raise(ActiveRecord::RecordInvalid) { tag.save! } diff --git a/test/models/way_test.rb b/test/models/way_test.rb index 6c8b0f80b..807b71d5b 100644 --- a/test/models/way_test.rb +++ b/test/models/way_test.rb @@ -165,20 +165,23 @@ class WayTest < ActiveSupport::TestCase def test_way_tags way = current_ways(:way_with_versions) + taglist = create_list(:way_tag, 2, :way => way) tags = Way.find(way.id).way_tags.order(:k) - assert_equal 2, tags.count - assert_equal "testing", tags[0].k - assert_equal "added in way version 3", tags[0].v - assert_equal "testing two", tags[1].k - assert_equal "modified in way version 4", tags[1].v + assert_equal taglist.count, tags.count + taglist.sort_by!(&:k).each_index do |i| + assert_equal taglist[i].k, tags[i].k + assert_equal taglist[i].v, tags[i].v + end end def test_tags way = current_ways(:way_with_versions) + taglist = create_list(:way_tag, 2, :way => way) tags = Way.find(way.id).tags - assert_equal 2, tags.size - assert_equal "added in way version 3", tags["testing"] - assert_equal "modified in way version 4", tags["testing two"] + assert_equal taglist.count, tags.count + taglist.each do |tag| + assert_equal tag.v, tags[tag.k] + end end def test_containing_relation_members diff --git a/test/test_helper.rb b/test/test_helper.rb index 88cfe4831..9633989cd 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -21,37 +21,29 @@ module ActiveSupport set_fixture_class :current_nodes => Node set_fixture_class :nodes => OldNode - fixtures :current_node_tags, :node_tags - set_fixture_class :current_node_tags => NodeTag - set_fixture_class :node_tags => OldNodeTag - fixtures :current_ways set_fixture_class :current_ways => Way - fixtures :current_way_nodes, :current_way_tags + fixtures :current_way_nodes set_fixture_class :current_way_nodes => WayNode - set_fixture_class :current_way_tags => WayTag fixtures :ways set_fixture_class :ways => OldWay - fixtures :way_nodes, :way_tags + fixtures :way_nodes set_fixture_class :way_nodes => OldWayNode - set_fixture_class :way_tags => OldWayTag fixtures :current_relations set_fixture_class :current_relations => Relation - fixtures :current_relation_members, :current_relation_tags + fixtures :current_relation_members set_fixture_class :current_relation_members => RelationMember - set_fixture_class :current_relation_tags => RelationTag fixtures :relations set_fixture_class :relations => OldRelation - fixtures :relation_members, :relation_tags + fixtures :relation_members set_fixture_class :relation_members => OldRelationMember - set_fixture_class :relation_tags => OldRelationTag fixtures :gpx_files, :gps_points, :gpx_file_tags set_fixture_class :gpx_files => Trace @@ -77,6 +69,19 @@ module ActiveSupport end end + ## + # work round minitest insanity that causes it to tell you + # to use assert_nil to test for nil, which is fine if you're + # comparing to a nil constant but not if you're comparing + # an expression that might be nil sometimes + def assert_equal_allowing_nil(exp, act, msg = nil) + if exp.nil? + assert_nil act, msg + else + assert_equal exp, act, msg + end + end + ## # for some reason assert_equal a, b fails when the relations are # actually equal, so this method manually checks the fields...