]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/3911'
authorTom Hughes <tom@compton.nu>
Wed, 1 Feb 2023 19:10:22 +0000 (19:10 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 1 Feb 2023 19:10:22 +0000 (19:10 +0000)
27 files changed:
app/abilities/ability.rb
app/assets/javascripts/index/note.js
app/controllers/browse_controller.rb
app/controllers/notes_controller.rb
app/controllers/site_controller.rb
app/helpers/issues_helper.rb
app/helpers/note_helper.rb
app/mailers/user_mailer.rb
app/views/api/notes/_note.gpx.builder
app/views/api/notes/_note.json.jbuilder
app/views/api/notes/_note.rss.builder
app/views/api/notes/_note.xml.builder
app/views/api/notes/feed.rss.builder
app/views/browse/new_note.html.erb [deleted file]
app/views/notes/index.html.erb
app/views/notes/new.html.erb [new file with mode: 0644]
app/views/notes/show.html.erb [moved from app/views/browse/note.html.erb with 61% similarity]
config/locales/en.yml
config/routes.rb
test/controllers/api/notes_controller_test.rb
test/controllers/browse_controller_test.rb
test/controllers/notes_controller_test.rb
test/controllers/site_controller_test.rb
test/system/index_test.rb
test/system/note_comments_test.rb [new file with mode: 0644]
test/system/report_note_test.rb
test/system/report_user_test.rb

index fd548c5f38a38a18a1d03f9f91972732b2d7816c..5d196fa98774cf5eeb03cb05464f69f1626522a3 100644 (file)
@@ -5,7 +5,8 @@ class Ability
 
   def initialize(user)
     can [:relation, :relation_history, :way, :way_history, :node, :node_history,
-         :changeset, :note, :new_note, :query], :browse
+         :changeset, :query], :browse
+    can [:show, :new], Note
     can :search, :direction
     can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :communities, :preview, :copyright, :key, :id], :site
     can [:finish, :embed], :export
index e5eb3a04148112279862854d3136ced79cbfe175..e7790c904b111804f7332b46cc7a81bffcee654e 100644 (file)
@@ -60,10 +60,10 @@ OSM.Note = function (map) {
       var form = e.target.form;
 
       if ($(e.target).val() === "") {
-        $(form.close).val(I18n.t("javascripts.notes.show.resolve"));
+        $(form.close).val($(form.close).data("defaultActionText"));
         $(form.comment).prop("disabled", true);
       } else {
-        $(form.close).val(I18n.t("javascripts.notes.show.comment_and_resolve"));
+        $(form.close).val($(form.close).data("commentActionText"));
         $(form.comment).prop("disabled", false);
       }
     });
index 6c5336908605448679b2111295883862da9c1e03..88871a9e127b03b17249f86ad8b8b16b851d1f5d 100644 (file)
@@ -76,19 +76,5 @@ class BrowseController < ApplicationController
     render :action => "not_found", :status => :not_found
   end
 
-  def note
-    @type = "note"
-
-    if current_user&.moderator?
-      @note = Note.find(params[:id])
-      @note_comments = @note.comments.unscope(:where => :visible)
-    else
-      @note = Note.visible.find(params[:id])
-      @note_comments = @note.comments
-    end
-  rescue ActiveRecord::RecordNotFound
-    render :action => "not_found", :status => :not_found
-  end
-
   def query; end
 end
index 7d6163f4886b08ae97c7e5716c706ca69df71703..440a620e8116806be582b4b996a88088cb53a1a7 100644 (file)
@@ -1,8 +1,9 @@
 class NotesController < ApplicationController
-  layout "site"
+  layout :map_layout
 
   before_action :check_api_readable
   before_action :authorize_web
+  before_action :require_oauth
 
   authorize_resource
 
@@ -21,12 +22,30 @@ class NotesController < ApplicationController
         @notes = @user.notes
         @notes = @notes.visible unless current_user&.moderator?
         @notes = @notes.order("updated_at DESC, id").distinct.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author)
+
+        render :layout => "site"
       else
         @title = t "users.no_such_user.title"
         @not_found_user = params[:display_name]
 
-        render :template => "users/no_such_user", :status => :not_found
+        render :template => "users/no_such_user", :status => :not_found, :layout => "site"
       end
     end
   end
+
+  def show
+    @type = "note"
+
+    if current_user&.moderator?
+      @note = Note.find(params[:id])
+      @note_comments = @note.comments.unscope(:where => :visible)
+    else
+      @note = Note.visible.find(params[:id])
+      @note_comments = @note.comments
+    end
+  rescue ActiveRecord::RecordNotFound
+    render :template => "browse/not_found", :status => :not_found
+  end
+
+  def new; end
 end
index 9d9cf0f39578c78951c0aa4eb7632c452ab7f44f..a05fe376be5ae27a193244dade2fac409c9a169e 100644 (file)
@@ -140,7 +140,7 @@ class SiteController < ApplicationController
     elsif params[:relation]
       redirect_to relation_path(params[:relation])
     elsif params[:note]
-      redirect_to browse_note_path(params[:note])
+      redirect_to note_path(params[:note])
     elsif params[:query]
       redirect_to search_path(:query => params[:query])
     end
index e6c1adb16437ce2cefe33722155028b7d8f1c903..dcec4990b0df077c13dd8cc6331fc7df85f9b2eb 100644 (file)
@@ -8,7 +8,7 @@ module IssuesHelper
     when DiaryComment
       diary_entry_url(reportable.diary_entry.user, reportable.diary_entry, :anchor => "comment#{reportable.id}")
     when Note
-      url_for(:controller => :browse, :action => :note, :id => reportable.id)
+      note_url(reportable)
     end
   end
 
index 809480a04020df137e8b7b98e5c32d9da01605bb..86e5c40f8d3d8bb3427814a55f93ac84d65bcb37 100644 (file)
@@ -3,11 +3,11 @@ module NoteHelper
 
   def note_event(event, at, by)
     if by.nil?
-      t("browse.note.#{event}_by_anonymous_html",
+      t("notes.show.#{event}_by_anonymous_html",
         :when => friendly_date_ago(at),
         :exact_time => l(at))
     else
-      t("browse.note.#{event}_by_html",
+      t("notes.show.#{event}_by_html",
         :when => friendly_date_ago(at),
         :exact_time => l(at),
         :user => note_author(by))
index 33fcc7465a6fb8a056448032556dbf7c577b0b7c..c5c0118e6f8b395da0569c7f12b040bd341f5ffc 100644 (file)
@@ -123,7 +123,7 @@ class UserMailer < ApplicationMailer
 
   def note_comment_notification(comment, recipient)
     with_recipient_locale recipient do
-      @noteurl = browse_note_url(comment.note)
+      @noteurl = note_url(comment.note)
       @place = Nominatim.describe_location(comment.note.lat, comment.note.lon, 14, I18n.locale)
       @comment = comment.body
       @owner = recipient == comment.note.author
index c79ed6a6e762db44eb76d521417384091cae36c4..bb5cac1c9f21c157065099e5d79ff44bee876c57 100644 (file)
@@ -1,22 +1,22 @@
 xml.wpt("lon" => note.lon, "lat" => note.lat) do
   xml.time note.created_at.to_fs(:iso8601)
-  xml.name t("browse.note.title", :id => note.id)
+  xml.name t("notes.show.title", :id => note.id)
 
   xml.desc do
     xml.cdata! render(:partial => "description", :object => note, :formats => [:html])
   end
 
-  xml.link("href" => browse_note_url(note, :only_path => false))
+  xml.link("href" => note_url(note, :only_path => false))
 
   xml.extensions do
     xml.id note.id
-    xml.url note_url(note, :format => params[:format])
+    xml.url api_note_url(note, :format => params[:format])
 
     if note.closed?
-      xml.reopen_url reopen_note_url(note, :format => params[:format])
+      xml.reopen_url reopen_api_note_url(note, :format => params[:format])
     else
-      xml.comment_url comment_note_url(note, :format => params[:format])
-      xml.close_url close_note_url(note, :format => params[:format])
+      xml.comment_url comment_api_note_url(note, :format => params[:format])
+      xml.close_url close_api_note_url(note, :format => params[:format])
     end
 
     xml.date_created note.created_at
index 34f79688073249d00b7edf78cff1b05198ab77de..0884c4426d9e3802b4abf352de108e19411e735d 100644 (file)
@@ -7,13 +7,13 @@ end
 
 json.properties do
   json.id note.id
-  json.url note_url(note, :format => params[:format])
+  json.url api_note_url(note, :format => params[:format])
 
   if note.closed?
-    json.reopen_url reopen_note_url(note, :format => params[:format])
+    json.reopen_url reopen_api_note_url(note, :format => params[:format])
   else
-    json.comment_url comment_note_url(note, :format => params[:format])
-    json.close_url close_note_url(note, :format => params[:format])
+    json.comment_url comment_api_note_url(note, :format => params[:format])
+    json.close_url close_api_note_url(note, :format => params[:format])
   end
 
   json.date_created note.created_at.to_s
index 968b4dc672363e0c82835e19a60f46717a9cca33..fa70536f79227a5cdaa4a5954c6c5076022c6125 100644 (file)
@@ -9,8 +9,8 @@ xml.item do
     xml.title t("api.notes.rss.opened", :place => location)
   end
 
-  xml.link browse_note_url(note)
-  xml.guid note_url(note)
+  xml.link note_url(note)
+  xml.guid api_note_url(note)
   xml.description render(:partial => "description", :object => note, :formats => [:html])
 
   xml.dc :creator, note.author.display_name if note.author
index adb4e6a5233350f7cb29b477ab283ee849886b3b..0e5ad0007e6237abcc80e0c8917f0fc2eac2c16e 100644 (file)
@@ -1,12 +1,12 @@
 xml.note("lon" => note.lon, "lat" => note.lat) do
   xml.id note.id
-  xml.url note_url(note, :format => params[:format])
+  xml.url api_note_url(note, :format => params[:format])
 
   if note.closed?
-    xml.reopen_url reopen_note_url(note, :format => params[:format])
+    xml.reopen_url reopen_api_note_url(note, :format => params[:format])
   else
-    xml.comment_url comment_note_url(note, :format => params[:format])
-    xml.close_url close_note_url(note, :format => params[:format])
+    xml.comment_url comment_api_note_url(note, :format => params[:format])
+    xml.close_url close_api_note_url(note, :format => params[:format])
   end
 
   xml.date_created note.created_at
index 89f888f5bdaa18c6f1695e5aa5954834688d83e8..cf380be31ff8a20729a0ae35ec346052d2cce4ef 100644 (file)
@@ -15,8 +15,8 @@ xml.rss("version" => "2.0",
       xml.item do
         xml.title t("api.notes.rss.#{comment.event}", :place => location)
 
-        xml.link url_for(:controller => "/browse", :action => "note", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false)
-        xml.guid url_for(:controller => "/browse", :action => "note", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false)
+        xml.link url_for(:controller => "/notes", :action => "show", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false)
+        xml.guid url_for(:controller => "/notes", :action => "show", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false)
 
         xml.description do
           xml.cdata! render(:partial => "entry", :object => comment, :formats => [:html])
diff --git a/app/views/browse/new_note.html.erb b/app/views/browse/new_note.html.erb
deleted file mode 100644 (file)
index c8f658f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<% set_title(t("browse.note.new_note")) %>
-
-<%= render "sidebar_header", :title => t("browse.note.new_note") %>
-
-<div class="note">
-  <p class="alert alert-info"><%= t("javascripts.notes.new.intro") %></p>
-  <form action="#">
-    <input type="hidden" name="lon" autocomplete="off">
-    <input type="hidden" name="lat" autocomplete="off">
-    <div class="mb-3">
-      <textarea class="form-control" name="text" cols="40" rows="10" maxlength="2000" placeholder="<%= t("javascripts.notes.new.advice") %>"></textarea>
-    </div>
-    <div class="btn-wrapper">
-      <input type="submit" name="add" value="<%= t("javascripts.notes.new.add") %>" disabled="1" class="btn btn-primary">
-    </div>
-  </form>
-</div>
index a627e1c545b03f1ef773912115397a36b2439889..2eb99b8124e810ca755797c0196a83de007275e5 100644 (file)
@@ -29,7 +29,7 @@
           <%= image_tag("open_note_marker.png", :alt => "open", :size => "25x40") %>
         <% end %>
       </td>
-      <td><%= link_to note.id, browse_note_path(note) %></td>
+      <td><%= link_to note.id, note %></td>
       <td><%= note_author(note.author) %></td>
       <td><%= note.comments.first.body.to_html %></td>
       <td><%= friendly_date_ago(note.created_at) %></td>
diff --git a/app/views/notes/new.html.erb b/app/views/notes/new.html.erb
new file mode 100644 (file)
index 0000000..ee98370
--- /dev/null
@@ -0,0 +1,17 @@
+<% set_title(t(".title")) %>
+
+<%= render "sidebar_header", :title => t(".title") %>
+
+<div class="note">
+  <p class="alert alert-info"><%= t(".intro") %></p>
+  <form action="#">
+    <input type="hidden" name="lon" autocomplete="off">
+    <input type="hidden" name="lat" autocomplete="off">
+    <div class="mb-3">
+      <textarea class="form-control" name="text" cols="40" rows="10" maxlength="2000" placeholder="<%= t(".advice") %>"></textarea>
+    </div>
+    <div class="btn-wrapper">
+      <input type="submit" name="add" value="<%= t(".add") %>" disabled="1" class="btn btn-primary">
+    </div>
+  </form>
+</div>
similarity index 61%
rename from app/views/browse/note.html.erb
rename to app/views/notes/show.html.erb
index a814d8c8b13a8dc44ec68aa59b5ff6ce003523a6..2378d8c2ec973fcab1bc8ed6ea48c62a56b5e9ea 100644 (file)
@@ -25,7 +25,7 @@
   </div>
 
   <% if @note_comments.find { |comment| comment.author.nil? } -%>
-    <p class='alert alert-warning'><%= t "javascripts.notes.show.anonymous_warning" %></p>
+    <p class='alert alert-warning'><%= t ".anonymous_warning" %></p>
   <% end -%>
 
   <% if @note_comments.length > 1 %>
         </div>
         <div class="btn-wrapper">
           <% if current_user.moderator? -%>
-            <input type="submit" name="hide" value="<%= t("javascripts.notes.show.hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= note_url(@note, "json") %>">
+            <%= submit_tag t(".hide"), :name => "hide", :class => "btn btn-light",
+                                       :data => { :method => "DELETE",
+                                                  :url => api_note_url(@note, "json") } %>
           <% end -%>
-          <input type="submit" name="close" value="<%= t("javascripts.notes.show.resolve") %>" class="btn btn-primary" data-method="POST" data-url="<%= close_note_url(@note, "json") %>">
-          <input type="submit" name="comment" value="<%= t("javascripts.notes.show.comment") %>" class="btn btn-primary" data-method="POST" data-url="<%= comment_note_url(@note, "json") %>" disabled="1">
+          <%= submit_tag t(".resolve"), :name => "close", :class => "btn btn-primary",
+                                        :data => { :method => "POST",
+                                                   :url => close_api_note_url(@note, "json"),
+                                                   :default_action_text => t(".resolve"),
+                                                   :comment_action_text => t(".comment_and_resolve") } %>
+          <%= submit_tag t(".comment"), :name => "comment", :class => "btn btn-primary", :disabled => true,
+                                        :data => { :method => "POST",
+                                                   :url => comment_api_note_url(@note, "json") } %>
         </div>
       </form>
     <% end -%>
       <input type="hidden" name="text" value="" autocomplete="off">
       <div class="btn-wrapper">
         <% if @note.status != "hidden" and current_user and current_user.moderator? -%>
-          <input type="submit" name="hide" value="<%= t("javascripts.notes.show.hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= note_url(@note, "json") %>">
+          <input type="submit" name="hide" value="<%= t(".hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= api_note_url(@note, "json") %>">
         <% end -%>
         <% if current_user -%>
-          <input type="submit" name="reopen" value="<%= t("javascripts.notes.show.reactivate") %>" class="btn btn-primary" data-method="POST" data-url="<%= reopen_note_url(@note, "json") %>">
+          <input type="submit" name="reopen" value="<%= t(".reactivate") %>" class="btn btn-primary" data-method="POST" data-url="<%= reopen_api_note_url(@note, "json") %>">
         <% end -%>
       </div>
     </form>
   <% if current_user && current_user != @note.author %>
     <p>
       <small class="text-muted">
-        <%= t "javascripts.notes.show.report_link_html", :link => report_link(t(".report"), @note) %>
+        <%= t ".report_link_html", :link => report_link(t(".report"), @note) %>
         <% if @note.status == "open" %>
-          <%= t "javascripts.notes.show.other_problems_resolve", :link => report_link(t(".report"), @note) %>
+          <%= t ".other_problems_resolve", :link => report_link(t(".report"), @note) %>
         <% elsif @note.status == "closed" %>
-          <%= t "javascripts.notes.show.other_problems_resolved" %>
+          <%= t ".other_problems_resolved" %>
         <% end %>
       </small>
     </p>
@@ -85,7 +93,7 @@
 
   <% if @note.freshly_closed? %>
     <small class="text-muted">
-      <%= t "javascripts.notes.show.disappear_date_html", :disappear_in => disappear_in(@note) %>
+      <%= t ".disappear_date_html", :disappear_in => disappear_in(@note) %>
     </small>
   <% end %>
 </div>
index b1752834be165044a47cc9d2f9c83e65d7cabc10..40eb533a2db2b44ba7b3b24254749c2083ea8917 100644 (file)
@@ -407,24 +407,6 @@ en:
       telephone_link: "Call %{phone_number}"
       colour_preview: "Colour %{colour_value} preview"
       email_link: "Email %{email}"
-    note:
-      title: "Note: %{id}"
-      new_note: "New Note"
-      description: "Description"
-      open_title: "Unresolved note #%{note_name}"
-      closed_title: "Resolved note #%{note_name}"
-      hidden_title: "Hidden note #%{note_name}"
-      opened_by_html: "Created by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      opened_by_anonymous_html: "Created by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      commented_by_html: "Comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      commented_by_anonymous_html: "Comment from anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      closed_by_html: "Resolved by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      closed_by_anonymous_html: "Resolved by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      reopened_by_html: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      reopened_by_anonymous_html: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      hidden_by_html: "Hidden by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      report: report this note
-      coordinates_html: "%{latitude}, %{longitude}"
     query:
       title: "Query Features"
       introduction: "Click on the map to find nearby features."
@@ -2837,6 +2819,38 @@ en:
       description: "Description"
       created_at: "Created at"
       last_changed: "Last changed"
+    show:
+      title: "Note: %{id}"
+      description: "Description"
+      open_title: "Unresolved note #%{note_name}"
+      closed_title: "Resolved note #%{note_name}"
+      hidden_title: "Hidden note #%{note_name}"
+      opened_by_html: "Created by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      opened_by_anonymous_html: "Created by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      commented_by_html: "Comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      commented_by_anonymous_html: "Comment from anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      closed_by_html: "Resolved by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      closed_by_anonymous_html: "Resolved by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      reopened_by_html: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      reopened_by_anonymous_html: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
+      hidden_by_html: "Hidden by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      report: report this note
+      coordinates_html: "%{latitude}, %{longitude}"
+      anonymous_warning: This note includes comments from anonymous users which should be independently verified.
+      hide: Hide
+      resolve: Resolve
+      reactivate: Reactivate
+      comment_and_resolve: Comment & Resolve
+      comment: Comment
+      report_link_html: "If this note contains sensitive information that needs to be removed, you can %{link}."
+      other_problems_resolve: "For all other problems with the note, please resolve it yourself with a comment."
+      other_problems_resolved: "For all other problems, resolving is sufficient."
+      disappear_date_html: "This resolved note will disappear from the map in %{disappear_in}."
+    new:
+      title: "New Note"
+      intro: "Spotted a mistake or something missing? Let other mappers know so we can fix it. Move the marker to the correct position and type a note to explain the problem."
+      advice: "Your note is public and may be used to update the map, so don't enter personal information, or information from copyrighted maps or directory listings."
+      add: Add Note
   javascripts:
     close: Close
     share:
@@ -2914,22 +2928,6 @@ en:
         unsubscribe: "Unsubscribe"
         hide_comment: "hide"
         unhide_comment: "unhide"
-    notes:
-      new:
-        intro: "Spotted a mistake or something missing? Let other mappers know so we can fix it. Move the marker to the correct position and type a note to explain the problem."
-        advice: "Your note is public and may be used to update the map, so don't enter personal information, or information from copyrighted maps or directory listings."
-        add: Add Note
-      show:
-        anonymous_warning: This note includes comments from anonymous users which should be independently verified.
-        hide: Hide
-        resolve: Resolve
-        reactivate: Reactivate
-        comment_and_resolve: Comment & Resolve
-        comment: Comment
-        report_link_html: "If this note contains sensitive information that needs to be removed, you can %{link}."
-        other_problems_resolve: "For all other problems with the note, please resolve it yourself with a comment."
-        other_problems_resolved: "For all other problems, resolving is sufficient."
-        disappear_date_html: "This resolved note will disappear from the map in %{disappear_in}."
     edit_help: Move the map and zoom in on a location you want to edit, then click here.
     directions:
       ascend: "Ascend"
index 8fd11c09189899e46f3bb560f6f899ebf9fb73c4..c0fbf202091b9fcd26975e7f955dc5938b573cb6 100644 (file)
@@ -84,7 +84,7 @@ OpenStreetMap::Application.routes.draw do
     get "gpx/:id/data" => "api/traces#data", :as => :api_trace_data
 
     # Map notes API
-    resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "api/notes" do
+    resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "api/notes", :as => :api_notes do
       collection do
         get "search"
         get "feed", :defaults => { :format => "rss" }
@@ -113,8 +113,8 @@ OpenStreetMap::Application.routes.draw do
   get "/relation/:id/history" => "browse#relation_history", :id => /\d+/, :as => :relation_history
   get "/changeset/:id" => "browse#changeset", :as => :changeset, :id => /\d+/
   get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" }
-  get "/note/:id" => "browse#note", :id => /\d+/, :as => "browse_note"
-  get "/note/new" => "browse#new_note"
+  resources :notes, :path => "note", :only => [:show, :new]
+
   get "/user/:display_name/history" => "changesets#index"
   get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom }
   get "/user/:display_name/notes" => "notes#index", :as => :user_notes
index 31c55b3a81e7c83b4e2f5afd4a5e033f0a7f7070..da24781698bc1bfc7c9a55563b930db8a317d6db 100644 (file)
@@ -125,7 +125,7 @@ module Api
     def test_create_success
       assert_difference "Note.count", 1 do
         assert_difference "NoteComment.count", 1 do
-          post notes_path(:lat => -1.0, :lon => -1.0, :text => "This is a comment", :format => "json")
+          post api_notes_path(:lat => -1.0, :lon => -1.0, :text => "This is a comment", :format => "json")
         end
       end
       assert_response :success
@@ -141,7 +141,7 @@ module Api
       assert_nil js["properties"]["comments"].last["user"]
       id = js["properties"]["id"]
 
-      get note_path(:id => id, :format => "json")
+      get api_note_path(:id => id, :format => "json")
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -159,63 +159,63 @@ module Api
     def test_create_fail
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lon => -1.0, :text => "This is a comment")
+          post api_notes_path(:lon => -1.0, :text => "This is a comment")
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => -1.0, :text => "This is a comment")
+          post api_notes_path(:lat => -1.0, :text => "This is a comment")
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => -1.0, :lon => -1.0)
+          post api_notes_path(:lat => -1.0, :lon => -1.0)
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => -1.0, :lon => -1.0, :text => "")
+          post api_notes_path(:lat => -1.0, :lon => -1.0, :text => "")
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => -100.0, :lon => -1.0, :text => "This is a comment")
+          post api_notes_path(:lat => -100.0, :lon => -1.0, :text => "This is a comment")
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => -1.0, :lon => -200.0, :text => "This is a comment")
+          post api_notes_path(:lat => -1.0, :lon => -200.0, :text => "This is a comment")
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => "abc", :lon => -1.0, :text => "This is a comment")
+          post api_notes_path(:lat => "abc", :lon => -1.0, :text => "This is a comment")
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => -1.0, :lon => "abc", :text => "This is a comment")
+          post api_notes_path(:lat => -1.0, :lon => "abc", :text => "This is a comment")
         end
       end
       assert_response :bad_request
 
       assert_no_difference "Note.count" do
         assert_no_difference "NoteComment.count" do
-          post notes_path(:lat => -1.0, :lon => -1.0, :text => "x\u0000y")
+          post api_notes_path(:lat => -1.0, :lon => -1.0, :text => "x\u0000y")
         end
       end
       assert_response :bad_request
@@ -228,7 +228,7 @@ module Api
       assert_difference "NoteComment.count", 1 do
         assert_no_difference "ActionMailer::Base.deliveries.size" do
           perform_enqueued_jobs do
-            post comment_note_path(:id => open_note_with_comment, :text => "This is an additional comment", :format => "json"), :headers => auth_header
+            post comment_api_note_path(:id => open_note_with_comment, :text => "This is an additional comment", :format => "json"), :headers => auth_header
           end
         end
       end
@@ -243,7 +243,7 @@ module Api
       assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
       assert_equal user.display_name, js["properties"]["comments"].last["user"]
 
-      get note_path(:id => open_note_with_comment, :format => "json")
+      get api_note_path(:id => open_note_with_comment, :format => "json")
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -270,7 +270,7 @@ module Api
       assert_difference "NoteComment.count", 1 do
         assert_difference "ActionMailer::Base.deliveries.size", 2 do
           perform_enqueued_jobs do
-            post comment_note_path(:id => note_with_comments_by_users, :text => "This is an additional comment", :format => "json"), :headers => auth_header
+            post comment_api_note_path(:id => note_with_comments_by_users, :text => "This is an additional comment", :format => "json"), :headers => auth_header
           end
         end
       end
@@ -296,7 +296,7 @@ module Api
       assert_equal 1, email.to.length
       assert_equal "[OpenStreetMap] #{third_user.display_name} has commented on a note you are interested in", email.subject
 
-      get note_path(:id => note_with_comments_by_users, :format => "json")
+      get api_note_path(:id => note_with_comments_by_users, :format => "json")
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -317,43 +317,43 @@ module Api
       user = create(:user)
 
       assert_no_difference "NoteComment.count" do
-        post comment_note_path(:id => open_note_with_comment)
+        post comment_api_note_path(:id => open_note_with_comment)
         assert_response :unauthorized
       end
 
       auth_header = basic_authorization_header user.email, "test"
 
       assert_no_difference "NoteComment.count" do
-        post comment_note_path(:id => open_note_with_comment), :headers => auth_header
+        post comment_api_note_path(:id => open_note_with_comment), :headers => auth_header
       end
       assert_response :bad_request
 
       assert_no_difference "NoteComment.count" do
-        post comment_note_path(:id => open_note_with_comment, :text => ""), :headers => auth_header
+        post comment_api_note_path(:id => open_note_with_comment, :text => ""), :headers => auth_header
       end
       assert_response :bad_request
 
       assert_no_difference "NoteComment.count" do
-        post comment_note_path(:id => 12345, :text => "This is an additional comment"), :headers => auth_header
+        post comment_api_note_path(:id => 12345, :text => "This is an additional comment"), :headers => auth_header
       end
       assert_response :not_found
 
       hidden_note_with_comment = create(:note_with_comments, :status => "hidden")
 
       assert_no_difference "NoteComment.count" do
-        post comment_note_path(:id => hidden_note_with_comment, :text => "This is an additional comment"), :headers => auth_header
+        post comment_api_note_path(:id => hidden_note_with_comment, :text => "This is an additional comment"), :headers => auth_header
       end
       assert_response :gone
 
       closed_note_with_comment = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc)
 
       assert_no_difference "NoteComment.count" do
-        post comment_note_path(:id => closed_note_with_comment, :text => "This is an additional comment"), :headers => auth_header
+        post comment_api_note_path(:id => closed_note_with_comment, :text => "This is an additional comment"), :headers => auth_header
       end
       assert_response :conflict
 
       assert_no_difference "NoteComment.count" do
-        post comment_note_path(:id => open_note_with_comment, :text => "x\u0000y"), :headers => auth_header
+        post comment_api_note_path(:id => open_note_with_comment, :text => "x\u0000y"), :headers => auth_header
       end
       assert_response :bad_request
     end
@@ -362,12 +362,12 @@ module Api
       open_note_with_comment = create(:note_with_comments)
       user = create(:user)
 
-      post close_note_path(:id => open_note_with_comment, :text => "This is a close comment", :format => "json")
+      post close_api_note_path(:id => open_note_with_comment, :text => "This is a close comment", :format => "json")
       assert_response :unauthorized
 
       auth_header = basic_authorization_header user.email, "test"
 
-      post close_note_path(:id => open_note_with_comment, :text => "This is a close comment", :format => "json"), :headers => auth_header
+      post close_api_note_path(:id => open_note_with_comment, :text => "This is a close comment", :format => "json"), :headers => auth_header
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -379,7 +379,7 @@ module Api
       assert_equal "This is a close comment", js["properties"]["comments"].last["text"]
       assert_equal user.display_name, js["properties"]["comments"].last["user"]
 
-      get note_path(:id => open_note_with_comment.id, :format => "json")
+      get api_note_path(:id => open_note_with_comment.id, :format => "json")
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -393,22 +393,22 @@ module Api
     end
 
     def test_close_fail
-      post close_note_path(:id => 12345)
+      post close_api_note_path(:id => 12345)
       assert_response :unauthorized
 
       auth_header = basic_authorization_header create(:user).email, "test"
 
-      post close_note_path(:id => 12345), :headers => auth_header
+      post close_api_note_path(:id => 12345), :headers => auth_header
       assert_response :not_found
 
       hidden_note_with_comment = create(:note_with_comments, :status => "hidden")
 
-      post close_note_path(:id => hidden_note_with_comment), :headers => auth_header
+      post close_api_note_path(:id => hidden_note_with_comment), :headers => auth_header
       assert_response :gone
 
       closed_note_with_comment = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc)
 
-      post close_note_path(:id => closed_note_with_comment), :headers => auth_header
+      post close_api_note_path(:id => closed_note_with_comment), :headers => auth_header
       assert_response :conflict
     end
 
@@ -416,12 +416,12 @@ module Api
       closed_note_with_comment = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc)
       user = create(:user)
 
-      post reopen_note_path(:id => closed_note_with_comment, :text => "This is a reopen comment", :format => "json")
+      post reopen_api_note_path(:id => closed_note_with_comment, :text => "This is a reopen comment", :format => "json")
       assert_response :unauthorized
 
       auth_header = basic_authorization_header user.email, "test"
 
-      post reopen_note_path(:id => closed_note_with_comment, :text => "This is a reopen comment", :format => "json"), :headers => auth_header
+      post reopen_api_note_path(:id => closed_note_with_comment, :text => "This is a reopen comment", :format => "json"), :headers => auth_header
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -433,7 +433,7 @@ module Api
       assert_equal "This is a reopen comment", js["properties"]["comments"].last["text"]
       assert_equal user.display_name, js["properties"]["comments"].last["user"]
 
-      get note_path(:id => closed_note_with_comment, :format => "json")
+      get api_note_path(:id => closed_note_with_comment, :format => "json")
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -449,35 +449,35 @@ module Api
     def test_reopen_fail
       hidden_note_with_comment = create(:note_with_comments, :status => "hidden")
 
-      post reopen_note_path(:id => hidden_note_with_comment)
+      post reopen_api_note_path(:id => hidden_note_with_comment)
       assert_response :unauthorized
 
       auth_header = basic_authorization_header create(:user).email, "test"
 
-      post reopen_note_path(:id => 12345), :headers => auth_header
+      post reopen_api_note_path(:id => 12345), :headers => auth_header
       assert_response :not_found
 
-      post reopen_note_path(:id => hidden_note_with_comment), :headers => auth_header
+      post reopen_api_note_path(:id => hidden_note_with_comment), :headers => auth_header
       assert_response :gone
 
       open_note_with_comment = create(:note_with_comments)
 
-      post reopen_note_path(:id => open_note_with_comment), :headers => auth_header
+      post reopen_api_note_path(:id => open_note_with_comment), :headers => auth_header
       assert_response :conflict
     end
 
     def test_show_success
       open_note = create(:note_with_comments)
 
-      get note_path(:id => open_note, :format => "xml")
+      get api_note_path(:id => open_note, :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note[lat='#{open_note.lat}'][lon='#{open_note.lon}']", :count => 1 do
           assert_select "id", open_note.id.to_s
-          assert_select "url", note_url(open_note, :format => "xml")
-          assert_select "comment_url", comment_note_url(open_note, :format => "xml")
-          assert_select "close_url", close_note_url(open_note, :format => "xml")
+          assert_select "url", api_note_url(open_note, :format => "xml")
+          assert_select "comment_url", comment_api_note_url(open_note, :format => "xml")
+          assert_select "close_url", close_api_note_url(open_note, :format => "xml")
           assert_select "date_created", open_note.created_at.to_s
           assert_select "status", open_note.status
           assert_select "comments", :count => 1 do
@@ -486,14 +486,14 @@ module Api
         end
       end
 
-      get note_path(:id => open_note, :format => "rss")
+      get api_note_path(:id => open_note, :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
         assert_select "channel", :count => 1 do
           assert_select "item", :count => 1 do
-            assert_select "link", browse_note_url(open_note)
-            assert_select "guid", note_url(open_note)
+            assert_select "link", note_url(open_note)
+            assert_select "guid", api_note_url(open_note)
             assert_select "pubDate", open_note.created_at.to_fs(:rfc822)
             assert_select "geo|lat", open_note.lat.to_s
             assert_select "geo|long", open_note.lon.to_s
@@ -502,7 +502,7 @@ module Api
         end
       end
 
-      get note_path(:id => open_note, :format => "json")
+      get api_note_path(:id => open_note, :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -512,13 +512,13 @@ module Api
       assert_equal open_note.lat, js["geometry"]["coordinates"][0]
       assert_equal open_note.lon, js["geometry"]["coordinates"][1]
       assert_equal open_note.id, js["properties"]["id"]
-      assert_equal note_url(open_note, :format => "json"), js["properties"]["url"]
-      assert_equal comment_note_url(open_note, :format => "json"), js["properties"]["comment_url"]
-      assert_equal close_note_url(open_note, :format => "json"), js["properties"]["close_url"]
+      assert_equal api_note_url(open_note, :format => "json"), js["properties"]["url"]
+      assert_equal comment_api_note_url(open_note, :format => "json"), js["properties"]["comment_url"]
+      assert_equal close_api_note_url(open_note, :format => "json"), js["properties"]["close_url"]
       assert_equal open_note.created_at.to_s, js["properties"]["date_created"]
       assert_equal open_note.status, js["properties"]["status"]
 
-      get note_path(:id => open_note, :format => "gpx")
+      get api_note_path(:id => open_note, :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -529,9 +529,9 @@ module Api
           assert_select "link[href='http://www.example.com/note/#{open_note.id}']", :count => 1
           assert_select "extensions", :count => 1 do
             assert_select "id", open_note.id.to_s
-            assert_select "url", note_url(open_note, :format => "gpx")
-            assert_select "comment_url", comment_note_url(open_note, :format => "gpx")
-            assert_select "close_url", close_note_url(open_note, :format => "gpx")
+            assert_select "url", api_note_url(open_note, :format => "gpx")
+            assert_select "comment_url", comment_api_note_url(open_note, :format => "gpx")
+            assert_select "close_url", close_api_note_url(open_note, :format => "gpx")
           end
         end
       end
@@ -544,7 +544,7 @@ module Api
         create(:note_comment, :note => note, :body => "Another valid comment for hidden note")
       end
 
-      get note_path(:id => note_with_hidden_comment, :format => "json")
+      get api_note_path(:id => note_with_hidden_comment, :format => "json")
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -556,10 +556,10 @@ module Api
     end
 
     def test_show_fail
-      get note_path(:id => 12345)
+      get api_note_path(:id => 12345)
       assert_response :not_found
 
-      get note_path(:id => create(:note, :status => "hidden"))
+      get api_note_path(:id => create(:note, :status => "hidden"))
       assert_response :gone
     end
 
@@ -568,17 +568,17 @@ module Api
       user = create(:user)
       moderator_user = create(:moderator_user)
 
-      delete note_path(:id => open_note_with_comment, :text => "This is a hide comment", :format => "json")
+      delete api_note_path(:id => open_note_with_comment, :text => "This is a hide comment", :format => "json")
       assert_response :unauthorized
 
       auth_header = basic_authorization_header user.email, "test"
 
-      delete note_path(:id => open_note_with_comment, :text => "This is a hide comment", :format => "json"), :headers => auth_header
+      delete api_note_path(:id => open_note_with_comment, :text => "This is a hide comment", :format => "json"), :headers => auth_header
       assert_response :forbidden
 
       auth_header = basic_authorization_header moderator_user.email, "test"
 
-      delete note_path(:id => open_note_with_comment, :text => "This is a hide comment", :format => "json"), :headers => auth_header
+      delete api_note_path(:id => open_note_with_comment, :text => "This is a hide comment", :format => "json"), :headers => auth_header
       assert_response :success
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -590,12 +590,12 @@ module Api
       assert_equal "This is a hide comment", js["properties"]["comments"].last["text"]
       assert_equal moderator_user.display_name, js["properties"]["comments"].last["user"]
 
-      get note_path(:id => open_note_with_comment, :format => "json"), :headers => auth_header
+      get api_note_path(:id => open_note_with_comment, :format => "json"), :headers => auth_header
       assert_response :success
 
       auth_header = basic_authorization_header user.email, "test"
 
-      get note_path(:id => open_note_with_comment, :format => "json"), :headers => auth_header
+      get api_note_path(:id => open_note_with_comment, :format => "json"), :headers => auth_header
       assert_response :gone
     end
 
@@ -603,22 +603,22 @@ module Api
       user = create(:user)
       moderator_user = create(:moderator_user)
 
-      delete note_path(:id => 12345, :format => "json")
+      delete api_note_path(:id => 12345, :format => "json")
       assert_response :unauthorized
 
       auth_header = basic_authorization_header user.email, "test"
 
-      delete note_path(:id => 12345, :format => "json"), :headers => auth_header
+      delete api_note_path(:id => 12345, :format => "json"), :headers => auth_header
       assert_response :forbidden
 
       auth_header = basic_authorization_header moderator_user.email, "test"
 
-      delete note_path(:id => 12345, :format => "json"), :headers => auth_header
+      delete api_note_path(:id => 12345, :format => "json"), :headers => auth_header
       assert_response :not_found
 
       hidden_note_with_comment = create(:note_with_comments, :status => "hidden")
 
-      delete note_path(:id => hidden_note_with_comment, :format => "json"), :headers => auth_header
+      delete api_note_path(:id => hidden_note_with_comment, :format => "json"), :headers => auth_header
       assert_response :gone
     end
 
@@ -627,7 +627,7 @@ module Api
       create(:note_with_comments, :latitude => position, :longitude => position)
       create(:note_with_comments, :latitude => position, :longitude => position)
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :format => "rss")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -637,7 +637,7 @@ module Api
         end
       end
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :format => "json")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -645,14 +645,14 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 2, js["features"].count
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :format => "xml")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 2
       end
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :format => "gpx")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -665,7 +665,7 @@ module Api
       create(:note_with_comments, :latitude => position, :longitude => position)
       create(:note_with_comments, :latitude => position, :longitude => position)
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "rss")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -674,7 +674,7 @@ module Api
         end
       end
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "json")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -682,14 +682,14 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 1, js["features"].count
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "xml")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 1
       end
 
-      get notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "gpx")
+      get api_notes_path(:bbox => "1,1,1.2,1.2", :limit => 1, :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -698,7 +698,7 @@ module Api
     end
 
     def test_index_empty_area
-      get notes_path(:bbox => "5,5,5.1,5.1", :format => "rss")
+      get api_notes_path(:bbox => "5,5,5.1,5.1", :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -707,7 +707,7 @@ module Api
         end
       end
 
-      get notes_path(:bbox => "5,5,5.1,5.1", :format => "json")
+      get api_notes_path(:bbox => "5,5,5.1,5.1", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -715,14 +715,14 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 0, js["features"].count
 
-      get notes_path(:bbox => "5,5,5.1,5.1", :format => "xml")
+      get api_notes_path(:bbox => "5,5,5.1,5.1", :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 0
       end
 
-      get notes_path(:bbox => "5,5,5.1,5.1", :format => "gpx")
+      get api_notes_path(:bbox => "5,5,5.1,5.1", :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -731,19 +731,19 @@ module Api
     end
 
     def test_index_large_area
-      get notes_path(:bbox => "-2.5,-2.5,2.5,2.5", :format => :json)
+      get api_notes_path(:bbox => "-2.5,-2.5,2.5,2.5", :format => :json)
       assert_response :success
       assert_equal "application/json", @response.media_type
 
-      get notes_path(:l => "-2.5", :b => "-2.5", :r => "2.5", :t => "2.5", :format => :json)
+      get api_notes_path(:l => "-2.5", :b => "-2.5", :r => "2.5", :t => "2.5", :format => :json)
       assert_response :success
       assert_equal "application/json", @response.media_type
 
-      get notes_path(:bbox => "-10,-10,12,12", :format => :json)
+      get api_notes_path(:bbox => "-10,-10,12,12", :format => :json)
       assert_response :bad_request
       assert_equal "text/plain", @response.media_type
 
-      get notes_path(:l => "-10", :b => "-10", :r => "12", :t => "12", :format => :json)
+      get api_notes_path(:l => "-10", :b => "-10", :r => "12", :t => "12", :format => :json)
       assert_response :bad_request
       assert_equal "text/plain", @response.media_type
     end
@@ -755,7 +755,7 @@ module Api
       create(:note_with_comments)
 
       # Open notes + closed in last 7 days
-      get notes_path(:bbox => "1,1,1.7,1.7", :closed => "7", :format => "json")
+      get api_notes_path(:bbox => "1,1,1.7,1.7", :closed => "7", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -764,7 +764,7 @@ module Api
       assert_equal 2, js["features"].count
 
       # Only open notes
-      get notes_path(:bbox => "1,1,1.7,1.7", :closed => "0", :format => "json")
+      get api_notes_path(:bbox => "1,1,1.7,1.7", :closed => "0", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -773,7 +773,7 @@ module Api
       assert_equal 1, js["features"].count
 
       # Open notes + all closed notes
-      get notes_path(:bbox => "1,1,1.7,1.7", :closed => "-1", :format => "json")
+      get api_notes_path(:bbox => "1,1,1.7,1.7", :closed => "-1", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -783,42 +783,42 @@ module Api
     end
 
     def test_index_bad_params
-      get notes_path(:bbox => "-2.5,-2.5,2.5")
+      get api_notes_path(:bbox => "-2.5,-2.5,2.5")
       assert_response :bad_request
 
-      get notes_path(:bbox => "-2.5,-2.5,2.5,2.5,2.5")
+      get api_notes_path(:bbox => "-2.5,-2.5,2.5,2.5,2.5")
       assert_response :bad_request
 
-      get notes_path(:b => "-2.5", :r => "2.5", :t => "2.5")
+      get api_notes_path(:b => "-2.5", :r => "2.5", :t => "2.5")
       assert_response :bad_request
 
-      get notes_path(:l => "-2.5", :r => "2.5", :t => "2.5")
+      get api_notes_path(:l => "-2.5", :r => "2.5", :t => "2.5")
       assert_response :bad_request
 
-      get notes_path(:l => "-2.5", :b => "-2.5", :t => "2.5")
+      get api_notes_path(:l => "-2.5", :b => "-2.5", :t => "2.5")
       assert_response :bad_request
 
-      get notes_path(:l => "-2.5", :b => "-2.5", :r => "2.5")
+      get api_notes_path(:l => "-2.5", :b => "-2.5", :r => "2.5")
       assert_response :bad_request
 
-      get notes_path(:bbox => "1,1,1.7,1.7", :limit => "0", :format => "json")
+      get api_notes_path(:bbox => "1,1,1.7,1.7", :limit => "0", :format => "json")
       assert_response :bad_request
 
-      get notes_path(:bbox => "1,1,1.7,1.7", :limit => "10001", :format => "json")
+      get api_notes_path(:bbox => "1,1,1.7,1.7", :limit => "10001", :format => "json")
       assert_response :bad_request
     end
 
     def test_search_success
       create(:note_with_comments)
 
-      get search_notes_path(:q => "note comment", :format => "xml")
+      get search_api_notes_path(:q => "note comment", :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 1
       end
 
-      get search_notes_path(:q => "note comment", :format => "json")
+      get search_api_notes_path(:q => "note comment", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -826,7 +826,7 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 1, js["features"].count
 
-      get search_notes_path(:q => "note comment", :format => "rss")
+      get search_api_notes_path(:q => "note comment", :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -835,7 +835,7 @@ module Api
         end
       end
 
-      get search_notes_path(:q => "note comment", :format => "gpx")
+      get search_api_notes_path(:q => "note comment", :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -850,14 +850,14 @@ module Api
         create(:note_comment, :note => note, :author => user)
       end
 
-      get search_notes_path(:display_name => user.display_name, :format => "xml")
+      get search_api_notes_path(:display_name => user.display_name, :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 1
       end
 
-      get search_notes_path(:display_name => user.display_name, :format => "json")
+      get search_api_notes_path(:display_name => user.display_name, :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -865,7 +865,7 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 1, js["features"].count
 
-      get search_notes_path(:display_name => user.display_name, :format => "rss")
+      get search_api_notes_path(:display_name => user.display_name, :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -874,7 +874,7 @@ module Api
         end
       end
 
-      get search_notes_path(:display_name => user.display_name, :format => "gpx")
+      get search_api_notes_path(:display_name => user.display_name, :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -889,14 +889,14 @@ module Api
         create(:note_comment, :note => note, :author => user)
       end
 
-      get search_notes_path(:user => user.id, :format => "xml")
+      get search_api_notes_path(:user => user.id, :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 1
       end
 
-      get search_notes_path(:user => user.id, :format => "json")
+      get search_api_notes_path(:user => user.id, :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -904,7 +904,7 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 1, js["features"].count
 
-      get search_notes_path(:user => user.id, :format => "rss")
+      get search_api_notes_path(:user => user.id, :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -913,7 +913,7 @@ module Api
         end
       end
 
-      get search_notes_path(:user => user.id, :format => "gpx")
+      get search_api_notes_path(:user => user.id, :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -924,14 +924,14 @@ module Api
     def test_search_no_match
       create(:note_with_comments)
 
-      get search_notes_path(:q => "no match", :format => "xml")
+      get search_api_notes_path(:q => "no match", :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 0
       end
 
-      get search_notes_path(:q => "no match", :format => "json")
+      get search_api_notes_path(:q => "no match", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -939,7 +939,7 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 0, js["features"].count
 
-      get search_notes_path(:q => "no match", :format => "rss")
+      get search_api_notes_path(:q => "no match", :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -948,7 +948,7 @@ module Api
         end
       end
 
-      get search_notes_path(:q => "no match", :format => "gpx")
+      get search_api_notes_path(:q => "no match", :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -959,14 +959,14 @@ module Api
     def test_search_by_time_no_match
       create(:note_with_comments)
 
-      get search_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "xml")
+      get search_api_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "xml")
       assert_response :success
       assert_equal "application/xml", @response.media_type
       assert_select "osm", :count => 1 do
         assert_select "note", :count => 0
       end
 
-      get search_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "json")
+      get search_api_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "json")
       assert_response :success
       assert_equal "application/json", @response.media_type
       js = ActiveSupport::JSON.decode(@response.body)
@@ -974,7 +974,7 @@ module Api
       assert_equal "FeatureCollection", js["type"]
       assert_equal 0, js["features"].count
 
-      get search_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "rss")
+      get search_api_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -983,7 +983,7 @@ module Api
         end
       end
 
-      get search_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "gpx")
+      get search_api_notes_path(:from => "01.01.2010", :to => "01.10.2010", :format => "gpx")
       assert_response :success
       assert_equal "application/gpx+xml", @response.media_type
       assert_select "gpx", :count => 1 do
@@ -992,22 +992,22 @@ module Api
     end
 
     def test_search_bad_params
-      get search_notes_path(:q => "no match", :limit => "0", :format => "json")
+      get search_api_notes_path(:q => "no match", :limit => "0", :format => "json")
       assert_response :bad_request
 
-      get search_notes_path(:q => "no match", :limit => "10001", :format => "json")
+      get search_api_notes_path(:q => "no match", :limit => "10001", :format => "json")
       assert_response :bad_request
 
-      get search_notes_path(:display_name => "non-existent")
+      get search_api_notes_path(:display_name => "non-existent")
       assert_response :bad_request
 
-      get search_notes_path(:user => "-1")
+      get search_api_notes_path(:user => "-1")
       assert_response :bad_request
 
-      get search_notes_path(:from => "wrong-date", :to => "wrong-date")
+      get search_api_notes_path(:from => "wrong-date", :to => "wrong-date")
       assert_response :bad_request
 
-      get search_notes_path(:from => "01.01.2010", :to => "2010.01.2010")
+      get search_api_notes_path(:from => "01.01.2010", :to => "2010.01.2010")
       assert_response :bad_request
     end
 
@@ -1019,7 +1019,7 @@ module Api
       create(:note_with_comments, :latitude => position, :longitude => position)
       create(:note_with_comments, :latitude => position, :longitude => position)
 
-      get feed_notes_path(:format => "rss")
+      get feed_api_notes_path(:format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -1028,7 +1028,7 @@ module Api
         end
       end
 
-      get feed_notes_path(:bbox => "1,1,1.2,1.2", :format => "rss")
+      get feed_api_notes_path(:bbox => "1,1,1.2,1.2", :format => "rss")
       assert_response :success
       assert_equal "application/rss+xml", @response.media_type
       assert_select "rss", :count => 1 do
@@ -1040,16 +1040,16 @@ module Api
     end
 
     def test_feed_fail
-      get feed_notes_path(:bbox => "1,1,1.2", :format => "rss")
+      get feed_api_notes_path(:bbox => "1,1,1.2", :format => "rss")
       assert_response :bad_request
 
-      get feed_notes_path(:bbox => "1,1,1.2,1.2,1.2", :format => "rss")
+      get feed_api_notes_path(:bbox => "1,1,1.2,1.2,1.2", :format => "rss")
       assert_response :bad_request
 
-      get feed_notes_path(:bbox => "1,1,1.2,1.2", :limit => "0", :format => "rss")
+      get feed_api_notes_path(:bbox => "1,1,1.2,1.2", :limit => "0", :format => "rss")
       assert_response :bad_request
 
-      get feed_notes_path(:bbox => "1,1,1.2,1.2", :limit => "10001", :format => "rss")
+      get feed_api_notes_path(:bbox => "1,1,1.2,1.2", :limit => "10001", :format => "rss")
       assert_response :bad_request
     end
   end
index cde9403d00bdec89b56e3cb069f4f8ded7766cc3..578e78fa25d8e533b517f707e3a43f2d5cd27118 100644 (file)
@@ -32,14 +32,6 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest
       { :path => "/changeset/1", :method => :get },
       { :controller => "browse", :action => "changeset", :id => "1" }
     )
-    assert_routing(
-      { :path => "/note/1", :method => :get },
-      { :controller => "browse", :action => "note", :id => "1" }
-    )
-    assert_routing(
-      { :path => "/note/new", :method => :get },
-      { :controller => "browse", :action => "new_note" }
-    )
     assert_routing(
       { :path => "/query", :method => :get },
       { :controller => "browse", :action => "query" }
@@ -106,78 +98,6 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest
     assert_select "div.changeset-comments ul li", :count => 4
   end
 
-  def test_read_note
-    open_note = create(:note_with_comments)
-
-    browse_check :browse_note_path, open_note.id, "browse/note"
-  end
-
-  def test_read_hidden_note
-    hidden_note_with_comment = create(:note_with_comments, :status => "hidden")
-
-    get browse_note_path(:id => hidden_note_with_comment)
-    assert_response :not_found
-    assert_template "browse/not_found"
-    assert_template :layout => "map"
-
-    get browse_note_path(:id => hidden_note_with_comment), :xhr => true
-    assert_response :not_found
-    assert_template "browse/not_found"
-    assert_template :layout => "xhr"
-
-    session_for(create(:moderator_user))
-
-    browse_check :browse_note_path, hidden_note_with_comment.id, "browse/note"
-  end
-
-  def test_read_note_hidden_comments
-    note_with_hidden_comment = create(:note_with_comments, :comments_count => 2) do |note|
-      create(:note_comment, :note => note, :visible => false)
-    end
-
-    browse_check :browse_note_path, note_with_hidden_comment.id, "browse/note"
-    assert_select "div.note-comments ul li", :count => 1
-
-    session_for(create(:moderator_user))
-
-    browse_check :browse_note_path, note_with_hidden_comment.id, "browse/note"
-    assert_select "div.note-comments ul li", :count => 2
-  end
-
-  def test_read_note_hidden_user_comment
-    hidden_user = create(:user, :deleted)
-    note_with_hidden_user_comment = create(:note_with_comments, :comments_count => 2) do |note|
-      create(:note_comment, :note => note, :author => hidden_user)
-    end
-
-    browse_check :browse_note_path, note_with_hidden_user_comment.id, "browse/note"
-    assert_select "div.note-comments ul li", :count => 1
-
-    session_for(create(:moderator_user))
-
-    browse_check :browse_note_path, note_with_hidden_user_comment.id, "browse/note"
-    assert_select "div.note-comments ul li", :count => 1
-  end
-
-  def test_read_closed_note
-    user = create(:user)
-    closed_note = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc, :comments_count => 2) do |note|
-      create(:note_comment, :event => "closed", :note => note, :author => user)
-    end
-
-    browse_check :browse_note_path, closed_note.id, "browse/note"
-    assert_select "div.note-comments ul li", :count => 2
-    assert_select "div.details", /Resolved by #{user.display_name}/
-
-    user.soft_destroy!
-
-    reset!
-
-    browse_check :browse_note_path, closed_note.id, "browse/note"
-    assert_select "div.note-comments ul li", :count => 1
-    assert_select "div.details", /Resolved by deleted/
-  end
-
   ##
   #  Methods to check redaction.
   #
@@ -256,12 +176,6 @@ class BrowseControllerTest < ActionDispatch::IntegrationTest
     assert_select ".browse-section.browse-relation", 2
   end
 
-  def test_new_note
-    get note_new_path
-    assert_response :success
-    assert_template "browse/new_note"
-  end
-
   def test_query
     get query_path
     assert_response :success
index 50e7ae833615905561666b31b8dbbef3d4bf3301..5cffbd702f8ebcfbf4b8eabe09094462e5ca1b0a 100644 (file)
@@ -15,6 +15,14 @@ class NotesControllerTest < ActionDispatch::IntegrationTest
       { :path => "/user/username/notes", :method => :get },
       { :controller => "notes", :action => "index", :display_name => "username" }
     )
+    assert_routing(
+      { :path => "/note/1", :method => :get },
+      { :controller => "notes", :action => "show", :id => "1" }
+    )
+    assert_routing(
+      { :path => "/note/new", :method => :get },
+      { :controller => "notes", :action => "new" }
+    )
   end
 
   def test_index_success
@@ -80,4 +88,120 @@ class NotesControllerTest < ActionDispatch::IntegrationTest
     assert_response :success
     assert_select "h4", :html => "No notes"
   end
+
+  def test_read_note
+    open_note = create(:note_with_comments)
+
+    browse_check :note_path, open_note.id, "notes/show"
+  end
+
+  def test_read_hidden_note
+    hidden_note_with_comment = create(:note_with_comments, :status => "hidden")
+
+    get note_path(:id => hidden_note_with_comment)
+    assert_response :not_found
+    assert_template "browse/not_found"
+    assert_template :layout => "map"
+
+    get note_path(:id => hidden_note_with_comment), :xhr => true
+    assert_response :not_found
+    assert_template "browse/not_found"
+    assert_template :layout => "xhr"
+
+    session_for(create(:moderator_user))
+
+    browse_check :note_path, hidden_note_with_comment.id, "notes/show"
+  end
+
+  def test_read_note_hidden_comments
+    note_with_hidden_comment = create(:note_with_comments, :comments_count => 2) do |note|
+      create(:note_comment, :note => note, :visible => false)
+    end
+
+    browse_check :note_path, note_with_hidden_comment.id, "notes/show"
+    assert_select "div.note-comments ul li", :count => 1
+
+    session_for(create(:moderator_user))
+
+    browse_check :note_path, note_with_hidden_comment.id, "notes/show"
+    assert_select "div.note-comments ul li", :count => 2
+  end
+
+  def test_read_note_hidden_user_comment
+    hidden_user = create(:user, :deleted)
+    note_with_hidden_user_comment = create(:note_with_comments, :comments_count => 2) do |note|
+      create(:note_comment, :note => note, :author => hidden_user)
+    end
+
+    browse_check :note_path, note_with_hidden_user_comment.id, "notes/show"
+    assert_select "div.note-comments ul li", :count => 1
+
+    session_for(create(:moderator_user))
+
+    browse_check :note_path, note_with_hidden_user_comment.id, "notes/show"
+    assert_select "div.note-comments ul li", :count => 1
+  end
+
+  def test_read_closed_note
+    user = create(:user)
+    closed_note = create(:note_with_comments, :status => "closed", :closed_at => Time.now.utc, :comments_count => 2) do |note|
+      create(:note_comment, :event => "closed", :note => note, :author => user)
+    end
+
+    browse_check :note_path, closed_note.id, "notes/show"
+    assert_select "div.note-comments ul li", :count => 2
+    assert_select "div.details", /Resolved by #{user.display_name}/
+
+    user.soft_destroy!
+
+    reset!
+
+    browse_check :note_path, closed_note.id, "notes/show"
+    assert_select "div.note-comments ul li", :count => 1
+    assert_select "div.details", /Resolved by deleted/
+  end
+
+  def test_new_note
+    get new_note_path
+    assert_response :success
+    assert_template "notes/new"
+  end
+
+  private
+
+  # This is a convenience method for most of the above checks
+  # First we check that when we don't have an id, it will correctly return a 404
+  # then we check that we get the correct 404 when a non-existant id is passed
+  # then we check that it will get a successful response, when we do pass an id
+  def browse_check(path, id, template)
+    path_method = method(path)
+
+    assert_raise ActionController::UrlGenerationError do
+      get path_method.call
+    end
+
+    # assert_raise ActionController::UrlGenerationError do
+    #   get path_method.call(:id => -10) # we won't have an id that's negative
+    # end
+
+    get path_method.call(:id => 0)
+    assert_response :not_found
+    assert_template "browse/not_found"
+    assert_template :layout => "map"
+
+    get path_method.call(:id => 0), :xhr => true
+    assert_response :not_found
+    assert_template "browse/not_found"
+    assert_template :layout => "xhr"
+
+    get path_method.call(:id => id)
+    assert_response :success
+    assert_template template
+    assert_template :layout => "map"
+
+    get path_method.call(:id => id), :xhr => true
+    assert_response :success
+    assert_template template
+    assert_template :layout => "xhr"
+  end
 end
index ccd8ba254bff22180644862ed5a73bedefa27972..8a38da5c000ee99a7227b1caf8326979f93f34a1 100644 (file)
@@ -98,7 +98,7 @@ class SiteControllerTest < ActionDispatch::IntegrationTest
     assert_redirected_to :controller => :browse, :action => :relation, :id => 123
 
     get root_path(:note => 123)
-    assert_redirected_to :controller => :browse, :action => :note, :id => 123
+    assert_redirected_to :controller => :notes, :action => :show, :id => 123
 
     get root_path(:query => "test")
     assert_redirected_to :controller => :geocoder, :action => :search, :query => "test"
index 1167797c5b8b85781a91e479fa21553c6cc22b6b..1de18c9edadab94d55b41e3d537b649feb9628f0 100644 (file)
@@ -12,7 +12,7 @@ class IndexTest < ApplicationSystemTestCase
 
   test "note included in edit link" do
     note = create(:note_with_comments)
-    visit browse_note_path(note)
+    visit note_path(note)
     assert_selector "#editanchor[href*='?note=#{note.id}#']"
 
     find("#sidebar .btn-close").click
@@ -27,8 +27,8 @@ class IndexTest < ApplicationSystemTestCase
     visible_note = create(:note, :latitude => position, :longitude => position)
     create(:note_comment, :note => visible_note, :body => "this-is-a-visible-note")
 
-    visit root_path(:anchor => "map=15/1/1") # view place of hidden note in case it is not rendered during browse_note_path(hidden_note)
-    visit browse_note_path(hidden_note)
+    visit root_path(:anchor => "map=15/1/1") # view place of hidden note in case it is not rendered during note_path(hidden_note)
+    visit note_path(hidden_note)
     find(".leaflet-control.control-layers .control-button").click
     find("#map-ui .overlay-layers .form-check-label", :text => "Map Notes").click
     visible_note_marker = find(".leaflet-marker-icon[title=this-is-a-visible-note]")
diff --git a/test/system/note_comments_test.rb b/test/system/note_comments_test.rb
new file mode 100644 (file)
index 0000000..23f3fc9
--- /dev/null
@@ -0,0 +1,17 @@
+require "application_system_test_case"
+
+class NoteCommentsTest < ApplicationSystemTestCase
+  def test_action_text
+    note = create(:note_with_comments)
+    sign_in_as(create(:user))
+    visit note_path(note)
+
+    assert_button "Resolve"
+    assert_button "Comment", :disabled => true
+
+    fill_in "text", :with => "Some text"
+
+    assert_button "Comment & Resolve"
+    assert_button "Comment"
+  end
+end
index 2f407ca60d0dbd700b83941dfe8a3a8ee6e2f971..79894eb897d4a514e3ebb94b5a89a680a1bcedf5 100644 (file)
@@ -3,18 +3,18 @@ require "application_system_test_case"
 class ReportNoteTest < ApplicationSystemTestCase
   def test_no_link_when_not_logged_in
     note = create(:note_with_comments)
-    visit browse_note_path(note)
+    visit note_path(note)
     assert_content note.comments.first.body
 
-    assert_no_content I18n.t("browse.note.report")
+    assert_no_content I18n.t("notes.show.report")
   end
 
   def test_can_report_anonymous_notes
     note = create(:note_with_comments)
     sign_in_as(create(:user))
-    visit browse_note_path(note)
+    visit note_path(note)
 
-    click_on I18n.t("browse.note.report")
+    click_on I18n.t("notes.show.report")
     assert_content "Report"
     assert_content I18n.t("reports.new.disclaimer.intro")
 
@@ -33,9 +33,9 @@ class ReportNoteTest < ApplicationSystemTestCase
   def test_can_report_notes_with_author
     note = create(:note_comment, :author => create(:user)).note
     sign_in_as(create(:user))
-    visit browse_note_path(note)
+    visit note_path(note)
 
-    click_on I18n.t("browse.note.report")
+    click_on I18n.t("notes.show.report")
     assert_content "Report"
     assert_content I18n.t("reports.new.disclaimer.intro")
 
index 879558ab5fe05bb777f495d5c7c1afe68f424db9..7a9e800c8c0da99ebf7351d6a863d9c8cec8ba7a 100644 (file)
@@ -3,7 +3,7 @@ require "application_system_test_case"
 class ReportUserTest < ApplicationSystemTestCase
   def test_no_link_when_not_logged_in
     note = create(:note_with_comments)
-    visit browse_note_path(note)
+    visit note_path(note)
     assert_content note.comments.first.body
 
     assert_no_content I18n.t("users.show.report")