From: Tom Hughes Date: Wed, 22 Apr 2020 12:44:17 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/2596' X-Git-Tag: live~2146 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/c51786d10bc6dda488964f468a6a3071dd6912a8?hp=1aa5a54419d1112b246fa5d967f0ae3ffdcadf2b Merge remote-tracking branch 'upstream/pull/2596' --- diff --git a/.erb-lint.yml b/.erb-lint.yml index 7737aee06..0c729d38f 100644 --- a/.erb-lint.yml +++ b/.erb-lint.yml @@ -16,14 +16,14 @@ linters: Enabled: false Layout/TrailingWhitespace: Enabled: false - Naming/FileName: - Enabled: false - Style/FrozenStringLiteralComment: - Enabled: false Lint/UselessAssignment: Enabled: false + Naming/FileName: + Enabled: false Rails/OutputSafety: Enabled: false + Style/FrozenStringLiteralComment: + Enabled: false SelfClosingTag: enabled: false SpaceInHtmlTag: diff --git a/.rubocop.yml b/.rubocop.yml index 1c41c027a..d9fcce7c6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,11 +1,13 @@ inherit_from: .rubocop_todo.yml require: + - rubocop-minitest - rubocop-performance - rubocop-rails AllCops: TargetRubyVersion: 2.5 + NewCops: enable Exclude: - 'vendor/**/*' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 06a9c76f0..307a23f4b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -9,6 +9,7 @@ # Work around erblint issues. # https://github.com/openstreetmap/openstreetmap-website/issues/2472 require: + - rubocop-minitest - rubocop-performance - rubocop-rails diff --git a/Gemfile b/Gemfile index 7c9621734..f79e13a8f 100644 --- a/Gemfile +++ b/Gemfile @@ -138,21 +138,18 @@ end # Gems needed for running tests group :test do - gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20] - gem "rails-controller-testing" - gem "rubocop" - gem "rubocop-performance" - gem "rubocop-rails" - gem "webmock" -end - -# Needed in development as well so rake can see konacha tasks -group :development, :test do gem "capybara", ">= 2.15" gem "coveralls", :require => false gem "erb_lint", :require => false gem "factory_bot_rails" + gem "minitest", "~> 5.1" gem "poltergeist" gem "puma", "~> 3.11" + gem "rails-controller-testing" + gem "rubocop" + gem "rubocop-minitest" + gem "rubocop-performance" + gem "rubocop-rails" gem "selenium-webdriver" + gem "webmock" end diff --git a/Gemfile.lock b/Gemfile.lock index 80c30dc5b..9cd8f51c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,10 +73,10 @@ GEM ast (2.4.0) autoprefixer-rails (9.7.6) execjs - aws-eventstream (1.0.3) - aws-partitions (1.295.0) - aws-sdk-core (3.93.0) - aws-eventstream (~> 1.0, >= 1.0.2) + aws-eventstream (1.1.0) + aws-partitions (1.298.0) + aws-sdk-core (3.94.0) + aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) @@ -87,7 +87,7 @@ GEM aws-sdk-core (~> 3, >= 3.83.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sigv4 (1.1.1) + aws-sigv4 (1.1.2) aws-eventstream (~> 1.0, >= 1.0.2) better_errors (2.6.0) coderay (>= 1.0.0) @@ -322,7 +322,7 @@ GEM omniauth-oauth2 (~> 1.4) openstreetmap-deadlock_retry (1.3.0) parallel (1.19.1) - parser (2.7.1.0) + parser (2.7.1.1) ast (~> 2.4.0) pg (1.2.3) poltergeist (1.18.1) @@ -390,7 +390,7 @@ GEM rinku (2.0.6) rotp (5.1.0) addressable (~> 2.5) - rubocop (0.81.0) + rubocop (0.82.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.7.0.1) @@ -398,9 +398,11 @@ GEM rexml ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) + rubocop-minitest (0.9.0) + rubocop (>= 0.74) rubocop-performance (1.5.2) rubocop (>= 0.71.0) - rubocop-rails (2.5.1) + rubocop-rails (2.5.2) activesupport rack (>= 1.1) rubocop (>= 0.72.0) @@ -412,7 +414,7 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) - sassc (2.2.1) + sassc (2.3.0) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -437,7 +439,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - strong_migrations (0.6.3) + strong_migrations (0.6.4) activerecord (>= 5) sync (0.5.0) term-ansicolor (1.7.1) @@ -538,6 +540,7 @@ DEPENDENCIES rinku (>= 2.0.6) rotp rubocop + rubocop-minitest rubocop-performance rubocop-rails sanitize diff --git a/app/assets/stylesheets/small.scss b/app/assets/stylesheets/small.scss index e5634e11d..83b112ce7 100644 --- a/app/assets/stylesheets/small.scss +++ b/app/assets/stylesheets/small.scss @@ -91,34 +91,7 @@ body.small { .compact-hide { display: inline-block; } - - &.map-layout { - #sidebar, #map { - position: relative; - overflow-x: hidden; - width: 100%; - height: 50%; - } - - .overlay-sidebar { - #sidebar { - position: absolute; - width: 300px; - height: auto; - overflow: hidden; - } - - #map { - height: 100%; - } - } - - #map-ui { - z-index: 9999; - width: 100%; - overflow-y: scroll; - } - } + .overlay-sidebar #sidebar .welcome.visible { display: none; @@ -181,3 +154,33 @@ body.small { } } + +@media (max-width: 767.98px) { + body.map-layout { + #sidebar, #map { + position: relative; + overflow-x: hidden; + width: 100%; + height: 50%; + } + + .overlay-sidebar { + #sidebar { + position: absolute; + width: 300px; + height: auto; + overflow: hidden; + } + + #map { + height: 100%; + } + } + + #map-ui { + z-index: 9999; + width: 100%; + overflow-y: scroll; + } + } +} diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index d136e7230..cd3584f02 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -82,6 +82,6 @@ class IssuesController < ApplicationController def find_issue @issue = Issue.visible_to(current_user).find(params[:id]) rescue ActiveRecord::RecordNotFound - head :not_found + redirect_to :controller => "errors", :action => "not_found" end end diff --git a/app/models/client_application.rb b/app/models/client_application.rb index 67ff075f1..4e3dffb99 100644 --- a/app/models/client_application.rb +++ b/app/models/client_application.rb @@ -39,9 +39,9 @@ class ClientApplication < ApplicationRecord validates :key, :presence => true, :uniqueness => true validates :name, :url, :secret, :presence => true - validates :url, :format => %r{\Ahttp(s?)://(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(/|/([\w#!:.?+=&%@!\-/]))?}i - validates :support_url, :allow_blank => true, :format => %r{\Ahttp(s?)://(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(/|/([\w#!:.?+=&%@!\-/]))?}i - validates :callback_url, :allow_blank => true, :format => %r{\A[a-z][a-z0-9.+-]*://(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(/|/([\w#!:.?+=&%@!\-/]))?}i + validates :url, :format => /\A#{URI::DEFAULT_PARSER.make_regexp(%w[http https])}\z/ + validates :support_url, :allow_blank => true, :format => /\A#{URI::DEFAULT_PARSER.make_regexp(%w[http https])}\z/ + validates :callback_url, :allow_blank => true, :format => /\A#{URI::DEFAULT_PARSER.make_regexp}\z/ before_validation :generate_keys, :on => :create diff --git a/app/models/trace.rb b/app/models/trace.rb index d500784af..959d82e1c 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -117,7 +117,7 @@ class Trace < ApplicationRecord end def mime_type - filetype = `/usr/bin/file -Lbz #{trace_name}`.chomp + filetype = Open3.capture2("/usr/bin/file", "-Lbz", trace_name).first.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ @@ -139,7 +139,7 @@ class Trace < ApplicationRecord end def extension_name - filetype = `/usr/bin/file -Lbz #{trace_name}`.chomp + filetype = Open3.capture2("/usr/bin/file", "-Lbz", trace_name).first.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ @@ -208,8 +208,7 @@ class Trace < ApplicationRecord end def xml_file - # TODO: *nix specific, could do to work on windows... would be functionally inferior though - check for '.gz' - filetype = `/usr/bin/file -Lbz #{trace_name}`.chomp + filetype = Open3.capture2("/usr/bin/file", "-Lbz", trace_name).first.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index a9d127835..3300dc89c 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -9,31 +9,7 @@ <%= stylesheet_link_tag "screen-#{dir}", :media => "screen" %> <%= stylesheet_link_tag "print-#{dir}", :media => "print" %> <%= stylesheet_link_tag "leaflet-all", :media => "screen, print" %> - <%= favicon_link_tag "favicon.ico" if browser.ie? %> - <% [57, 60, 72, 76, 114, 120, 144, 152, 180].each do |size| -%> - <%= favicon_link_tag "apple-touch-icon-#{size}x#{size}.png", :rel => "apple-touch-icon", :sizes => "#{size}x#{size}", :type => "image/png" %> - <% end -%> - <%= favicon_link_tag "favicon-32x32.png", :rel => "icon", :sizes => "32x32", :type => "image/png" %> - <%= favicon_link_tag "favicon-194x194.png", :rel => "icon", :sizes => "194x194", :type => "image/png" %> - <%= 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("tab-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") %> - <%= tag("meta", :name => "msapplication-TileImage", :content => image_path("mstile-144x144.png")) %> - <%= tag("meta", :name => "theme-color", :content => "#ffffff") %> - <%= canonical_tag %> - <% if Settings.key?(:publisher_url) -%> - <%= tag("link", :rel => "publisher", :href => Settings.publisher_url) %> - <% end -%> - <%= tag("link", :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml")) %> - <%= tag("meta", :name => "description", :content => "OpenStreetMap is the free wiki world map.") %> - <%= opengraph_tags(@title) %> - <% if flash[:piwik_goal] -%> - <%= tag("meta", :name => "piwik-goal", :content => flash[:piwik_goal]) %> - <% end -%> + <%= render :partial => "layouts/meta" %> <%= yield :head %> <%= yield :auto_discovery_link_tag %> <%= csrf_meta_tag %> diff --git a/app/views/layouts/_meta.html.erb b/app/views/layouts/_meta.html.erb new file mode 100644 index 000000000..dc08424f3 --- /dev/null +++ b/app/views/layouts/_meta.html.erb @@ -0,0 +1,25 @@ +<%= favicon_link_tag "favicon.ico" if browser.ie? %> +<% [57, 60, 72, 76, 114, 120, 144, 152, 180].each do |size| -%> +<%= favicon_link_tag "apple-touch-icon-#{size}x#{size}.png", :rel => "apple-touch-icon", :sizes => "#{size}x#{size}", :type => "image/png" %> +<% end -%> +<%= favicon_link_tag "favicon-32x32.png", :rel => "icon", :sizes => "32x32", :type => "image/png" %> +<%= favicon_link_tag "favicon-194x194.png", :rel => "icon", :sizes => "194x194", :type => "image/png" %> +<%= 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("tab-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") %> +<%= tag("meta", :name => "msapplication-TileImage", :content => image_path("mstile-144x144.png")) %> +<%= tag("meta", :name => "theme-color", :content => "#ffffff") %> +<%= canonical_tag %> +<% if Settings.key?(:publisher_url) -%> +<%= tag("link", :rel => "publisher", :href => Settings.publisher_url) %> +<% end -%> +<%= tag("link", :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml")) %> +<%= tag("meta", :name => "description", :content => "OpenStreetMap is the free wiki world map.") %> +<%= opengraph_tags(@title) %> +<% if flash[:piwik_goal] -%> +<%= tag("meta", :name => "piwik-goal", :content => flash[:piwik_goal]) %> +<% end -%> diff --git a/app/views/layouts/error.html.erb b/app/views/layouts/error.html.erb index 2b769958e..db6179769 100644 --- a/app/views/layouts/error.html.erb +++ b/app/views/layouts/error.html.erb @@ -4,6 +4,7 @@ OpenStreetMap <%= stylesheet_link_tag "errors", :media => "screen" %> + <%= render :partial => "layouts/meta" %> diff --git a/app/views/notifier/gpx_success.html.erb b/app/views/notifier/gpx_success.html.erb index 7601a621d..1571f3798 100644 --- a/app/views/notifier/gpx_success.html.erb +++ b/app/views/notifier/gpx_success.html.erb @@ -2,5 +2,6 @@

<%= render :partial => "gpx_description" %> - <%= t "notifier.gpx_notification.success.loaded_successfully", :trace_points => @trace_points, :possible_points => @possible_points %> + <%= t("notifier.gpx_notification.success.loaded_successfully", + :trace_points => @trace_points, :possible_points => @possible_points, :count => @possible_points) %>

diff --git a/app/views/traces/show.html.erb b/app/views/traces/show.html.erb index 19d1b06b8..f7517c802 100644 --- a/app/views/traces/show.html.erb +++ b/app/views/traces/show.html.erb @@ -22,7 +22,7 @@ <% if @trace.inserted? %> <%= t ".points" %> - <%= @trace.size.to_s.gsub(/(\d)(?=(\d{3})+$)/, '\1,') %> + <%= number_with_delimiter(@trace.size) %> <%= t ".start_coordinates" %>
<%= @trace.latitude %>; <%= @trace.longitude %>
(<%= link_to t(".map"), :controller => "site", :action => "index", :mlat => @trace.latitude, :mlon => @trace.longitude, :anchor => "map=14/#{@trace.latitude}/#{@trace.longitude}" %> / <%= link_to t(".edit"), :controller => "site", :action => "edit", :gpx => @trace.id, :anchor => "map=14/#{@trace.latitude}/#{@trace.longitude}" %>) diff --git a/app/views/users/account.html.erb b/app/views/users/account.html.erb index fadb74f4c..51c933b5d 100644 --- a/app/views/users/account.html.erb +++ b/app/views/users/account.html.erb @@ -48,7 +48,7 @@
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index ba0987c33..6f97a284a 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -52,7 +52,7 @@ - <%= f.select(:auth_provider, Auth::PROVIDERS, :default => "", :tabindex => 4) %> + <%= f.select(:auth_provider, Auth.providers, :default => "", :tabindex => 4) %> <%= f.text_field(:auth_uid, :tabindex => 5) %> <%= f.error_message_on(:auth_uid) %> diff --git a/config/initializers/konacha.rb b/config/initializers/konacha.rb deleted file mode 100644 index f0145f5e0..000000000 --- a/config/initializers/konacha.rb +++ /dev/null @@ -1,7 +0,0 @@ -if defined?(Konacha) - Konacha.configure do |config| - require "capybara/poltergeist" - config.spec_dir = "test/javascripts" - config.driver = :poltergeist - end -end diff --git a/config/locales/ast.yml b/config/locales/ast.yml index 36e983fa6..84f1edba7 100644 --- a/config/locales/ast.yml +++ b/config/locales/ast.yml @@ -49,6 +49,7 @@ ast: diary_comment: Comentariu del diariu diary_entry: Entrada del diariu friend: Amigu + issue: Problema language: Llingua message: Mensaxe node: Nuedu @@ -65,6 +66,7 @@ ast: relation: Rellación relation_member: Miembru de la rellación relation_tag: Etiqueta de la rellación + report: Informe session: Sesión trace: Traza tracepoint: Puntu de traza @@ -161,6 +163,15 @@ ast: remote: name: Control remotu description: Control remotu (JOSM o Merkaartor) + auth: + providers: + none: Nengunu + openid: OpenID + google: Google + facebook: Facebook + windowslive: Windows Live + github: GitHub + wikipedia: Wikipedia api: notes: comment: @@ -1211,8 +1222,10 @@ ast: more_info_2: 'se puen alcontrar en:' success: subject: '[OpenStreetMap] importación GPX correuta' - loaded_successfully: cargóse correutamente con %{trace_points} de %{possible_points} - puntos posibles. + loaded_successfully: + one: cargóse correutamente con %{trace_points} de 1 puntu posible. + other: cargóse correutamente con %{trace_points} de %{possible_points} puntos + posibles. signup_confirm: subject: '[OpenStreetMap] Bienllegáu a OpenStreetMap' greeting: ¡Hola! @@ -2580,6 +2593,12 @@ ast: out: Amenorgar locate: title: Ver el mio allugamientu + metersPopup: + one: Tas a menos d'un metru d'esti puntu + other: Tas a menos de %{count} metros d'esti puntu + feetPopup: + one: Tas a menos d'un pie d'esti puntu + other: Tas a menos de %{count} pies d'esti puntu base: standard: Estándar cycle_map: Mapa ciclista @@ -2596,6 +2615,11 @@ ast: donate_link_text: terms: Condiciones del sitiu web y de la API + thunderforest: Mosaicu cortesía de Andy + Allan + hotosm: Estilu del mosaicu por Equipu + Humanitariu d'OpenStreetMap agospiáu por OpenStreetMap + Francia site: edit_tooltip: Editar el mapa edit_disabled_tooltip: Aumenta pa editar el mapa diff --git a/config/locales/br.yml b/config/locales/br.yml index 635a85183..5f11470a1 100644 --- a/config/locales/br.yml +++ b/config/locales/br.yml @@ -1196,8 +1196,11 @@ br: more_info_2: 'a c''hall bezañ kavet war :' success: subject: '[OpenStreetMap] Graet eo an enporzhiadenn GPX' - loaded_successfully: karget gant %{trace_points} diwar %{possible_points} - poent posupl. + loaded_successfully: + one: karget ervat gant %{trace_points} diwar 1 poent posupl. + two: karget ervat gant %{trace_points} + other: karget ervat gant %{trace_points} diwar %{possible_points} poent + posupl. signup_confirm: subject: '[OpenStreetMap] Degemer mat en OpenStreetMap' greeting: Demat ! diff --git a/config/locales/de.yml b/config/locales/de.yml index f0d96ee4b..c8dfcfd35 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -80,20 +80,20 @@ de: create: Veröffentlichen update: Aktualisieren issue_comment: - create: Kommentar hinzufügen + create: Kommentieren message: create: Senden client_application: create: Registrieren update: Bearbeiten redaction: - create: Redaction erstellen - update: Redaction speichern + create: Schwärzen + update: Schwärzung speichern trace: create: Hochladen update: Änderungen speichern user_block: - create: Sperre einrichten + create: Sperren update: Sperre aktualisieren activerecord: errors: @@ -104,7 +104,7 @@ de: acl: Zugriffssteuerungsliste changeset: Änderungssatz changeset_tag: Änderungssatz-Attribut - country: Staat + country: Land diary_comment: Blog-Kommentar diary_entry: Blog-Eintrag friend: Freund @@ -113,7 +113,7 @@ de: message: Nachricht node: Knoten node_tag: Knoten-Attribut - notifier: Benachrichtiger + notifier: Melder old_node: Alter Knoten old_node_tag: Altes Knoten-Attribut old_relation: Alte Relation @@ -127,18 +127,18 @@ de: relation_tag: Relation-Attribut report: Meldung session: Sitzung - trace: Track - tracepoint: Trackpunkt - tracetag: Track-Attribut + trace: Spur + tracepoint: Spurmarke + tracetag: Spur-Attribut user: Benutzer user_preference: Benutzereinstellung user_token: Benutzer-Token - way: Linie - way_node: Linienknoten - way_tag: Linie-Attribut + way: Weg + way_node: Wegmarke + way_tag: Weg-Attribut attributes: diary_comment: - body: Textkörper + body: Text diary_entry: user: Benutzer title: Betreff @@ -160,7 +160,7 @@ de: message: sender: Absender title: Betreff - body: Textkörper + body: Inhalt recipient: Empfänger user: email: E-Mail @@ -247,12 +247,12 @@ de: rss: title: OpenStreetMap Hinweise description_area: Übersicht der gemeldeten, kommentierten oder geschlossen - Hinweise/Fehler im Bereich [(%{min_lat}|%{min_lon}) -- (%{max_lat}|%{max_lon})]. - description_item: Ein RSS-Feed für Hinweis/Fehler %{id} - opened: neuer Hinweis/Fehler (in der Nähe von %{place}) + Hinweise im Bereich [(%{min_lat}|%{min_lon}) -- (%{max_lat}|%{max_lon})]. + description_item: Ein RSS-Feed für Hinweis %{id} + opened: neuer Hinweis (in der Nähe von %{place}) commented: neuer Kommentar (in der Nähe von %{place}) - closed: geschlossener Hinweis/Fehler (in der Nähe von %{place}) - reopened: reaktivierter Hinweis/Fehler (in der Nähe von %{place}) + closed: geschlossener Hinweis (in der Nähe von %{place}) + reopened: reaktivierter Hinweis (in der Nähe von %{place}) entry: comment: Kommentieren full: Vollständiger Hinweis @@ -267,11 +267,11 @@ de: closed_by_html: Geschlossen %{time} von %{user} version: Version in_changeset: Änderungssatz - anonymous: Anonym + anonymous: anonym no_comment: (kein Kommentar) part_of: Teil von download_xml: XML herunterladen - view_history: Chronik anzeigen + view_history: Verlauf anzeigen view_details: Details anzeigen location: 'Standort:' changeset: @@ -279,8 +279,8 @@ de: belongs_to: Autor node: Knoten (%{count}) node_paginated: Knoten (%{x}–%{y} von %{count}) - way: Linien (%{count}) - way_paginated: Linien (%{x}–%{y} von %{count}) + way: Wege (%{count}) + way_paginated: Wege (%{x}–%{y} von %{count}) relation: Relationen (%{count}) relation_paginated: Relationen (%{x}–%{y} von %{count}) comment: Kommentare (%{count}) @@ -298,23 +298,23 @@ de: sobald der Änderungssatz geschlossen ist. node: title_html: 'Knoten: %{name}' - history_title_html: 'Chronik des Knotens: %{name}' + history_title_html: 'Knotenverlauf: %{name}' way: - title_html: 'Linie: %{name}' - history_title_html: 'Chronik der Linie: %{name}' + title_html: 'Weg: %{name}' + history_title_html: 'Wegverlauf: %{name}' nodes: Knoten also_part_of_html: - one: Teil der Linie %{related_ways} - other: Teil der Linien %{related_ways} + one: Teil des Wegs %{related_ways} + other: Teil der Wege %{related_ways} relation: title_html: 'Relation: %{name}' - history_title_html: 'Chronik der Relation: %{name}' + history_title_html: 'Relationverlauf: %{name}' members: Mitglieder relation_member: entry_role_html: '%{type} %{name} als %{role}' type: node: Knoten - way: Linie + way: Weg relation: Relation containing_relation: entry_html: Relation %{relation_name} @@ -322,35 +322,34 @@ de: not_found: sorry: '%{type} mit der Nummer %{id} konnte leider nicht gefunden werden.' type: - node: Der Knoten - way: Die Linie + node: Knoten + way: Weg relation: Die Relation changeset: Der Änderungssatz note: Hinweis timeout: - sorry: Entschuldigung, es dauerte zu lange, die Daten für %{type} mit der ID - %{id} abzurufen. + sorry: Es dauerte leider zu lange, die Daten für %{type} mit der ID %{id} abzurufen. type: - node: den Knoten - way: die Linie + node: Knoten + way: Weg relation: die Relation changeset: den Änderungssatz note: Hinweis redacted: - redaction: Redigierung %{id} - message_html: 'Version %{version} diese%{type} kann nicht angezeigt werden, - da hier redigiert wurde. Weitere Informationen gibt es hier: %{redaction_link}.' + redaction: Schwärzung %{id} + message_html: 'Weil hier etwas geschwärzt wurde kann Version %{version} diese%{type} + nicht angezeigt werden. Mehr erfahren: %{redaction_link}.' type: node: s Knotens - way: r Linie + way: s Weges relation: r Relation start_rjs: - feature_warning: Laden von %{num_features} Funktionen, was deinen Browser langsam - machen kann. Willst du diese Daten wirklich anzeigen? + feature_warning: Laden von %{num_features} Funktionen kann deinen Browser langsamer + machen oder einfrieren. Sollen diese Daten wirklich angezeigt werden? load_data: Daten laden loading: Lade … tag_details: - tags: Attribute + tags: Tags wiki_link: key: Die Wiki-Erläuterungsseite für den Schlüssel %{key} tag: Die Wiki-Erläuterungsseite für das Attribut %{key}=%{value} @@ -360,12 +359,12 @@ de: telephone_link: '%{phone_number} anrufen' colour_preview: Farbe %{colour_value} Vorschau note: - title: 'Kartenfehler: %{id}' - new_note: Neuer Kartenfehler + title: 'Hinweis: %{id}' + new_note: Neuer Hinweis description: Beschreibung - open_title: Unerledigter Kartenfehler Nr. %{note_name} - closed_title: Erledigter Kartenfehler Nr. %{note_name} - hidden_title: Versteckter Kartenfehler Nr. %{note_name} + open_title: Ungelöster Hinweis Nr. %{note_name} + closed_title: Erledigter Hinweis Nr. %{note_name} + hidden_title: Versteckter Hinweis Nr. %{note_name} opened_by: Erstellt von %{user} %{when} opened_by_anonymous: Erstellt von Anonym %{when} commented_by: Kommentar von %{user} %{when} @@ -1293,9 +1292,10 @@ de: more_info_2: 'finden sich hier:' success: subject: '[OpenStreetMap] GPX-Import erfolgreich' - loaded_successfully: |- - %{trace_points} von - %{possible_points} möglichen Punkten wurden erfolgreich importiert. + loaded_successfully: + one: mit %{trace_points} von 1 möglichem Punkt erfolgreich geladen. + other: mit %{trace_points} von %{possible_points} möglichen Punkten erfolgreich + geladen. signup_confirm: subject: '[OpenStreetMap] Willkommen bei OpenStreetMap' greeting: Hallo! @@ -2706,6 +2706,12 @@ de: out: Verkleinern locate: title: Aktuellen Standort anzeigen + metersPopup: + one: Du bist weniger als 1 Meter von diesem Punkt entfernt + other: Du bist weniger als %{count} Meter von diesem Punkt entfernt + feetPopup: + one: Du bist weniger als 1 Fuß von diesem Punkt entfernt + other: Du bist weniger als %{count} Fuß von diesem Punkt entfernt base: standard: Standard cycle_map: Radfahrerkarte diff --git a/config/locales/en.yml b/config/locales/en.yml index 089c31a44..f9ea78ef3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1210,7 +1210,9 @@ en: import_failures_url: "https://wiki.openstreetmap.org/wiki/GPX_Import_Failures" success: subject: "[OpenStreetMap] GPX Import success" - loaded_successfully: loaded successfully with %{trace_points} out of a possible %{possible_points} points. + loaded_successfully: + one: loaded successfully with %{trace_points} out of a possible 1 point. + other: loaded successfully with %{trace_points} out of a possible %{possible_points} points. signup_confirm: subject: "[OpenStreetMap] Welcome to OpenStreetMap" greeting: "Hi there!" diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 7484f2921..9845e2e37 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -1232,8 +1232,10 @@ eo: more_info_2: 'ilin vi povas trovi je:' success: subject: '[OpenStreetMap] GPX-dosiero enportita sukcese' - loaded_successfully: estas sukcese ŝargita kun %{trace_points} el %{possible_points} - punktoj. + loaded_successfully: + one: estas sukcese enlegita kun %{trace_points} el 1 punkto. + other: estas sukcese enlegita kun %{trace_points} el %{possible_points} + punktoj. signup_confirm: subject: '[OpenStreetMap] Bonvenon al OpenStreetMap' greeting: Saluton! diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 72ca3dfee..e58b44c07 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -78,6 +78,7 @@ fa: diary_comment: نظر بر روزنوشت diary_entry: روزنوشت friend: دوست + issue: مسئله language: زبان message: پیام node: گره @@ -662,6 +663,7 @@ fa: trail: دنباله trunk: بزرگراه trunk_link: بزرگراه + turning_loop: حلقهٔ گردش unclassified: جادهٔ فرعی "yes": جاده historic: @@ -1066,7 +1068,7 @@ fa: reports: گزارش‌ها last_updated: آخرین روزآمدسازی last_updated_time_html: %{time} - last_updated_time_user_html: %{time} توسط %{user} + last_updated_time_user_html: %{time} به دست %{user} link_to_reports: نمایش گزارش‌ها reports_count: one: 1 گزارش @@ -1088,7 +1090,7 @@ fa: other: '%{count} گزارش' report_created_at: اولین بار %{datetime} گزارش شد last_resolved_at: آخرین بار %{datetime} حل شد - last_updated_at: آخرین بار در %{datetime} توسط %{displayname} روزآمد شده است. + last_updated_at: آخرین روزآمدسازی در %{datetime} به دست %{displayname} resolve: حل شد ignore: نادیده گرفتن reopen: بازگشایی @@ -1104,6 +1106,8 @@ fa: ignored: وضعیت مسئله به «نادیده گرفته شد» تغییر کرده است reopen: reopened: وضعیت مسئله به «باز» تغییر داده کرده است + comments: + comment_from_html: نظر از %{user_link} در %{comment_created_at} reports: reported_by_html: در %{updated_at}،‏ %{user} آن را به‌عنوان %{category} گزارش کرد @@ -1239,8 +1243,10 @@ fa: import_failures_url: https://wiki.openstreetmap.org/wiki/Fa:GPX_Import_Failures success: subject: موفقیت درون‌برد GPX‏ [OpenStreetMap] - loaded_successfully: با موفقیت و با %{trace_points} نقطه از %{possible_points} - نقطهٔ ممکن روی وبسایت قرار گرفته است. + loaded_successfully: + one: با موفقیت %{trace_points} نقطه از 1 نقطهٔ ممکن بار شد. + other: با موفقیت %{trace_points} نقطه از %{possible_points} نقطهٔ ممکن بار + شد. signup_confirm: subject: به OpenStreetMap خوش آمدید [OpenStreetMap] greeting: ‎سلام بر شما! @@ -1425,12 +1431,16 @@ fa: حق‌نشر و پروانه را ببینید.' legal_title: قانونی legal_1_html: |- - این سایت و خدمات فراوان دیگری که به آن وابسته‌اند به‌طور رسمی و به‌نمایندگی از جامعه توسط بنیاد OpenStreetMap ‏(OSMF) هدایت می‌شود. استفاده از همهٔ خدماتی که تحت رهبری OSMF قرار دارد منوط به پذیرش + این سایت و خدمات فراوان دیگری که به آن وابسته‌اند به‌طور رسمی و به‌نمایندگی از جامعه تحت رهبری بنیاد OpenStreetMap ‏(OSMF) دایر است. استفاده از همهٔ خدماتی که تحت رهبری OSMF قرار دارد منوط به پذیرش سیاست استفادهٔ قابل‌قبول، شرایط استفاده و سیاست حریم خصوصی ماست.
اگر در رابطه با پروانه، حق‌نشر یا سایر موارد قانونی سؤالی دارید لطفاً با OSMF تماس بگیرید.
OpenStreetMap،‏ نشان‌وارهٔ ذره‌بین‌دار و State of the Map نشان‌های تجاری ثبت‌شده و متعلق به بنیاد OpenStreetMap هستند. + legal_2_html: |- + اگر دربارهٔ پروانه، حق‌نشر یا سایر مسائل حقوقی پرسشی دارید لطفاً با OSMF تماس بگیرید. +
+ OpenStreetMap، نشان‌وارهٔ ذره‌بین‌دار و State of the Map نشان‌های تجاری متعلق به OSMF هستند. partners_title: شرکای تجاری copyright: foreign: @@ -1575,7 +1585,7 @@ fa: anon_edits_link_text: بفهمید چرا این‌طور است. flash_player_required_html: برای استفاده از Potlatch (ویرایشگر فلش OpenStreetMap) به فلش‌پلیر نیاز دارید. می‌توانید فلش‌پلیر - را از Adobe.com دانلود کنید. چندین + را از Adobe.com دانلود کنید. چندین گزینهٔ دیگر نیز برای ویرایش OpenStreetMap وجود دارد. potlatch_unsaved_changes: شما تغییرات ذخیره‌نشده دارید. (برای ذخیره در Potlatch، اگر در حالت زنده ویرایش می‌کنید، باید راه یا نقطهٔ جاری را از حالت انتخاب @@ -1932,7 +1942,7 @@ fa: identifiable: قابل شناسایی private: خصوصی trackable: قابل ردیابی - by: توسط + by: از in: در map: نقشه index: @@ -2182,6 +2192,8 @@ fa: heading_ct: شرایط مشارکت‌کننده read and accept with tou: لطفاً توافق‌نامهٔ مشارکت‌کننده و شرایط استفاده را مطالعه کنید و هر دو گزینه را علامت بزنید و سپس روی دکمهٔ ادامه کلیک کنید. + contributor_terms_explain: شرایط این توافقنامه برای مشارکت‌های گذشته و آیندهٔ + شما نافذ است. read_ct: شرایط مشارکت‌کننده را خواندم و با آن موافق هستم read_tou: شرایط استفاده را خواندم و با آن موافق هستم consider_pd: علاوه بر موارد بالا، می‌پذیرم که مشارکت‌هایم در مالکیت عمومی باشد. @@ -2217,7 +2229,7 @@ fa: my comments: نظرات من oauth settings: تنظیمات oauth blocks on me: مسدودی‌های من - blocks by me: بوک های توسط من + blocks by me: مسدودی‌های به دست من send message: ارسال پیام diary: روزنوشت edits: ویرایش‌ها @@ -2482,7 +2494,7 @@ fa: empty: هنوز مسدودیتی ساخته نشده. revoke: title: لغو مسدودی از %{block_on} - heading_html: لغو مسدودی از %{block_on}، مسدودشده توسط %{block_by} + heading_html: ابطال مسدودی %{block_on}، مسدودشده به دست %{block_by} time_future: این مسدودی در %{time} پایان می یابد. past: این مسدودی %{time} پایان یافته و اکنون قابل‌لغو نیست. confirm: مطمئنید می‌خواهید این مسدودی را لغو کنید؟ @@ -2505,14 +2517,14 @@ fa: blocks_on: title: مسدودی‌های کاربری %{name} heading_html: فهرست مسدودی‌های %{name} - empty: '%{name} تاکنون مسدود نشده است.' + empty: '%{name} تا کنون مسدود نشده است.' blocks_by: title: مسدودسازی‌های %{name} heading_html: فهرست مسدودسازی‌های %{name} - empty: '%{name} تاکنون مسدود نکرده.' + empty: '%{name} تا کنون مسدود نکرده است.' show: - title: '%{block_on} توسط %{block_by} مسدود شده' - heading_html: '%{block_on} توسط %{block_by} مسدود شده' + title: '%{block_on} به دست %{block_by} مسدود شده' + heading_html: '%{block_on} به دست %{block_by} مسدود شده' created: زمان ایجاد status: وضعیت show: نمایش @@ -2581,6 +2593,12 @@ fa: out: کوچک‌نمایی locate: title: نمایش مکان من + metersPopup: + one: شما در یک متری این نقطه هستید + other: شما در %{count} متری این نقطه هستید + feetPopup: + one: شما در یک فوتی این نقطه هستید + other: شما در %{count} فوتی این نقطه هستید base: standard: استاندارد cycle_map: نقشه دوچرخه @@ -2596,6 +2614,11 @@ fa: copyright: © مشارکت‌کنندگان OpenStreetMap donate_link_text: terms: شرایط وبسایت و API + thunderforest: کاشی‌ها با لطف Andy + Allan + hotosm: سبک کاشی‌ها از Humanitarian + OpenStreetMap Team میزبانی با اوپن‌استریت‌مپ + فرانسه site: edit_tooltip: ویرایش نقشه edit_disabled_tooltip: برای ویرایش نقشه بزرگنمایی کنید diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ccafbe3fe..e7d5e5af3 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1297,8 +1297,10 @@ fr: more_info_2: 'peuvent être trouvés sur :' success: subject: '[OpenStreetMap] Import GPX réussi' - loaded_successfully: s’est chargé correctement avec %{trace_points} des %{possible_points} - points possibles. + loaded_successfully: + one: s’est chargé correctement avec %{trace_points} du point possible. + other: s’est chargé correctement avec %{trace_points} des %{possible_points} + points possibles. signup_confirm: subject: '[OpenStreetMap] Bienvenue dans OpenStreetMap' greeting: Bonjour ! diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 8dc4d62e1..ad2dbbdd9 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -923,7 +923,7 @@ gl: chemist: Farmacia clothes: Tenda de roupa computer: Tenda informática - confectionery: Pastelaría + confectionery: Tenda de larpeiradas convenience: Tenda de ultramarinos copyshop: Copistaría cosmetics: Tenda de cosméticos @@ -2102,7 +2102,7 @@ gl: register now: Rexístrese agora with username: 'Xa tes unha conta no OpenStreetMap? Accede ó sistema co teu nome de usuario e contrasinal:' - with external: 'Ou ben, empregue un servizo de terceiros para accederes:' + with external: 'Ou ben, emprega un servizo de terceiros para acceder:' new to osm: É novo no OpenStreetMap? to make changes: Para facer as modificacións nos datos do OpenStreetMap, cómpre ter unha conta. @@ -2194,7 +2194,7 @@ gl: external auth: 'Autenticación de terceiros:' password: 'Contrasinal:' confirm password: 'Confirmar o contrasinal:' - use external auth: Ou ben, empregue un servizo de terceiros para acceder + use external auth: Ou ben, emprega un servizo de terceiros para acceder auth no password: Coa autenticación de terceiros non se precisa un contrasinal, aínda que hai algunhas ferramentas e servidores que aínda a solicitan. continue: Rexistrarse diff --git a/config/locales/ia.yml b/config/locales/ia.yml index f6c3a4717..c4fcf7c17 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -1227,8 +1227,11 @@ ia: more_info_2: 'los se trova a:' success: subject: '[OpenStreetMap] Importation GPX succedite' - loaded_successfully: ha essite cargate con successo con %{trace_points} ex - un maximo de %{possible_points} punctos. + loaded_successfully: + one: ha essite cargate con successo con %{trace_points} ex un maximo de + 1 puncto. + other: ha essite cargate con successo con %{trace_points} ex un maximo de + %{possible_points} punctos. signup_confirm: subject: '[OpenStreetMap] Benvenite a OpenStreetMap' greeting: Bon die! diff --git a/config/locales/is.yml b/config/locales/is.yml index b2e842e4d..0d376e98f 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -320,14 +320,11 @@ is: síðan commented_by: Umsögn frá %{user} %{when} commented_by_anonymous: Umsögn frá nafnlausum notanda %{when} - closed_by: Leyst af %{user} fyrir %{when} síðan - closed_by_anonymous: Leyst af nafnlausum notanda fyrir %{when} - síðan - reopened_by: Endurvirkjað af %{user} fyrir %{when} - síðan - reopened_by_anonymous: Endurvirkjað af nafnlausum notanda fyrir %{when} - síðan - hidden_by: Falið af %{user} fyrir %{when} síðan + closed_by: Leyst af %{user} %{when} + closed_by_anonymous: Leyst af nafnlausum notanda fyrir %{when} + reopened_by: Endurvirkjað af %{user} %{when} + reopened_by_anonymous: Endurvirkjað af nafnlausum notanda fyrir %{when} + hidden_by: Falið af %{user} %{when} report: Tilkynna þennan minnispunkt query: title: Rannsaka fitjur @@ -1241,8 +1238,10 @@ is: import_failures_url: https://wiki.openstreetmap.org/wiki/GPX_Import_Failures success: subject: '[OpenStreetMap] GPX skrá innflutt' - loaded_successfully: var innflutt með %{trace_points} punkta af %{possible_points} - mögulegum. + loaded_successfully: + one: var hlaðið inn með %{trace_points} af 1 punkti mögulegum. + other: var hlaðið inn með %{trace_points} punktum af %{possible_points} + mögulegum. signup_confirm: subject: '[OpenStreetMap] Velkomin í OpenStreetMap' greeting: Hæ þú! @@ -1439,10 +1438,12 @@ is: legal_1_html: "Þetta vefsvæði ásamt mörgum tengdum þjónustum er formlega rekið af\nOpenStreetMap Foundation (OSMF) \nfyrir hönd samfélagsins. Notkun allrar þjónustu á vegum OSMF fellur undir - \nnotkunarskilmála - okkar og einnig persónuverndarstefnu - okkar\n.
\nEndilega hafðu - samband við OSMF \nef þú ert með spurningar eða beiðnir varðandi notkunarleyfi, + \nnotkunarskilmála + okkar, ásættanlega + notkunarskilmála og einnig persónuverndarstefnu + okkar." + legal_2_html: "Endilega hafðu samband + við OSMF \nef þú ert með spurningar eða beiðnir varðandi notkunarleyfi, höfundarrétt eða önnur lögfræðileg málefni.\n
\nOpenStreetMap, táknmerkið með stækkunarglerinu og ástand kortsins eru skrásett vörumerki OSMF." @@ -1781,7 +1782,7 @@ is: - lundur retail: Smásölusvæði industrial: Iðnaðarsvæði - commercial: Skrifstoðusvæði + commercial: Verslunarsvæði heathland: Heiðalönd lake: - Vatn diff --git a/config/locales/it.yml b/config/locales/it.yml index 92c1a2750..91f727600 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1269,8 +1269,10 @@ it: more_info_2: 'possono essere trovate su:' success: subject: '[OpenStreetMap] Importazione GPX completata con successo' - loaded_successfully: caricato con successo con %{trace_points} dei possibili - %{possible_points} punti. + loaded_successfully: + one: caricato con successo con %{trace_points} di 1 punto possibile. + other: caricato con successo con %{trace_points} dei possibili %{possible_points} + punti. signup_confirm: subject: '[OpenStreetMap] Benvenuti su OpenStreetMap' greeting: Ehilà! diff --git a/config/locales/lv.yml b/config/locales/lv.yml index d692f3e6a..077d6b7e7 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -131,6 +131,14 @@ lv: remote: name: Attālinātā palaišana description: Attālinātā palaišana (JOSM vai Merkaartor) + auth: + providers: + openid: OpenID + google: Google + facebook: Facebook + windowslive: Windows Live + github: GitHub + wikipedia: Vikipēdija api: notes: comment: @@ -366,7 +374,9 @@ lv: diary_comment: comment_from_html: Komentārs no %{link_user} @ %{comment_created_at} hide_link: Paslēpt šo komentāru + unhide_link: Atcelt komentāra slēpšanu confirm: Apstiprināt + report: Ziņot par šo komentāru location: location: 'Atrašanās vieta:' view: Skatīt @@ -387,7 +397,7 @@ lv: post: Publicēt when: Kad comment: Komentārs - newer_comments: Jaunākie komentāri + newer_comments: Jaunāki komentāri older_comments: Vecāki komentāri geocoder: search: @@ -541,11 +551,13 @@ lv: bus_guideway: Vadāmais Autobuss bus_stop: Autobusa pietura construction: Automaģistrāle būvniecības stadijā + corridor: Koridors cycleway: Veloceliņš elevator: Lifts emergency_access_point: Ārkārtas piekļuves punkts footway: Taka ford: Fjords + give_way: Dodiet ceļu zīme living_street: Dzīvojamā zona milestone: Ceļa stabs motorway: Automaģistrāle @@ -674,6 +686,7 @@ lv: lighthouse: Bāka mine: Raktuves pipeline: Cauruļvads + surveillance: Novērošana tower: Tornis watermill: Ūdens dzirnavas water_tower: Ūdens tornis @@ -743,6 +756,7 @@ lv: place: allotments: Mazdārziņi city: Pilsēta + city_block: Pilsētas kvartāls country: Valsts county: Apgabals farm: Saimniecība @@ -859,8 +873,10 @@ lv: stationery: Kancelejas preču veikals supermarket: Lielveikals tailor: Drēbnieks + tobacco: Tabakas veikals toys: Rotaļlietu veikals travel_agency: Tūrisma aģentūra + tyres: Riepu veikals video: Video veikals wine: Vīna veikals "yes": Veikals @@ -932,6 +948,7 @@ lv: search: Meklēt status: Statuss reports: Ziņojumi + link_to_reports: Skatīt ziņojumus states: ignored: Ignorēts open: Atvērt diff --git a/config/locales/mk.yml b/config/locales/mk.yml index f257bd6d2..269467c2c 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -1230,8 +1230,9 @@ mk: import_failures_url: https://wiki.openstreetmap.org/wiki/GPX_Import_Failures?uselang=mk success: subject: '[OpenStreetMap] Успешен увоз на GPX-податотека' - loaded_successfully: успешно се вчита со %{trace_points} од вкупно можни %{possible_points} - точки. + loaded_successfully: + one: успешно вчитана %{trace_points} од можната една точка. + other: успешно вчитани %{trace_points} од можните %{possible_points} точки. signup_confirm: subject: '[OpenStreetMap] Добре дојдовте на OpenStreetMap' greeting: Здраво! diff --git a/config/locales/pl.yml b/config/locales/pl.yml index b6cc58b1c..513533b2a 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -100,6 +100,7 @@ pl: diary_comment: Komentarz do dziennika diary_entry: Wpis do dziennika friend: Znajomy + issue: problem language: Język message: Wiadomość node: Węzeł @@ -116,6 +117,7 @@ pl: relation: Relacja relation_member: Człon relacji relation_tag: Tag relacji + report: raport session: Sesja trace: Ślad tracepoint: Punkt śladu @@ -1295,8 +1297,11 @@ pl: import_failures_url: http://wiki.openstreetmap.org/wiki/GPX_Import_Failures success: subject: '[OpenStreetMap] Zaimportowano plik GPX' - loaded_successfully: wczytano wraz z %{trace_points} z %{possible_points} - punktów łącznie. + loaded_successfully: + one: wczytano wraz z %{trace_points} z 1 punktu łącznie. + few: wczytano wraz z %{trace_points} z %{possible_points} punktów łącznie. + many: wczytano wraz z %{trace_points} z %{possible_points} punktów łącznie. + other: wczytano wraz z %{trace_points} z %{possible_points} punktów łącznie. signup_confirm: subject: '[OpenStreetMap] Witamy w OpenStreetMap' greeting: Cześć! @@ -2794,7 +2799,7 @@ pl: onramp_left: Skręć w lewo na łącznik endofroad_left_without_exit: Na końcu tej drogi skręć w lewo w kierunku %{name} merge_left_without_exit: Skręć w lewo w kierunku %{name} - fork_left_without_exit: Na rozwidleniu dróg skręć w prawo w kierunku %{name} + fork_left_without_exit: Na rozwidleniu dróg skręć w lewo w kierunku %{name} slight_left_without_exit: Lekko w lewo w %{name} via_point_without_exit: (przez punkt) follow_without_exit: Jedź wzdłuż %{name} diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index bc487287a..7f74583de 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -23,6 +23,7 @@ # Author: Gusta # Author: Jgpacker # Author: L +# Author: Leonardo9387 # Author: Leosls # Author: Luckas # Author: Luckas Blade @@ -1275,7 +1276,7 @@ pt-BR: success: subject: '[OpenStreetMap] Sucesso ao importar arquivo GPX' loaded_successfully: |- - carregado com sucesso com %{trace_points} pontos além dos + carregado com sucesso com %{trace_points} de um 1 possível ponto.|carregado com sucesso com %{trace_points} de um possível %{possible_points} pontos possíveis." signup_confirm: subject: '[OpenStreetMap] Bem-vindo(a) ao OpenStreetMap' diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index bef0ff021..187d20724 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -1229,18 +1229,18 @@ pt-PT: notifier: diary_comment_notification: subject: '[OpenStreetMap] %{user} comentou uma publicação de diário' - hi: Olá %{to_user}, + hi: Olá, %{to_user}. header: '%{from_user} comentou a publicação de diário OpenStreetMap com o assunto %{subject}:' footer: Também podes ler o comentário em %{readurl} e comentar em %{commenturl} ou responder em %{replyurl} message_notification: - hi: Olá %{to_user}, + hi: Olá, %{to_user}. header: '%{from_user} enviou-te uma mensagem através do OpenStreetMap com o assunto %{subject}:' footer_html: Também podes ler a mensagem em %{readurl} e responder em %{replyurl} friend_notification: - hi: Olá %{to_user}, + hi: Olá, %{to_user}. subject: '[OpenStreetMap] %{user} adicionou-te como amigo' had_added_you: '%{user} adicionou-te como amigo no OpenStreetMap.' see_their_profile: Podes ver o perfil dele em %{userurl}. @@ -1324,7 +1324,7 @@ pt-PT: perto de %{place}.' details: Podes ver mais detalhes sobre a nota em %{url}. changeset_comment_notification: - hi: Olá %{to_user}, + hi: Olá, %{to_user}. greeting: Olá, commented: subject_own: '[OpenStreetMap] %{commenter} comentou um dos teus conjuntos @@ -1594,10 +1594,10 @@ pt-PT: user_page_link: página de utilizador anon_edits_html: (%{link}) anon_edits_link_text: Descobre a que se deve isto. - flash_player_required_html: Precisas do Flash instalado e ativado para usar - o Potlatch, o editor Flash do OpenStreetMap. Podes transferir - o Flash do sítio Adobe.com. Também - estão disponíveis outras opções para editar o OpenStreetMap. + flash_player_required_html: Precisas do Flash Player instalado e ativado para + usar o Potlatch, o editor Flash do OpenStreetMap. Podes transferir + o Flash do sítio Adobe.com.
Também + há outras opções disponíveis para editares o OpenStreetMap. potlatch_unsaved_changes: Tens alterações por gravar. (Para gravar no Potlatch, deves desmarcar o ponto ou linha atual, se estiveres a editar no modo direto, ou clicar no botão gravar se este estiver disponível.) @@ -1963,7 +1963,7 @@ pt-PT: map: mapa index: public_traces: Rotas de GPS Públicas - my_traces: As minhas rotas GPS + my_traces: As Minhas Rotas GPS public_traces_from: Rotas GPS públicas do utilizador %{user} description: Explorar as rotas GPS enviadas recentemente tagged_with: etiquetada com %{tags} @@ -2006,7 +2006,7 @@ pt-PT: Não precisas de aceitar os termos, mas tens de os ver. oauth: authorize: - title: Autorizar acesso à tua conta + title: Autorizar Acesso À Tua Conta request_access_html: A aplicação %{app_name} está a pedir acesso à tua conta, %{user}. Por favor, confere se queres dar à aplicação as seguintes funcionalidades. Podes escolher as que quiseres e quantas quiseres. @@ -2019,7 +2019,7 @@ pt-PT: allow_read_gpx: para ler as tuas rotas de GPS privadas. allow_write_gpx: para enviar rotas GPS. allow_write_notes: para modificar notas. - grant_access: Dar Acesso + grant_access: Dar acesso authorize_success: title: Pedido de autorização permitido allowed_html: Concedeste à aplicação %{app_name} acesso à tua conta. @@ -2517,34 +2517,35 @@ pt-PT: needs_view: O utilizador precisa de iniciar sessão antes de o bloqueio ser revogado? filter: block_expired: Este bloqueio já expirou e não pode ser editado. - block_period: O período de tempo do bloqueio tem de ser um dos valores da lista - deslizante. + block_period: O período de bloqueio tem de corresponder a um dos valores selecionáveis + da lista. create: - try_contacting: Por favor tente contactar o utilizador antes de o bloquear e - dê-lhe algum tempo para responder. - try_waiting: Por favor dê um tempo razoável para o utilizador responder antes - de o bloquear. - flash: Bloqueou o utilizador %{name}. + try_contacting: Por favor, tenta contactar o utilizador antes de o bloqueares + e dá-lhe algum tempo para responder. + try_waiting: Por favor, dá um tempo razoável para o utilizador responder antes + de o bloqueares. + flash: Bloqueaste o utilizador %{name}. update: - only_creator_can_edit: Apenas o moderador que criou este bloqueio pode editá-lo. + only_creator_can_edit: Este bloqueio só pode ser editado pelo moderador que + o criou. success: Bloqueio atualizado. index: - title: Bloqueio de utilizador - heading: Lista de bloqueios de utilizadores + title: Bloqueios do utilizador + heading: Lista de bloqueios do utilizador empty: Ainda não foram feitos bloqueios. revoke: - title: Revocando bloqueio de %{block_on} - heading_html: Revocando bloqueio de %{block_on} por %{block_by} + title: A retirar o bloqueio de %{block_on} + heading_html: A retirar o bloqueio de %{block_on} por %{block_by} time_future: Este bloqueio terminará em %{time}. past: Este bloqueio terminou a %{time} e já não pode ser revogado. - confirm: Tem a certeza que quer revocar este bloqueio? + confirm: Tens a certeza de que queres revogar este bloqueio? revoke: Revogar! flash: Este bloqueio foi revogado. helper: time_future: Termina em %{time}. - until_login: Ativo até o utilizador entrar na conta. - time_future_and_until_login: Termina em %{time} e após o utilizador entrar na - conta. + until_login: Ativo até o utilizador iniciar sessão. + time_future_and_until_login: Termina em %{time} e depois de o utilizador iniciar + sessão. time_past: Terminou a %{time}. block_duration: hours: @@ -2578,11 +2579,11 @@ pt-PT: show: Mostrar edit: Editar revoke: Revogar! - confirm: Tem a certeza? + confirm: Tens a certeza? reason: 'Razão do bloqueio:' back: Ver todos os bloqueios - revoker: 'Revogador:' - needs_view: O utilizador necessita de autenticar-se antes deste bloqueio terminar. + revoker: 'Quem revogou:' + needs_view: O utilizador tem de iniciar sessão antes de este bloqueio terminar. block: not_revoked: (não revogado) show: Mostrar @@ -2599,13 +2600,13 @@ pt-PT: previous: « Anterior notes: mine: - title: Erros reportados ou comentados por %{user} - heading: Erros reportados por %{user} - subheading_html: Erros reportados ou comentados por %{user} - id: Identificador + title: Notas submetidas ou comentadas por %{user} + heading: Notas de %{user} + subheading_html: Notas submetidas ou comentadas por %{user} + id: Id creator: Criador description: Descrição - created_at: Criado em + created_at: Criada em last_changed: Última alteração javascripts: close: Fechar @@ -2614,8 +2615,8 @@ pt-PT: cancel: Cancelar image: Imagem link: Ligação ou HTML - long_link: Link - short_link: Lig.Curta + long_link: Ligação + short_link: Ligação curta geo_uri: Geo URI embed: HTML custom_dimensions: Definir dimensões @@ -2628,13 +2629,13 @@ pt-PT: center_marker: Centrar o mapa no marcador paste_html: Colar HTML para incorporar na página web view_larger_map: Ver mapa maior - only_standard_layer: Apenas a Camada Padrão pode ser exportada como imagem + only_standard_layer: Só a camada padrão pode ser exportada como imagem embed: - report_problem: Reportar problema + report_problem: Reportar um problema key: - title: Legenda do mapa + title: Legenda tooltip: Legenda do mapa - tooltip_disabled: Legenda do Mapa indisponível para esta camada + tooltip_disabled: Não há legenda do mapa disponível para esta camada map: zoom: in: Aproximar @@ -2653,10 +2654,10 @@ pt-PT: transport_map: Transportes Públicos hot: Humanitário layers: - header: Camadas do Mapa - notes: Erros reportados no mapa - data: Dados técnicos do mapa - gps: Trilhos GPS Públicos + header: Camadas do mapa + notes: Notas no mapa + data: Dados do mapa + gps: Rotas de GPS públicas overlays: Ativar camadas para solucionar problemas no mapa title: Camadas copyright: © Colaboradores do OpenStreetMap @@ -2670,12 +2671,11 @@ pt-PT: França site: edit_tooltip: Editar o mapa - edit_disabled_tooltip: Área demasiado grande. Amplie para poder editar - createnote_tooltip: Reportar erro no mapa - createnote_disabled_tooltip: A área exibida é demasiado grande. Amplia o mapa - para poderes reportar um erro. + edit_disabled_tooltip: Amplia o mapa para poderes editar + createnote_tooltip: Adicionar uma nota ao mapa + createnote_disabled_tooltip: Amplia para adicionares uma nota ao mapa. map_notes_zoom_in_tooltip: Aproxime para ver erros reportados - map_data_zoom_in_tooltip: Aproxime para ver dados do mapa + map_data_zoom_in_tooltip: Amplia para veres os dados do mapa queryfeature_tooltip: Consultar elementos em redor queryfeature_disabled_tooltip: Aproxime a vista para consultar elementos em redor @@ -2699,9 +2699,9 @@ pt-PT: anonymous_warning: Este erro reportado inclui comentários de utilizadores anónimos que devem ser confirmados por fonte independente. hide: Esconder - resolve: Marcar como Resolvido + resolve: Marcar como resolvido reactivate: Reabrir - comment_and_resolve: Gravar como Resolvido + comment_and_resolve: Gravar como resolvido comment: Gravar edit_help: Move o mapa, amplia-o no local que pretendes editar e clica aqui. directions: @@ -2810,7 +2810,7 @@ pt-PT: directions_to: Indicações para aqui add_note: Adicionar uma nota aqui show_address: Mostrar endereço - query_features: Consular elementos + query_features: Consultar elementos centre_map: Centrar mapa aqui redactions: edit: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index d3cacdf58..add0a5877 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1273,8 +1273,9 @@ tr: more_info_2: 'şu adresten edinebilirsiniz:' success: subject: '[OpenStreetMap] GPX dosyası başarıyla alındı' - loaded_successfully: Olası bir %{possible_points} noktalarından %{trace_points} - ile başarıyla yüklendi. + loaded_successfully: + one: '%{trace_points} olası 1 puan üzerinden başarıyla yüklendi.' + other: '%{trace_points} olası %{possible_points} puanından başarıyla yüklendi.' signup_confirm: subject: '[OpenStreetMap]''e hoşgeldin' greeting: Merhaba! @@ -1965,7 +1966,7 @@ tr: owner: 'Gönderen:' description: 'Açıklama:' tags: 'Etiketler:' - none: Yok + none: Hiçbiri edit_trace: Bu iz düzenle delete_trace: Bu izi sil trace_not_found: İz bulunmadı! diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 2ec0c94db..ca332339d 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -1275,8 +1275,11 @@ uk: more_info_2: 'можна знайти на:' success: subject: '[OpenStreetMap] Імпорт GPX пройшов успішно' - loaded_successfully: успішно завантажено %{trace_points} точок з %{possible_points} - можливих. + loaded_successfully: + one: успішно завантажено 1 точку з 1 можливої. + few: успішно завантажено %{trace_points} точки з %{possible_points} можливих. + many: успішно завантажено %{trace_points} точок з %{possible_points} можливих. + other: успішно завантажено %{trace_points} точок з %{possible_points} можливих. signup_confirm: subject: '[OpenStreetMap] Ласкаво просимо до OpenStreetMap' greeting: Привіт! diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index dc4063ec4..e7e1a8dc3 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1248,9 +1248,13 @@ zh-TW: import_failures_url: https://wiki.openstreetmap.org/wiki/GPX_Import_Failures success: subject: '[OpenStreetMap] GPX 匯入成功' - loaded_successfully: |- - 成功載入可能為 %{possible_points} 點中的 - %{trace_points} 點。 + loaded_successfully: + one: |- + 成功載入 1 點中的 + %{trace_points}。 + other: |- + l成功載入 %{possible_points} 點中的 + %{trace_points}。 signup_confirm: subject: '[OpenStreetMap] 歡迎加入 OpenStreetMap' greeting: 您好! diff --git a/lib/auth.rb b/lib/auth.rb index ff9a22663..bc1ee8ec6 100644 --- a/lib/auth.rb +++ b/lib/auth.rb @@ -1,12 +1,16 @@ module Auth - PROVIDERS = { - I18n.t("auth.providers.none") => "", - I18n.t("auth.providers.openid") => "openid" - }.tap do |providers| - providers[I18n.t("auth.providers.google")] = "google" if Settings.key?(:google_auth_id) - providers[I18n.t("auth.providers.facebook")] = "facebook" if Settings.key?(:facebook_auth_id) - providers[I18n.t("auth.providers.windowslive")] = "windowslive" if Settings.key?(:windowslive_auth_id) - providers[I18n.t("auth.providers.github")] = "github" if Settings.key?(:github_auth_id) - providers[I18n.t("auth.providers.wikipedia")] = "wikipedia" if Settings.key?(:wikipedia_auth_id) - end.freeze + @providers = {} + + def self.providers + @providers[I18n.locale] ||= { + I18n.t("auth.providers.none") => "", + I18n.t("auth.providers.openid") => "openid" + }.tap do |providers| + providers[I18n.t("auth.providers.google")] = "google" if Settings.key?(:google_auth_id) + providers[I18n.t("auth.providers.facebook")] = "facebook" if Settings.key?(:facebook_auth_id) + providers[I18n.t("auth.providers.windowslive")] = "windowslive" if Settings.key?(:windowslive_auth_id) + providers[I18n.t("auth.providers.github")] = "github" if Settings.key?(:github_auth_id) + providers[I18n.t("auth.providers.wikipedia")] = "wikipedia" if Settings.key?(:wikipedia_auth_id) + end.freeze + end end diff --git a/test/controllers/api/amf_controller_test.rb b/test/controllers/api/amf_controller_test.rb index 2240504bd..241efa937 100644 --- a/test/controllers/api/amf_controller_test.rb +++ b/test/controllers/api/amf_controller_test.rb @@ -181,32 +181,32 @@ module Api assert_equal Array, map[4].class, 'map "relations" element should be an array' map[2].each do |w| assert_equal 2, w.length, "way should be (id, version) pair" - assert w[0] == w[0].floor, "way ID should be an integer" - assert w[1] == w[1].floor, "way version should be an integer" + assert_equal w[0], w[0].floor, "way ID should be an integer" + assert_equal w[1], w[1].floor, "way version should be an integer" end map[3].each do |n| assert_equal 5, w.length, "node should be (id, lat, lon, [tags], version) tuple" - assert n[0] == n[0].floor, "node ID should be an integer" + assert_equal n[0], n[0].floor, "node ID should be an integer" assert n[1] >= minlat - 0.01, "node lat should be greater than min" assert n[1] <= maxlat - 0.01, "node lat should be less than max" assert n[2] >= minlon - 0.01, "node lon should be greater than min" assert n[2] <= maxlon - 0.01, "node lon should be less than max" assert_equal Array, a[3].class, "node tags should be array" - assert n[4] == n[4].floor, "node version should be an integer" + assert_equal n[4], n[4].floor, "node version should be an integer" end map[4].each do |r| assert_equal 2, r.length, "relation should be (id, version) pair" - assert r[0] == r[0].floor, "relation ID should be an integer" - assert r[1] == r[1].floor, "relation version should be an integer" + assert_equal r[0], r[0].floor, "relation ID should be an integer" + assert_equal r[1], r[1].floor, "relation version should be an integer" end # TODO: looks like amf_controller changed since this test was written # so someone who knows what they're doing should check this! ways = map[2].collect { |x| x[0] } - assert ways.include?(way.id), - "map should include used way" + assert_includes ways, way.id, + "map should include used way" assert_not ways.include?(deleted_way.id), "map should not include deleted way" end @@ -271,8 +271,8 @@ module Api # so someone who knows what they're doing should check this! assert_not map[2].include?(way.id), "map should not include visible way" - assert map[2].include?(deleted_way.id), - "map should include deleted way" + assert_includes map[2], deleted_way.id, + "map should include deleted way" end def test_whichways_deleted_toobig @@ -428,7 +428,7 @@ module Api # ['way',wayid,history] assert_equal history[0], "way" assert_equal history[1], 0 - assert history[2].empty? + assert_empty history[2] end def test_getnode_history @@ -466,7 +466,7 @@ module Api # ['node',nodeid,history] assert_equal history[0], "node" assert_equal history[1], 0 - assert history[2].empty? + assert_empty history[2] end def test_findgpx_bad_user @@ -847,7 +847,7 @@ module Api assert_equal nd.version + 1, result[4] current_node = Node.find(result[3].to_i) - assert_equal false, current_node.visible + assert_not current_node.visible end # try deleting a node that is already deleted @@ -978,14 +978,14 @@ module Api new_node = Node.find(new_node_id) assert_equal 1, new_node.version - assert_equal true, new_node.visible + assert new_node.visible assert_equal 4.56, new_node.lon assert_equal 12.34, new_node.lat assert_equal({ "test" => "new" }, new_node.tags) changed_node = Node.find(d) assert_equal 2, changed_node.version - assert_equal true, changed_node.visible + assert changed_node.visible assert_equal 12.34, changed_node.lon assert_equal 4.56, changed_node.lat assert_equal({ "test" => "ok" }, changed_node.tags) @@ -993,7 +993,7 @@ module Api # node is not deleted because our other ways are using it deleted_node = Node.find(a) assert_equal 1, deleted_node.version - assert_equal true, deleted_node.visible + assert deleted_node.visible end # check that we can update a way @@ -1073,21 +1073,21 @@ module Api new_node = Node.find(new_node_id) assert_equal 1, new_node.version - assert_equal true, new_node.visible + assert new_node.visible assert_equal 4.56, new_node.lon assert_equal 12.34, new_node.lat assert_equal({ "test" => "new" }, new_node.tags) changed_node = Node.find(b) assert_equal 2, changed_node.version - assert_equal true, changed_node.visible + assert changed_node.visible assert_equal 12.34, changed_node.lon assert_equal 4.56, changed_node.lat assert_equal({ "test" => "ok" }, changed_node.tags) deleted_node = Node.find(d) assert_equal 2, deleted_node.version - assert_equal false, deleted_node.visible + assert_not deleted_node.visible end # check that we can delete a way @@ -1120,7 +1120,7 @@ module Api new_way = Way.find(way.id) assert_equal way.version + 1, new_way.version - assert_equal false, new_way.visible + assert_not new_way.visible way.nds.each do |node_id| assert_equal result[4][node_id.to_s].nil?, Node.find(node_id).visible @@ -1146,10 +1146,10 @@ module Api new_way = Way.find(way.id) assert_equal way.version, new_way.version - assert_equal true, new_way.visible + assert new_way.visible way.nds.each do |node_id| - assert_equal true, Node.find(node_id).visible + assert Node.find(node_id).visible end end @@ -1180,7 +1180,7 @@ module Api assert_equal 1, new_relation.version assert_equal [["Node", node.id, "node"], ["Way", way.id, "way"], ["Relation", relation.id, "relation"]], new_relation.members assert_equal({ "test" => "new" }, new_relation.tags) - assert_equal true, new_relation.visible + assert new_relation.visible end # check that we can update a relation @@ -1207,7 +1207,7 @@ module Api assert_equal relation.version + 1, new_relation.version assert_equal relation.members, new_relation.members assert_equal({ "test" => "ok" }, new_relation.tags) - assert_equal true, new_relation.visible + assert new_relation.visible end # check that we can delete a relation @@ -1234,7 +1234,7 @@ module Api assert_equal relation.version + 1, new_relation.version assert_equal [], new_relation.members assert_equal({}, new_relation.tags) - assert_equal false, new_relation.visible + assert_not new_relation.visible end # check that we can't delete a relation that is in use @@ -1258,7 +1258,7 @@ module Api assert_equal relation.version, new_relation.version assert_equal relation.members, new_relation.members assert_equal relation.tags, new_relation.tags - assert_equal true, new_relation.visible + assert new_relation.visible end # check that we can open a changeset @@ -1276,7 +1276,7 @@ module Api assert_equal "", result[1] cs = Changeset.find(new_cs_id) - assert_equal true, cs.is_open? + assert cs.is_open? assert_equal({ "comment" => "new", "source" => "new" }, cs.tags) old_cs_id = new_cs_id @@ -1294,11 +1294,11 @@ module Api assert_equal "", result[1] cs = Changeset.find(old_cs_id) - assert_equal false, cs.is_open? + assert_not cs.is_open? assert_equal({ "comment" => "newer", "source" => "new" }, cs.tags) cs = Changeset.find(new_cs_id) - assert_equal true, cs.is_open? + assert cs.is_open? assert_equal({ "comment" => "newer", "source" => "newer" }, cs.tags) old_cs_id = new_cs_id @@ -1314,7 +1314,7 @@ module Api assert_nil result[2] cs = Changeset.find(old_cs_id) - assert_equal false, cs.is_open? + assert_not cs.is_open? assert_equal({ "comment" => "newer", "source" => "newer" }, cs.tags) end @@ -1334,7 +1334,7 @@ module Api assert_equal "", result[1] cs = Changeset.find(cs_id) - assert_equal true, cs.is_open? + assert cs.is_open? assert_equal({ "comment" => "new", "source" => "new" }, cs.tags) post :amf_write, :body => amf_content("startchangeset", "/1", ["#{user2.email}:test", {}, cs_id, "delete", 0]) @@ -1347,7 +1347,7 @@ module Api assert_equal "The user doesn't own that changeset", result[1] cs = Changeset.find(cs_id) - assert_equal true, cs.is_open? + assert cs.is_open? assert_equal({ "comment" => "new", "source" => "new" }, cs.tags) end @@ -1369,7 +1369,7 @@ module Api assert_equal "", result[1] cs = Changeset.find(new_cs_id) - assert_equal true, cs.is_open? + assert cs.is_open? assert_equal({ "comment" => "foobar" }, cs.tags) end diff --git a/test/controllers/api/changeset_comments_controller_test.rb b/test/controllers/api/changeset_comments_controller_test.rb index 24228c28c..ba2068d84 100644 --- a/test/controllers/api/changeset_comments_controller_test.rb +++ b/test/controllers/api/changeset_comments_controller_test.rb @@ -125,38 +125,38 @@ module Api def test_destroy_comment_fail # unauthorized comment = create(:changeset_comment) - assert_equal true, comment.visible + assert comment.visible post :destroy, :params => { :id => comment.id } assert_response :unauthorized - assert_equal true, comment.reload.visible + assert comment.reload.visible basic_authorization create(:user).email, "test" # not a moderator post :destroy, :params => { :id => comment.id } assert_response :forbidden - assert_equal true, comment.reload.visible + assert comment.reload.visible basic_authorization create(:moderator_user).email, "test" # bad comment id post :destroy, :params => { :id => 999111 } assert_response :not_found - assert_equal true, comment.reload.visible + assert comment.reload.visible end ## # test hide comment succes def test_hide_comment_success comment = create(:changeset_comment) - assert_equal true, comment.visible + assert comment.visible basic_authorization create(:moderator_user).email, "test" post :destroy, :params => { :id => comment.id } assert_response :success - assert_equal false, comment.reload.visible + assert_not comment.reload.visible end ## @@ -164,38 +164,38 @@ module Api def test_restore_comment_fail # unauthorized comment = create(:changeset_comment, :visible => false) - assert_equal false, comment.visible + assert_not comment.visible post :restore, :params => { :id => comment.id } assert_response :unauthorized - assert_equal false, comment.reload.visible + assert_not comment.reload.visible basic_authorization create(:user).email, "test" # not a moderator post :restore, :params => { :id => comment.id } assert_response :forbidden - assert_equal false, comment.reload.visible + assert_not comment.reload.visible basic_authorization create(:moderator_user).email, "test" # bad comment id post :restore, :params => { :id => 999111 } assert_response :not_found - assert_equal false, comment.reload.visible + assert_not comment.reload.visible end ## # test unhide comment succes def test_unhide_comment_success comment = create(:changeset_comment, :visible => false) - assert_equal false, comment.visible + assert_not comment.visible basic_authorization create(:moderator_user).email, "test" post :restore, :params => { :id => comment.id } assert_response :success - assert_equal true, comment.reload.visible + assert comment.reload.visible end # This test ensures that token capabilities behave correctly for a method that diff --git a/test/controllers/api/changesets_controller_test.rb b/test/controllers/api/changesets_controller_test.rb index 7579ffee7..29b3d5dac 100644 --- a/test/controllers/api/changesets_controller_test.rb +++ b/test/controllers/api/changesets_controller_test.rb @@ -477,10 +477,10 @@ module Api assert_select "diffResult>relation", 2 # check that everything was deleted - assert_equal false, Node.find(used_node.id).visible - assert_equal false, Way.find(used_way.id).visible - assert_equal false, Relation.find(super_relation.id).visible - assert_equal false, Relation.find(used_relation.id).visible + assert_not Node.find(used_node.id).visible + assert_not Way.find(used_way.id).visible + assert_not Relation.find(super_relation.id).visible + assert_not Relation.find(used_relation.id).visible end ## @@ -502,7 +502,7 @@ module Api assert_select "diffResult>node", 1 # check that everything was deleted - assert_equal false, Node.find(node.id).visible + assert_not Node.find(node.id).visible end def test_repeated_changeset_create @@ -604,10 +604,10 @@ module Api assert_equal "Precondition failed: Way #{used_way.id} is still used by relations #{relation.id}.", @response.body # check that nothing was, in fact, deleted - assert_equal true, Node.find(used_node.id).visible - assert_equal true, Way.find(used_way.id).visible - assert_equal true, Relation.find(relation.id).visible - assert_equal true, Relation.find(other_relation.id).visible + assert Node.find(used_node.id).visible + assert Way.find(used_way.id).visible + assert Relation.find(relation.id).visible + assert Relation.find(other_relation.id).visible end ## @@ -670,9 +670,9 @@ module Api assert_equal used_relation.version, doc.find("//diffResult/relation").first["new_version"].to_i # check that nothing was, in fact, deleted - assert_equal true, Node.find(used_node.id).visible - assert_equal true, Way.find(used_way.id).visible - assert_equal true, Relation.find(used_relation.id).visible + assert Node.find(used_node.id).visible + assert Way.find(used_way.id).visible + assert Relation.find(used_relation.id).visible end ## diff --git a/test/controllers/api/nodes_controller_test.rb b/test/controllers/api/nodes_controller_test.rb index e2174a126..5720ccb1f 100644 --- a/test/controllers/api/nodes_controller_test.rb +++ b/test/controllers/api/nodes_controller_test.rb @@ -82,7 +82,7 @@ module Api assert_in_delta lat * 10000000, checknode.latitude, 1, "saved node does not match requested latitude" assert_in_delta lon * 10000000, checknode.longitude, 1, "saved node does not match requested longitude" assert_equal changeset.id, checknode.changeset_id, "saved node does not belong to changeset that it was created in" - assert_equal true, checknode.visible, "saved node is not visible" + assert checknode.visible, "saved node is not visible" end def test_create_invalid_xml @@ -494,7 +494,7 @@ module Api # test adding tags to a node def test_duplicate_tags existing_tag = create(:node_tag) - assert_equal true, existing_tag.node.changeset.user.data_public + assert existing_tag.node.changeset.user.data_public # setup auth basic_authorization existing_tag.node.changeset.user.email, "test" @@ -556,7 +556,7 @@ module Api # check the tags are not corrupted assert_equal checknode.tags, apinode.tags - assert apinode.tags.include?("\#{@user.inspect}") + assert_includes apinode.tags, "\#{@user.inspect}" end ## diff --git a/test/controllers/api/relations_controller_test.rb b/test/controllers/api/relations_controller_test.rb index da18099bd..5116ddb02 100644 --- a/test/controllers/api/relations_controller_test.rb +++ b/test/controllers/api/relations_controller_test.rb @@ -304,8 +304,8 @@ module Api "saved relation does not belong in the changeset it was assigned to" assert_equal user.id, checkrelation.changeset.user_id, "saved relation does not belong to user that created it" - assert_equal true, checkrelation.visible, - "saved relation is not visible" + assert checkrelation.visible, + "saved relation is not visible" # ok the relation is there but can we also retrieve it? get :show, :params => { :id => relationid } assert_response :success @@ -334,8 +334,8 @@ module Api "saved relation does not belong in the changeset it was assigned to" assert_equal user.id, checkrelation.changeset.user_id, "saved relation does not belong to user that created it" - assert_equal true, checkrelation.visible, - "saved relation is not visible" + assert checkrelation.visible, + "saved relation is not visible" # ok the relation is there but can we also retrieve it? get :show, :params => { :id => relationid } @@ -364,8 +364,8 @@ module Api "saved relation does not belong in the changeset it was assigned to" assert_equal user.id, checkrelation.changeset.user_id, "saved relation does not belong to user that created it" - assert_equal true, checkrelation.visible, - "saved relation is not visible" + assert checkrelation.visible, + "saved relation is not visible" # ok the relation is there but can we also retrieve it? get :show, :params => { :id => relationid } @@ -395,8 +395,8 @@ module Api "saved relation does not belong in the changeset it was assigned to" assert_equal user.id, checkrelation.changeset.user_id, "saved relation does not belong to user that created it" - assert_equal true, checkrelation.visible, - "saved relation is not visible" + assert checkrelation.visible, + "saved relation is not visible" # ok the relation is there but can we also retrieve it? get :show, :params => { :id => relationid } assert_response :success diff --git a/test/controllers/api/traces_controller_test.rb b/test/controllers/api/traces_controller_test.rb index 88c6fa90f..14136ec20 100644 --- a/test/controllers/api/traces_controller_test.rb +++ b/test/controllers/api/traces_controller_test.rb @@ -210,7 +210,7 @@ module Api assert_equal "New Trace", trace.description assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag) assert_equal "trackable", trace.visibility - assert_equal false, trace.inserted + assert_not trace.inserted assert_equal File.new(fixture).read, File.new(trace.trace_name).read trace.destroy assert_equal "trackable", user.preferences.where(:k => "gps.trace.visibility").first.v @@ -228,7 +228,7 @@ module Api assert_equal "New Trace", trace.description assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag) assert_equal "public", trace.visibility - assert_equal false, trace.inserted + assert_not trace.inserted assert_equal File.new(fixture).read, File.new(trace.trace_name).read trace.destroy assert_equal "public", user.preferences.where(:k => "gps.trace.visibility").first.v @@ -247,7 +247,7 @@ module Api assert_equal "New Trace", trace.description assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag) assert_equal "private", trace.visibility - assert_equal false, trace.inserted + assert_not trace.inserted assert_equal File.new(fixture).read, File.new(trace.trace_name).read trace.destroy assert_equal "private", second_user.preferences.where(:k => "gps.trace.visibility").first.v diff --git a/test/controllers/api/ways_controller_test.rb b/test/controllers/api/ways_controller_test.rb index e4b9f3663..ae7f18161 100644 --- a/test/controllers/api/ways_controller_test.rb +++ b/test/controllers/api/ways_controller_test.rb @@ -190,8 +190,8 @@ module Api "saved way does not belong to the correct changeset" assert_equal user.id, checkway.changeset.user_id, "saved way does not belong to user that created it" - assert_equal true, checkway.visible, - "saved way is not visible" + assert checkway.visible, + "saved way is not visible" end # ------------------------------------- diff --git a/test/controllers/diary_entries_controller_test.rb b/test/controllers/diary_entries_controller_test.rb index 0f071914e..8996e40ee 100644 --- a/test/controllers/diary_entries_controller_test.rb +++ b/test/controllers/diary_entries_controller_test.rb @@ -740,7 +740,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase post :hide, :params => { :display_name => user.display_name, :id => diary_entry.id } assert_response :forbidden - assert_equal true, DiaryEntry.find(diary_entry.id).visible + assert DiaryEntry.find(diary_entry.id).visible # Now try as a normal user post :hide, @@ -748,7 +748,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => user } assert_response :redirect assert_redirected_to :controller => :errors, :action => :forbidden - assert_equal true, DiaryEntry.find(diary_entry.id).visible + assert DiaryEntry.find(diary_entry.id).visible # Now try as a moderator post :hide, @@ -756,7 +756,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => create(:moderator_user) } assert_response :redirect assert_redirected_to :action => :index, :display_name => user.display_name - assert_equal false, DiaryEntry.find(diary_entry.id).visible + assert_not DiaryEntry.find(diary_entry.id).visible # Reset diary_entry.reload.update(:visible => true) @@ -767,7 +767,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => create(:administrator_user) } assert_response :redirect assert_redirected_to :action => :index, :display_name => user.display_name - assert_equal false, DiaryEntry.find(diary_entry.id).visible + assert_not DiaryEntry.find(diary_entry.id).visible end def test_unhide @@ -778,7 +778,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase post :unhide, :params => { :display_name => user.display_name, :id => diary_entry.id } assert_response :forbidden - assert_equal false, DiaryEntry.find(diary_entry.id).visible + assert_not DiaryEntry.find(diary_entry.id).visible # Now try as a normal user post :unhide, @@ -786,7 +786,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => user } assert_response :redirect assert_redirected_to :controller => :errors, :action => :forbidden - assert_equal false, DiaryEntry.find(diary_entry.id).visible + assert_not DiaryEntry.find(diary_entry.id).visible # Finally try as an administrator post :unhide, @@ -794,7 +794,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => create(:administrator_user) } assert_response :redirect assert_redirected_to :action => :index, :display_name => user.display_name - assert_equal true, DiaryEntry.find(diary_entry.id).visible + assert DiaryEntry.find(diary_entry.id).visible end def test_hidecomment @@ -806,7 +806,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase post :hidecomment, :params => { :display_name => user.display_name, :id => diary_entry.id, :comment => diary_comment.id } assert_response :forbidden - assert_equal true, DiaryComment.find(diary_comment.id).visible + assert DiaryComment.find(diary_comment.id).visible # Now try as a normal user post :hidecomment, @@ -814,7 +814,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => user } assert_response :redirect assert_redirected_to :controller => :errors, :action => :forbidden - assert_equal true, DiaryComment.find(diary_comment.id).visible + assert DiaryComment.find(diary_comment.id).visible # Try as a moderator post :hidecomment, @@ -822,7 +822,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => create(:moderator_user) } assert_response :redirect assert_redirected_to :action => :show, :display_name => user.display_name, :id => diary_entry.id - assert_equal false, DiaryComment.find(diary_comment.id).visible + assert_not DiaryComment.find(diary_comment.id).visible # Reset diary_comment.reload.update(:visible => true) @@ -833,7 +833,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => create(:administrator_user) } assert_response :redirect assert_redirected_to :action => :show, :display_name => user.display_name, :id => diary_entry.id - assert_equal false, DiaryComment.find(diary_comment.id).visible + assert_not DiaryComment.find(diary_comment.id).visible end def test_unhidecomment @@ -845,7 +845,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase post :unhidecomment, :params => { :display_name => user.display_name, :id => diary_entry.id, :comment => diary_comment.id } assert_response :forbidden - assert_equal false, DiaryComment.find(diary_comment.id).visible + assert_not DiaryComment.find(diary_comment.id).visible # Now try as a normal user post :unhidecomment, @@ -853,7 +853,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => user } assert_response :redirect assert_redirected_to :controller => :errors, :action => :forbidden - assert_equal false, DiaryComment.find(diary_comment.id).visible + assert_not DiaryComment.find(diary_comment.id).visible # Finally try as an administrator post :unhidecomment, @@ -861,7 +861,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase :session => { :user => administrator_user } assert_response :redirect assert_redirected_to :action => :show, :display_name => user.display_name, :id => diary_entry.id - assert_equal true, DiaryComment.find(diary_comment.id).visible + assert DiaryComment.find(diary_comment.id).visible end def test_comments diff --git a/test/controllers/issues_controller_test.rb b/test/controllers/issues_controller_test.rb index d16f66455..141c7b20d 100644 --- a/test/controllers/issues_controller_test.rb +++ b/test/controllers/issues_controller_test.rb @@ -42,7 +42,7 @@ class IssuesControllerTest < ActionController::TestCase # Access issue as administrator session[:user] = create(:administrator_user).id get :show, :params => { :id => issue.id } - assert_response :not_found + assert_redirected_to :controller => :errors, :action => :not_found # Access issue as moderator session[:user] = create(:moderator_user).id @@ -68,7 +68,7 @@ class IssuesControllerTest < ActionController::TestCase # Access issue as moderator session[:user] = create(:moderator_user).id get :show, :params => { :id => issue.id } - assert_response :not_found + assert_redirected_to :controller => :errors, :action => :not_found # Access issue as administrator session[:user] = create(:administrator_user).id @@ -94,14 +94,14 @@ class IssuesControllerTest < ActionController::TestCase # Resolve issue as administrator session[:user] = create(:administrator_user).id get :resolve, :params => { :id => issue.id } - assert_response :not_found - assert_equal false, issue.reload.resolved? + assert_redirected_to :controller => :errors, :action => :not_found + assert_not issue.reload.resolved? # Resolve issue as moderator session[:user] = create(:moderator_user).id get :resolve, :params => { :id => issue.id } assert_response :redirect - assert_equal true, issue.reload.resolved? + assert issue.reload.resolved? end def test_resolve_administrator @@ -122,14 +122,14 @@ class IssuesControllerTest < ActionController::TestCase # Resolve issue as moderator session[:user] = create(:moderator_user).id get :resolve, :params => { :id => issue.id } - assert_response :not_found - assert_equal false, issue.reload.resolved? + assert_redirected_to :controller => :errors, :action => :not_found + assert_not issue.reload.resolved? # Resolve issue as administrator session[:user] = create(:administrator_user).id get :resolve, :params => { :id => issue.id } assert_response :redirect - assert_equal true, issue.reload.resolved? + assert issue.reload.resolved? end def test_ignore_moderator @@ -150,14 +150,14 @@ class IssuesControllerTest < ActionController::TestCase # Ignore issue as administrator session[:user] = create(:administrator_user).id get :ignore, :params => { :id => issue.id } - assert_response :not_found - assert_equal false, issue.reload.ignored? + assert_redirected_to :controller => :errors, :action => :not_found + assert_not issue.reload.ignored? # Ignore issue as moderator session[:user] = create(:moderator_user).id get :ignore, :params => { :id => issue.id } assert_response :redirect - assert_equal true, issue.reload.ignored? + assert issue.reload.ignored? end def test_ignore_administrator @@ -178,14 +178,14 @@ class IssuesControllerTest < ActionController::TestCase # Ignore issue as moderator session[:user] = create(:moderator_user).id get :ignore, :params => { :id => issue.id } - assert_response :not_found - assert_equal false, issue.reload.ignored? + assert_redirected_to :controller => :errors, :action => :not_found + assert_not issue.reload.ignored? # Ignore issue as administrator session[:user] = create(:administrator_user).id get :ignore, :params => { :id => issue.id } assert_response :redirect - assert_equal true, issue.reload.ignored? + assert issue.reload.ignored? end def test_reopen_moderator @@ -208,14 +208,14 @@ class IssuesControllerTest < ActionController::TestCase # Reopen issue as administrator session[:user] = create(:administrator_user).id get :reopen, :params => { :id => issue.id } - assert_response :not_found - assert_equal false, issue.reload.open? + assert_redirected_to :controller => :errors, :action => :not_found + assert_not issue.reload.open? # Reopen issue as moderator session[:user] = create(:moderator_user).id get :reopen, :params => { :id => issue.id } assert_response :redirect - assert_equal true, issue.reload.open? + assert issue.reload.open? end def test_reopen_administrator @@ -238,13 +238,13 @@ class IssuesControllerTest < ActionController::TestCase # Reopen issue as moderator session[:user] = create(:moderator_user).id get :reopen, :params => { :id => issue.id } - assert_response :not_found - assert_equal false, issue.reload.open? + assert_redirected_to :controller => :errors, :action => :not_found + assert_not issue.reload.open? # Reopen issue as administrator session[:user] = create(:administrator_user).id get :reopen, :params => { :id => issue.id } assert_response :redirect - assert_equal true, issue.reload.open? + assert issue.reload.open? end end diff --git a/test/controllers/messages_controller_test.rb b/test/controllers/messages_controller_test.rb index 35bd4dc9f..d07f6c83d 100644 --- a/test/controllers/messages_controller_test.rb +++ b/test/controllers/messages_controller_test.rb @@ -266,7 +266,7 @@ class MessagesControllerTest < ActionController::TestCase assert_select "textarea#message_body", :count => 1 assert_select "input[type='submit'][value='Send']", :count => 1 end - assert_equal true, Message.find(unread_message.id).message_read + assert Message.find(unread_message.id).message_read # Asking to reply to a message with no ID should fail assert_raise ActionController::UrlGenerationError do @@ -306,7 +306,7 @@ class MessagesControllerTest < ActionController::TestCase get :show, :params => { :id => unread_message.id } assert_response :success assert_template "show" - assert_equal false, Message.find(unread_message.id).message_read + assert_not Message.find(unread_message.id).message_read # Login as the message recipient session[:user] = recipient_user.id @@ -315,7 +315,7 @@ class MessagesControllerTest < ActionController::TestCase get :show, :params => { :id => unread_message.id } assert_response :success assert_template "show" - assert_equal true, Message.find(unread_message.id).message_read + assert Message.find(unread_message.id).message_read # Asking to read a message with no ID should fail assert_raise ActionController::UrlGenerationError do @@ -399,24 +399,24 @@ class MessagesControllerTest < ActionController::TestCase # Check that the marking a message read works post :mark, :params => { :message_id => unread_message.id, :mark => "read" } assert_redirected_to inbox_messages_path - assert_equal true, Message.find(unread_message.id).message_read + assert Message.find(unread_message.id).message_read # Check that the marking a message unread works post :mark, :params => { :message_id => unread_message.id, :mark => "unread" } assert_redirected_to inbox_messages_path - assert_equal false, Message.find(unread_message.id).message_read + assert_not Message.find(unread_message.id).message_read # Check that the marking a message read via XHR works post :mark, :xhr => true, :params => { :message_id => unread_message.id, :mark => "read" } assert_response :success assert_template "mark" - assert_equal true, Message.find(unread_message.id).message_read + assert Message.find(unread_message.id).message_read # Check that the marking a message unread via XHR works post :mark, :xhr => true, :params => { :message_id => unread_message.id, :mark => "unread" } assert_response :success assert_template "mark" - assert_equal false, Message.find(unread_message.id).message_read + assert_not Message.find(unread_message.id).message_read # Asking to mark a message with no ID should fail assert_raise ActionController::UrlGenerationError do @@ -458,16 +458,16 @@ class MessagesControllerTest < ActionController::TestCase assert_redirected_to inbox_messages_path assert_equal "Message deleted", flash[:notice] m = Message.find(read_message.id) - assert_equal true, m.from_user_visible - assert_equal false, m.to_user_visible + assert m.from_user_visible + assert_not m.to_user_visible # Check that the destroying a sent message works delete :destroy, :params => { :id => sent_message.id, :referer => outbox_messages_path } assert_redirected_to outbox_messages_path assert_equal "Message deleted", flash[:notice] m = Message.find(sent_message.id) - assert_equal false, m.from_user_visible - assert_equal true, m.to_user_visible + assert_not m.from_user_visible + assert m.to_user_visible # Asking to destroy a message with no ID should fail assert_raise ActionController::UrlGenerationError do diff --git a/test/controllers/traces_controller_test.rb b/test/controllers/traces_controller_test.rb index 7e13ff54f..7765bde46 100644 --- a/test/controllers/traces_controller_test.rb +++ b/test/controllers/traces_controller_test.rb @@ -565,7 +565,7 @@ class TracesControllerTest < ActionController::TestCase assert_equal "New Trace", trace.description assert_equal %w[new trace], trace.tags.order(:tag).collect(&:tag) assert_equal "trackable", trace.visibility - assert_equal false, trace.inserted + assert_not trace.inserted assert_equal File.new(fixture).read, File.new(trace.trace_name).read trace.destroy assert_equal "trackable", user.preferences.where(:k => "gps.trace.visibility").first.v @@ -673,7 +673,7 @@ class TracesControllerTest < ActionController::TestCase assert_response :redirect assert_redirected_to :action => :index, :display_name => public_trace_file.user.display_name trace = Trace.find(public_trace_file.id) - assert_equal false, trace.visible + assert_not trace.visible # Finally with a trace that is destroyed by an admin public_trace_file = create(:trace, :visibility => "public") @@ -683,7 +683,7 @@ class TracesControllerTest < ActionController::TestCase assert_response :redirect assert_redirected_to :action => :index, :display_name => public_trace_file.user.display_name trace = Trace.find(public_trace_file.id) - assert_equal false, trace.visible + assert_not trace.visible end private diff --git a/test/controllers/user_blocks_controller_test.rb b/test/controllers/user_blocks_controller_test.rb index 326f2335a..5338858f7 100644 --- a/test/controllers/user_blocks_controller_test.rb +++ b/test/controllers/user_blocks_controller_test.rb @@ -120,7 +120,7 @@ class UserBlocksControllerTest < ActionController::TestCase # Viewing an active block should work, but shouldn't mark it as seen get :show, :params => { :id => active_block.id } assert_response :success - assert_equal true, UserBlock.find(active_block.id).needs_view + assert UserBlock.find(active_block.id).needs_view # Login as the blocked user session[:user] = active_block.user.id @@ -128,7 +128,7 @@ class UserBlocksControllerTest < ActionController::TestCase # Now viewing it should mark it as seen get :show, :params => { :id => active_block.id } assert_response :success - assert_equal false, UserBlock.find(active_block.id).needs_view + assert_not UserBlock.find(active_block.id).needs_view end ## @@ -261,7 +261,7 @@ class UserBlocksControllerTest < ActionController::TestCase assert_in_delta Time.now, b.created_at, 1 assert_in_delta Time.now, b.updated_at, 1 assert_in_delta Time.now + 12.hours, b.ends_at, 1 - assert_equal false, b.needs_view + assert_not b.needs_view assert_equal "Vandalism", b.reason assert_equal "markdown", b.reason_format assert_equal moderator_user.id, b.creator_id @@ -334,7 +334,7 @@ class UserBlocksControllerTest < ActionController::TestCase assert_equal "Block updated.", flash[:notice] b = UserBlock.find(active_block.id) assert_in_delta Time.now, b.updated_at, 1 - assert_equal true, b.needs_view + assert b.needs_view assert_equal "Vandalism", b.reason # We should get an error if no block ID is specified diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 8f3471baa..a0d85ada3 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -632,9 +632,9 @@ class UsersControllerTest < ActionController::TestCase user.reload - assert_equal true, user.consider_pd + assert user.consider_pd assert_not_nil user.terms_agreed - assert_equal true, user.terms_seen + assert user.terms_seen end def test_terms_not_seen_with_referer @@ -653,9 +653,9 @@ class UsersControllerTest < ActionController::TestCase user.reload - assert_equal true, user.consider_pd + assert user.consider_pd assert_not_nil user.terms_agreed - assert_equal true, user.terms_seen + assert user.terms_seen end # Check that if you haven't seen the terms, and make a request that requires authentication, @@ -674,7 +674,7 @@ class UsersControllerTest < ActionController::TestCase post :go_public, :session => { :user => user } assert_response :redirect assert_redirected_to :action => :account, :display_name => user.display_name - assert_equal true, User.find(user.id).data_public + assert User.find(user.id).data_public end def test_lost_password @@ -792,7 +792,7 @@ class UsersControllerTest < ActionController::TestCase assert_equal user.id, session[:user] user.reload assert_equal "active", user.status - assert_equal true, user.email_valid + assert user.email_valid assert_equal user, User.authenticate(:username => user.email, :password => "new_password") end @@ -1304,8 +1304,8 @@ class UsersControllerTest < ActionController::TestCase assert_equal "", user.description assert_nil user.home_lat assert_nil user.home_lon - assert_equal false, user.avatar.attached? - assert_equal false, user.email_valid + assert_not user.avatar.attached? + assert_not user.email_valid assert_nil user.new_email assert_nil user.auth_provider assert_nil user.auth_uid diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index dc45a6c07..fe4587b87 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -16,11 +16,11 @@ class ApplicationHelperTest < ActionView::TestCase text = "Test #{link} is made into a link" html = linkify(text) - assert_equal true, html.html_safe? + assert html.html_safe? assert_dom_equal "Test #{link} is <b>made</b> into a link", html html = linkify(text.html_safe) - assert_equal true, html.html_safe? + assert html.html_safe? assert_dom_equal "Test #{link} is made into a link", html end @@ -28,11 +28,11 @@ class ApplicationHelperTest < ActionView::TestCase text = "Test #{link} is not made into a link" html = linkify(text) - assert_equal true, html.html_safe? + assert html.html_safe? assert_dom_equal "Test #{link} is not <b>made</b> into a link", html html = linkify(text.html_safe) - assert_equal true, html.html_safe? + assert html.html_safe? assert_dom_equal "Test #{link} is not made into a link", html end end diff --git a/test/helpers/browse_helper_test.rb b/test/helpers/browse_helper_test.rb index 9c666c0b8..4f05d5f7a 100644 --- a/test/helpers/browse_helper_test.rb +++ b/test/helpers/browse_helper_test.rb @@ -112,24 +112,24 @@ class BrowseHelperTest < ActionView::TestCase tags = icon_tags(node) assert_equal 3, tags.count - assert tags.include?(%w[building yes]) - assert tags.include?(%w[tourism museum]) - assert tags.include?(%w[shop gift]) + assert_includes tags, %w[building yes] + assert_includes tags, %w[tourism museum] + assert_includes tags, %w[shop gift] add_old_tags_selection(node_v2) add_old_tags_selection(node_v1) tags = icon_tags(node_v2) assert_equal 3, tags.count - assert tags.include?(%w[building yes]) - assert tags.include?(%w[tourism museum]) - assert tags.include?(%w[shop gift]) + assert_includes tags, %w[building yes] + assert_includes tags, %w[tourism museum] + assert_includes tags, %w[shop gift] tags = icon_tags(node_v1) assert_equal 3, tags.count - assert tags.include?(%w[building yes]) - assert tags.include?(%w[tourism museum]) - assert tags.include?(%w[shop gift]) + assert_includes tags, %w[building yes] + assert_includes tags, %w[tourism museum] + assert_includes tags, %w[shop gift] end def add_old_tags_selection(old_node) diff --git a/test/lib/i18n_test.rb b/test/lib/i18n_test.rb index cdfd234af..8145c3613 100644 --- a/test/lib/i18n_test.rb +++ b/test/lib/i18n_test.rb @@ -36,19 +36,19 @@ class I18nTest < ActiveSupport::TestCase next if subvalue.nil? subvalue.scan(/%\{(\w+)\}/) do - assert variables.include?(Regexp.last_match(1)), "#{key}.#{subkey} uses unknown interpolation variable #{Regexp.last_match(1)}" + assert_includes variables, Regexp.last_match(1), "#{key}.#{subkey} uses unknown interpolation variable #{Regexp.last_match(1)}" end end else assert value.is_a?(String), "#{key} is not a string" value.scan(/%\{(\w+)\}/) do - assert variables.include?(Regexp.last_match(1)), "#{key} uses unknown interpolation variable #{Regexp.last_match(1)}" + assert_includes variables, Regexp.last_match(1), "#{key} uses unknown interpolation variable #{Regexp.last_match(1)}" end end end - assert %w[ltr rtl].include?(I18n.t("html.dir", :locale => locale)), "html.dir must be ltr or rtl" + assert_includes %w[ltr rtl], I18n.t("html.dir", :locale => locale), "html.dir must be ltr or rtl" end end end diff --git a/test/lib/locale_test.rb b/test/lib/locale_test.rb index 65c7ea398..4d4571160 100644 --- a/test/lib/locale_test.rb +++ b/test/lib/locale_test.rb @@ -92,8 +92,8 @@ class LocaleTest < ActiveSupport::TestCase assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-Hant-TW", "de")).to_s assert_equal "zh-TW", Locale.available.preferred(Locale.list("zh-TW", "de")).to_s assert_equal "zh-HK", Locale.available.preferred(Locale.list("yue", "zh-HK", "de")).to_s - assert_equal "zh-yue", Locale.available. preferred(Locale.list("yue", "zh-yue", "zh-HK", "de")).to_s - assert_equal "zh-yue", Locale.available. preferred(Locale.list("yue", "zh-YUE", "zh-HK", "de")).to_s + assert_equal "zh-yue", Locale.available.preferred(Locale.list("yue", "zh-yue", "zh-HK", "de")).to_s + assert_equal "zh-yue", Locale.available.preferred(Locale.list("yue", "zh-YUE", "zh-HK", "de")).to_s assert_equal "en", Locale.available.preferred(Locale.list("yue")).to_s end end diff --git a/test/lib/password_hash_test.rb b/test/lib/password_hash_test.rb index 6f54a0d7a..1440b35c4 100644 --- a/test/lib/password_hash_test.rb +++ b/test/lib/password_hash_test.rb @@ -2,30 +2,30 @@ require "test_helper" class PasswordHashTest < ActiveSupport::TestCase def test_md5_without_salt - assert_equal true, PasswordHash.check("5f4dcc3b5aa765d61d8327deb882cf99", nil, "password") - assert_equal false, PasswordHash.check("5f4dcc3b5aa765d61d8327deb882cf99", nil, "wrong") - assert_equal true, PasswordHash.upgrade?("5f4dcc3b5aa765d61d8327deb882cf99", nil) + assert PasswordHash.check("5f4dcc3b5aa765d61d8327deb882cf99", nil, "password") + assert_not PasswordHash.check("5f4dcc3b5aa765d61d8327deb882cf99", nil, "wrong") + assert PasswordHash.upgrade?("5f4dcc3b5aa765d61d8327deb882cf99", nil) end def test_md5_with_salt - assert_equal true, PasswordHash.check("67a1e09bb1f83f5007dc119c14d663aa", "salt", "password") - assert_equal false, PasswordHash.check("67a1e09bb1f83f5007dc119c14d663aa", "salt", "wrong") - assert_equal false, PasswordHash.check("67a1e09bb1f83f5007dc119c14d663aa", "wrong", "password") - assert_equal true, PasswordHash.upgrade?("67a1e09bb1f83f5007dc119c14d663aa", "salt") + assert PasswordHash.check("67a1e09bb1f83f5007dc119c14d663aa", "salt", "password") + assert_not PasswordHash.check("67a1e09bb1f83f5007dc119c14d663aa", "salt", "wrong") + assert_not PasswordHash.check("67a1e09bb1f83f5007dc119c14d663aa", "wrong", "password") + assert 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=") + assert PasswordHash.check("ApT/28+FsTBLa/J8paWfgU84SoRiTfeY8HjKWhgHy08=", "sha512!1000!HR4z+hAvKV2ra1gpbRybtoNzm/CNKe4cf7bPKwdUNrk=", "password") + assert_not PasswordHash.check("ApT/28+FsTBLa/J8paWfgU84SoRiTfeY8HjKWhgHy08=", "sha512!1000!HR4z+hAvKV2ra1gpbRybtoNzm/CNKe4cf7bPKwdUNrk=", "wrong") + assert_not PasswordHash.check("ApT/28+FsTBLa/J8paWfgU84SoRiTfeY8HjKWhgHy08=", "sha512!1000!HR4z+hAvKV2ra1gwrongtoNzm/CNKe4cf7bPKwdUNrk=", "password") + assert 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=") + assert PasswordHash.check("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtM7eD8huvanFT5/WtWaCwdOdrir8QOtFwxhO0A=", "password") + assert_not PasswordHash.check("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtM7eD8huvanFT5/WtWaCwdOdrir8QOtFwxhO0A=", "wrong") + assert_not PasswordHash.check("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtMwronguvanFT5/WtWaCwdOdrir8QOtFwxhO0A=", "password") + assert_not PasswordHash.upgrade?("3wYbPiOxk/tU0eeIDjUhdvi8aDP3AbFtwYKKxF1IhGg=", "sha512!10000!OUQLgtM7eD8huvanFT5/WtWaCwdOdrir8QOtFwxhO0A=") end def test_default @@ -33,11 +33,11 @@ class PasswordHashTest < ActiveSupport::TestCase hash2, salt2 = PasswordHash.create("password") assert_not_equal hash1, hash2 assert_not_equal salt1, salt2 - assert_equal true, PasswordHash.check(hash1, salt1, "password") - assert_equal false, PasswordHash.check(hash1, salt1, "wrong") - assert_equal true, PasswordHash.check(hash2, salt2, "password") - assert_equal false, PasswordHash.check(hash2, salt2, "wrong") - assert_equal false, PasswordHash.upgrade?(hash1, salt1) - assert_equal false, PasswordHash.upgrade?(hash2, salt2) + assert PasswordHash.check(hash1, salt1, "password") + assert_not PasswordHash.check(hash1, salt1, "wrong") + assert PasswordHash.check(hash2, salt2, "password") + assert_not PasswordHash.check(hash2, salt2, "wrong") + assert_not PasswordHash.upgrade?(hash1, salt1) + assert_not PasswordHash.upgrade?(hash2, salt2) end end diff --git a/test/lib/utf8_test.rb b/test/lib/utf8_test.rb index 4ad6f0c9e..d90d5efa9 100644 --- a/test/lib/utf8_test.rb +++ b/test/lib/utf8_test.rb @@ -2,16 +2,16 @@ require "test_helper" class UTF8Test < ActiveSupport::TestCase def test_valid? - assert_equal true, UTF8.valid?("test") - assert_equal true, UTF8.valid?("vergrößern") - assert_equal true, UTF8.valid?("ルシステムにも対応します") - assert_equal true, UTF8.valid?("輕觸搖晃的遊戲") + assert UTF8.valid?("test") + assert UTF8.valid?("vergrößern") + assert UTF8.valid?("ルシステムにも対応します") + assert UTF8.valid?("輕觸搖晃的遊戲") - assert_equal false, UTF8.valid?("\xC0") # always invalid utf8 - assert_equal false, UTF8.valid?("\xC2\x4a") # 2-byte multibyte identifier, followed by plain ASCII - assert_equal false, UTF8.valid?("\xC2\xC2") # 2-byte multibyte identifier, followed by another one - assert_equal false, UTF8.valid?("\x4a\x82") # plain ASCII, followed by multibyte continuation - assert_equal false, UTF8.valid?("\x82\x82") # multibyte continuations without multibyte identifier - assert_equal false, UTF8.valid?("\xe1\x82\x4a") # three-byte identifier, contination and (incorrectly) plain ASCII + assert_not UTF8.valid?("\xC0") # always invalid utf8 + assert_not UTF8.valid?("\xC2\x4a") # 2-byte multibyte identifier, followed by plain ASCII + assert_not UTF8.valid?("\xC2\xC2") # 2-byte multibyte identifier, followed by another one + assert_not UTF8.valid?("\x4a\x82") # plain ASCII, followed by multibyte continuation + assert_not UTF8.valid?("\x82\x82") # multibyte continuations without multibyte identifier + assert_not UTF8.valid?("\xe1\x82\x4a") # three-byte identifier, contination and (incorrectly) plain ASCII end end diff --git a/test/models/client_application_test.rb b/test/models/client_application_test.rb index 8e5b21aff..c0b7b7977 100644 --- a/test/models/client_application_test.rb +++ b/test/models/client_application_test.rb @@ -3,7 +3,7 @@ require "test_helper" class ClientApplicationTest < ActiveSupport::TestCase def test_url_valid ok = ["http://example.com/test", "https://example.com/test"] - bad = ["", "ftp://example.com/test", "myapp://somewhere"] + bad = ["", "ftp://example.com/test", "myapp://somewhere", "http://example.com\nhttp://example.net"] ok.each do |url| app = build(:client_application) @@ -20,7 +20,7 @@ class ClientApplicationTest < ActiveSupport::TestCase def test_support_url_valid ok = ["", "http://example.com/test", "https://example.com/test"] - bad = ["ftp://example.com/test", "myapp://somewhere", "gibberish"] + bad = ["ftp://example.com/test", "myapp://somewhere", "gibberish", "http://example.com\nhttp://example.net"] ok.each do |url| app = build(:client_application) @@ -37,7 +37,7 @@ class ClientApplicationTest < ActiveSupport::TestCase def test_callback_url_valid ok = ["", "http://example.com/test", "https://example.com/test", "ftp://example.com/test", "myapp://somewhere"] - bad = ["gibberish"] + bad = ["gibberish", "http://example.com\nhttp://example.net"] ok.each do |url| app = build(:client_application) diff --git a/test/models/node_test.rb b/test/models/node_test.rb index e8a572fd8..5733d5063 100644 --- a/test/models/node_test.rb +++ b/test/models/node_test.rb @@ -4,55 +4,55 @@ class NodeTest < ActiveSupport::TestCase def test_node_too_far_north node = build(:node, :latitude => 90.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_north_limit node = build(:node, :latitude => 90 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_node_too_far_south node = build(:node, :latitude => -90.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_south_limit node = build(:node, :latitude => -90 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_node_too_far_west node = build(:node, :longitude => -180.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_west_limit node = build(:node, :longitude => -180 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_node_too_far_east node = build(:node, :longitude => 180.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_east_limit node = build(:node, :longitude => 180 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_totally_wrong node = build(:node, :latitude => 200 * OldNode::SCALE, :longitude => 200 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_lat_lon @@ -147,7 +147,7 @@ class NodeTest < ActiveSupport::TestCase assert_equal node_template.latitude, node.latitude assert_equal node_template.longitude, node.longitude assert_equal node_template.changeset_id, node.changeset_id - assert_equal false, node.visible + assert_not node.visible # assert_equal node_template.tags, node.tags assert_equal OldNode.where(:node_id => node_template.id).count, 2 @@ -156,7 +156,7 @@ class NodeTest < ActiveSupport::TestCase assert_equal node_template.latitude, old_node.latitude assert_equal node_template.longitude, old_node.longitude assert_equal node_template.changeset_id, old_node.changeset_id - assert_equal false, old_node.visible + assert_not old_node.visible # assert_equal node_template.tags, old_node.tags end diff --git a/test/models/note_test.rb b/test/models/note_test.rb index 2010fe202..2385125b5 100644 --- a/test/models/note_test.rb +++ b/test/models/note_test.rb @@ -37,14 +37,14 @@ class NoteTest < ActiveSupport::TestCase end def test_visible? - assert_equal true, create(:note, :status => "open").visible? - assert_equal true, create(:note, :status => "closed").visible? - assert_equal false, create(:note, :status => "hidden").visible? + assert create(:note, :status => "open").visible? + assert create(:note, :status => "closed").visible? + assert_not create(:note, :status => "hidden").visible? end def test_closed? - assert_equal true, create(:note, :status => "closed", :closed_at => Time.now).closed? - assert_equal false, create(:note, :status => "open", :closed_at => nil).closed? + assert create(:note, :status => "closed", :closed_at => Time.now).closed? + assert_not create(:note, :status => "open", :closed_at => nil).closed? end def test_author diff --git a/test/models/oauth_nonce_test.rb b/test/models/oauth_nonce_test.rb index dd97278c1..56178fb5f 100644 --- a/test/models/oauth_nonce_test.rb +++ b/test/models/oauth_nonce_test.rb @@ -12,7 +12,7 @@ class OauthNonceTest < ActiveSupport::TestCase assert_not_equal false, nonce1, "First nonce should be unique. Check your test database is empty." nonce2 = OauthNonce.remember(string, timestamp) - assert_equal false, nonce2, "Shouldn't be able to remember the same nonce twice." + assert_not nonce2, "Shouldn't be able to remember the same nonce twice." end ## @@ -21,7 +21,7 @@ class OauthNonceTest < ActiveSupport::TestCase string = "0123456789ABCDEF" nonce1 = OauthNonce.remember(string, Time.now.to_i - 86430) - assert_equal false, nonce1, "Nonces over a day in the past should be rejected" + assert_not nonce1, "Nonces over a day in the past should be rejected" nonce2 = OauthNonce.remember(string, Time.now.to_i - 86370) assert_not_equal false, nonce2, "Nonces under a day in the past should be rejected" diff --git a/test/models/oauth_token_test.rb b/test/models/oauth_token_test.rb index 4b0e39e9a..3e3aaae7c 100644 --- a/test/models/oauth_token_test.rb +++ b/test/models/oauth_token_test.rb @@ -5,19 +5,19 @@ class OauthTokenTest < ActiveSupport::TestCase # check that after calling invalidate! on a token, it is invalid. def test_token_invalidation tok = OauthToken.new - assert_equal false, tok.invalidated?, "Token should be created valid." + assert_not tok.invalidated?, "Token should be created valid." tok.invalidate! - assert_equal true, tok.invalidated?, "Token should now be invalid." + assert tok.invalidated?, "Token should now be invalid." end ## # check that an authorized token is authorised and can be invalidated def test_token_authorisation tok = RequestToken.create(:client_application => create(:client_application)) - assert_equal false, tok.authorized?, "Token should be created unauthorised." + assert_not tok.authorized?, "Token should be created unauthorised." tok.authorize!(create(:user)) - assert_equal true, tok.authorized?, "Token should now be authorised." + assert tok.authorized?, "Token should now be authorised." tok.invalidate! - assert_equal false, tok.authorized?, "Token should now be invalid." + assert_not tok.authorized?, "Token should now be invalid." end end diff --git a/test/models/old_node_test.rb b/test/models/old_node_test.rb index 12d344730..eade6130a 100644 --- a/test/models/old_node_test.rb +++ b/test/models/old_node_test.rb @@ -4,55 +4,55 @@ class OldNodeTest < ActiveSupport::TestCase def test_node_too_far_north node = build(:old_node, :latitude => 90.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_north_limit node = build(:old_node, :latitude => 90 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_node_too_far_south node = build(:old_node, :latitude => -90.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_south_limit node = build(:old_node, :latitude => -90 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_node_too_far_west node = build(:old_node, :longitude => -180.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_west_limit node = build(:old_node, :longitude => -180 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_node_too_far_east node = build(:old_node, :longitude => 180.01 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_node_east_limit node = build(:old_node, :longitude => 180 * OldNode::SCALE) node.validate - assert_equal false, node.errors.full_messages.include?("Node is not in the world") + assert_not_includes node.errors.full_messages, "Node is not in the world" end def test_totally_wrong node = build(:old_node, :latitude => 200 * OldNode::SCALE, :longitude => 200 * OldNode::SCALE) node.validate - assert node.errors.full_messages.include?("Node is not in the world") + assert_includes node.errors.full_messages, "Node is not in the world" end def test_lat_lon diff --git a/test/models/redaction_test.rb b/test/models/redaction_test.rb index fb232b81b..d74a91179 100644 --- a/test/models/redaction_test.rb +++ b/test/models/redaction_test.rb @@ -4,7 +4,7 @@ class RedactionTest < ActiveSupport::TestCase def test_cannot_redact_current n = create(:node) r = create(:redaction) - assert_equal(false, n.redacted?, "Expected node to not be redacted already.") + assert_not(n.redacted?, "Expected node to not be redacted already.") assert_raise(OSM::APICannotRedactError) do n.redact!(r) end @@ -14,7 +14,7 @@ class RedactionTest < ActiveSupport::TestCase node = create(:node, :with_history) node_v1 = node.old_nodes.find_by(:version => 1) r = create(:redaction) - assert_equal(false, node_v1.redacted?, "Expected node to not be redacted already.") + assert_not(node_v1.redacted?, "Expected node to not be redacted already.") assert_raise(OSM::APICannotRedactError) do node_v1.redact!(r) end @@ -26,11 +26,11 @@ class RedactionTest < ActiveSupport::TestCase node_v2 = node.old_nodes.find_by(:version => 2) r = create(:redaction) - assert_equal(false, node_v1.redacted?, "Expected node to not be redacted already.") + assert_not(node_v1.redacted?, "Expected node to not be redacted already.") assert_nothing_raised do node_v1.redact!(r) end - assert_equal(true, node_v1.redacted?, "Expected node version 1 to be redacted after redact! call.") - assert_equal(false, node_v2.redacted?, "Expected node version 2 to not be redacted after redact! call.") + assert(node_v1.redacted?, "Expected node version 1 to be redacted after redact! call.") + assert_not(node_v2.redacted?, "Expected node version 2 to not be redacted after redact! call.") end end diff --git a/test/models/request_token_test.rb b/test/models/request_token_test.rb index 7bfed5a56..c231371ce 100644 --- a/test/models/request_token_test.rb +++ b/test/models/request_token_test.rb @@ -2,9 +2,9 @@ require "test_helper" class RequestTokenTest < ActiveSupport::TestCase def test_oob - assert_equal true, RequestToken.new.oob? - assert_equal true, RequestToken.new(:callback_url => "oob").oob? - assert_equal true, RequestToken.new(:callback_url => "OOB").oob? - assert_equal false, RequestToken.new(:callback_url => "http://test.host/").oob? + assert RequestToken.new.oob? + assert RequestToken.new(:callback_url => "oob").oob? + assert RequestToken.new(:callback_url => "OOB").oob? + assert_not RequestToken.new(:callback_url => "http://test.host/").oob? end end diff --git a/test/models/trace_test.rb b/test/models/trace_test.rb index 2955be3ad..bf4e0196b 100644 --- a/test/models/trace_test.rb +++ b/test/models/trace_test.rb @@ -108,27 +108,27 @@ class TraceTest < ActiveSupport::TestCase end def test_public? - assert_equal true, build(:trace, :visibility => "public").public? - assert_equal false, build(:trace, :visibility => "private").public? - assert_equal false, build(:trace, :visibility => "trackable").public? - assert_equal true, build(:trace, :visibility => "identifiable").public? - assert_equal true, build(:trace, :deleted, :visibility => "public").public? + assert build(:trace, :visibility => "public").public? + assert_not build(:trace, :visibility => "private").public? + assert_not build(:trace, :visibility => "trackable").public? + assert build(:trace, :visibility => "identifiable").public? + assert build(:trace, :deleted, :visibility => "public").public? end def test_trackable? - assert_equal false, build(:trace, :visibility => "public").trackable? - assert_equal false, build(:trace, :visibility => "private").trackable? - assert_equal true, build(:trace, :visibility => "trackable").trackable? - assert_equal true, build(:trace, :visibility => "identifiable").trackable? - assert_equal false, build(:trace, :deleted, :visibility => "public").trackable? + assert_not build(:trace, :visibility => "public").trackable? + assert_not build(:trace, :visibility => "private").trackable? + assert build(:trace, :visibility => "trackable").trackable? + assert build(:trace, :visibility => "identifiable").trackable? + assert_not build(:trace, :deleted, :visibility => "public").trackable? end def test_identifiable? - assert_equal false, build(:trace, :visibility => "public").identifiable? - assert_equal false, build(:trace, :visibility => "private").identifiable? - assert_equal false, build(:trace, :visibility => "trackable").identifiable? - assert_equal true, build(:trace, :visibility => "identifiable").identifiable? - assert_equal false, build(:trace, :deleted, :visibility => "public").identifiable? + assert_not build(:trace, :visibility => "public").identifiable? + assert_not build(:trace, :visibility => "private").identifiable? + assert_not build(:trace, :visibility => "trackable").identifiable? + assert build(:trace, :visibility => "identifiable").identifiable? + assert_not build(:trace, :deleted, :visibility => "public").identifiable? end def test_mime_type @@ -218,22 +218,22 @@ class TraceTest < ActiveSupport::TestCase trace = create(:trace, :fixture => "a") icon_path = File.join(Settings.gpx_image_dir, "#{trace.id}_icon.gif") FileUtils.rm(icon_path) - assert_equal false, File.exist?(icon_path) + assert_not File.exist?(icon_path) trace.import - assert_equal true, File.exist?(icon_path) + assert File.exist?(icon_path) end def test_import_creates_large_picture trace = create(:trace, :fixture => "a") large_picture_path = File.join(Settings.gpx_image_dir, "#{trace.id}.gif") FileUtils.rm(large_picture_path) - assert_equal false, File.exist?(large_picture_path) + assert_not File.exist?(large_picture_path) trace.import - assert_equal true, File.exist?(large_picture_path) + assert File.exist?(large_picture_path) end def test_import_handles_bz2 diff --git a/test/models/user_preference_test.rb b/test/models/user_preference_test.rb index bceec0719..952289d94 100644 --- a/test/models/user_preference_test.rb +++ b/test/models/user_preference_test.rb @@ -36,7 +36,7 @@ class UserPreferenceTest < ActiveSupport::TestCase up.user = create(:user) up.k = key * i up.v = val * i - assert_equal false, up.valid? + assert_not up.valid? assert_raise(ActiveRecord::RecordInvalid) { up.save! } end end diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 2368960e1..330f40df2 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -26,7 +26,7 @@ class UserTest < ActiveSupport::TestCase :description => "desc" ) assert_not new_user.save - assert new_user.errors[:email].include?("has already been taken") + assert_includes new_user.errors[:email], "has already been taken" end def test_unique_display_name @@ -40,7 +40,7 @@ class UserTest < ActiveSupport::TestCase :description => "desc" ) assert_not new_user.save - assert new_user.errors[:display_name].include?("has already been taken") + assert_includes new_user.errors[:display_name], "has already been taken" end def test_email_valid @@ -224,36 +224,36 @@ class UserTest < ActiveSupport::TestCase end def test_visible? - assert_equal true, build(:user, :pending).visible? - assert_equal true, build(:user, :active).visible? - assert_equal true, build(:user, :confirmed).visible? - assert_equal false, build(:user, :suspended).visible? - assert_equal false, build(:user, :deleted).visible? + assert build(:user, :pending).visible? + assert build(:user, :active).visible? + assert build(:user, :confirmed).visible? + assert_not build(:user, :suspended).visible? + assert_not build(:user, :deleted).visible? end def test_active? - assert_equal false, build(:user, :pending).active? - assert_equal true, build(:user, :active).active? - assert_equal true, build(:user, :confirmed).active? - assert_equal false, build(:user, :suspended).active? - assert_equal false, build(:user, :deleted).active? + assert_not build(:user, :pending).active? + assert build(:user, :active).active? + assert build(:user, :confirmed).active? + assert_not build(:user, :suspended).active? + assert_not build(:user, :deleted).active? end def test_moderator? - assert_equal false, create(:user).moderator? - assert_equal true, create(:moderator_user).moderator? + assert_not create(:user).moderator? + assert create(:moderator_user).moderator? end def test_administrator? - assert_equal false, create(:user).administrator? - assert_equal true, create(:administrator_user).administrator? + assert_not create(:user).administrator? + assert create(:administrator_user).administrator? end def test_has_role? - assert_equal false, create(:user).has_role?("administrator") - assert_equal false, create(:user).has_role?("moderator") - assert_equal true, create(:administrator_user).has_role?("administrator") - assert_equal true, create(:moderator_user).has_role?("moderator") + assert_not create(:user).has_role?("administrator") + assert_not create(:user).has_role?("moderator") + assert create(:administrator_user).has_role?("administrator") + assert create(:moderator_user).has_role?("moderator") end def test_delete @@ -263,10 +263,10 @@ class UserTest < ActiveSupport::TestCase assert user.description.blank? assert_nil user.home_lat assert_nil user.home_lon - assert_equal false, user.avatar.attached? + assert_not user.avatar.attached? assert_equal "deleted", user.status - assert_equal false, user.visible? - assert_equal false, user.active? + assert_not user.visible? + assert_not user.active? end def test_to_xml