Merge remote-tracking branch 'upstream/pull/2052'
This commit is contained in:
commit
70d6880e10
35 changed files with 164 additions and 169 deletions
|
@ -177,7 +177,7 @@ Style/FrozenStringLiteralComment:
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/IfUnlessModifier:
|
Style/IfUnlessModifier:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/way_controller.rb'
|
- 'app/controllers/ways_controller.rb'
|
||||||
|
|
||||||
# Offense count: 70
|
# Offense count: 70
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class DiaryEntryController < ApplicationController
|
class DiaryEntriesController < ApplicationController
|
||||||
layout "site", :except => :rss
|
layout "site", :except => :rss
|
||||||
|
|
||||||
before_action :authorize_web
|
before_action :authorize_web
|
||||||
|
@ -12,7 +12,7 @@ class DiaryEntryController < ApplicationController
|
||||||
before_action :allow_thirdparty_images, :only => [:new, :edit, :index, :show, :comments]
|
before_action :allow_thirdparty_images, :only => [:new, :edit, :index, :show, :comments]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@title = t "diary_entry.new.title"
|
@title = t "diary_entries.new.title"
|
||||||
|
|
||||||
if request.post?
|
if request.post?
|
||||||
@diary_entry = DiaryEntry.new(entry_params)
|
@diary_entry = DiaryEntry.new(entry_params)
|
||||||
|
@ -44,7 +44,7 @@ class DiaryEntryController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@title = t "diary_entry.edit.title"
|
@title = t "diary_entries.edit.title"
|
||||||
@diary_entry = DiaryEntry.find(params[:id])
|
@diary_entry = DiaryEntry.find(params[:id])
|
||||||
|
|
||||||
if current_user != @diary_entry.user
|
if current_user != @diary_entry.user
|
||||||
|
@ -105,7 +105,7 @@ class DiaryEntryController < ApplicationController
|
||||||
@user = User.active.find_by(:display_name => params[:display_name])
|
@user = User.active.find_by(:display_name => params[:display_name])
|
||||||
|
|
||||||
if @user
|
if @user
|
||||||
@title = t "diary_entry.index.user_title", :user => @user.display_name
|
@title = t "diary_entries.index.user_title", :user => @user.display_name
|
||||||
@entries = @user.diary_entries
|
@entries = @user.diary_entries
|
||||||
else
|
else
|
||||||
render_unknown_user params[:display_name]
|
render_unknown_user params[:display_name]
|
||||||
|
@ -113,7 +113,7 @@ class DiaryEntryController < ApplicationController
|
||||||
end
|
end
|
||||||
elsif params[:friends]
|
elsif params[:friends]
|
||||||
if current_user
|
if current_user
|
||||||
@title = t "diary_entry.index.title_friends"
|
@title = t "diary_entries.index.title_friends"
|
||||||
@entries = DiaryEntry.where(:user_id => current_user.friend_users)
|
@entries = DiaryEntry.where(:user_id => current_user.friend_users)
|
||||||
else
|
else
|
||||||
require_user
|
require_user
|
||||||
|
@ -121,7 +121,7 @@ class DiaryEntryController < ApplicationController
|
||||||
end
|
end
|
||||||
elsif params[:nearby]
|
elsif params[:nearby]
|
||||||
if current_user
|
if current_user
|
||||||
@title = t "diary_entry.index.title_nearby"
|
@title = t "diary_entries.index.title_nearby"
|
||||||
@entries = DiaryEntry.where(:user_id => current_user.nearby)
|
@entries = DiaryEntry.where(:user_id => current_user.nearby)
|
||||||
else
|
else
|
||||||
require_user
|
require_user
|
||||||
|
@ -131,10 +131,10 @@ class DiaryEntryController < ApplicationController
|
||||||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
|
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
|
||||||
|
|
||||||
if params[:language]
|
if params[:language]
|
||||||
@title = t "diary_entry.index.in_language_title", :language => Language.find(params[:language]).english_name
|
@title = t "diary_entries.index.in_language_title", :language => Language.find(params[:language]).english_name
|
||||||
@entries = @entries.where(:language_code => params[:language])
|
@entries = @entries.where(:language_code => params[:language])
|
||||||
else
|
else
|
||||||
@title = t "diary_entry.index.title"
|
@title = t "diary_entries.index.title"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -156,9 +156,9 @@ class DiaryEntryController < ApplicationController
|
||||||
|
|
||||||
if user
|
if user
|
||||||
@entries = user.diary_entries
|
@entries = user.diary_entries
|
||||||
@title = t("diary_entry.feed.user.title", :user => user.display_name)
|
@title = t("diary_entries.feed.user.title", :user => user.display_name)
|
||||||
@description = t("diary_entry.feed.user.description", :user => user.display_name)
|
@description = t("diary_entries.feed.user.description", :user => user.display_name)
|
||||||
@link = url_for :controller => "diary_entry", :action => "index", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
@link = url_for :action => "index", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||||
else
|
else
|
||||||
head :not_found
|
head :not_found
|
||||||
return
|
return
|
||||||
|
@ -168,13 +168,13 @@ class DiaryEntryController < ApplicationController
|
||||||
|
|
||||||
if params[:language]
|
if params[:language]
|
||||||
@entries = @entries.where(:language_code => params[:language])
|
@entries = @entries.where(:language_code => params[:language])
|
||||||
@title = t("diary_entry.feed.language.title", :language_name => Language.find(params[:language]).english_name)
|
@title = t("diary_entries.feed.language.title", :language_name => Language.find(params[:language]).english_name)
|
||||||
@description = t("diary_entry.feed.language.description", :language_name => Language.find(params[:language]).english_name)
|
@description = t("diary_entries.feed.language.description", :language_name => Language.find(params[:language]).english_name)
|
||||||
@link = url_for :controller => "diary_entry", :action => "index", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
@link = url_for :action => "index", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||||
else
|
else
|
||||||
@title = t("diary_entry.feed.all.title")
|
@title = t("diary_entries.feed.all.title")
|
||||||
@description = t("diary_entry.feed.all.description")
|
@description = t("diary_entries.feed.all.description")
|
||||||
@link = url_for :controller => "diary_entry", :action => "index", :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
@link = url_for :action => "index", :host => SERVER_URL, :protocol => SERVER_PROTOCOL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -184,9 +184,9 @@ class DiaryEntryController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@entry = @user.diary_entries.visible.where(:id => params[:id]).first
|
@entry = @user.diary_entries.visible.where(:id => params[:id]).first
|
||||||
if @entry
|
if @entry
|
||||||
@title = t "diary_entry.show.title", :user => params[:display_name], :title => @entry.title
|
@title = t "diary_entries.show.title", :user => params[:display_name], :title => @entry.title
|
||||||
else
|
else
|
||||||
@title = t "diary_entry.no_such_entry.title", :id => params[:id]
|
@title = t "diary_entries.no_such_entry.title", :id => params[:id]
|
||||||
render :action => "no_such_entry", :status => :not_found
|
render :action => "no_such_entry", :status => :not_found
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
# The NodeController is the RESTful interface to Node objects
|
# The NodeController is the RESTful interface to Node objects
|
||||||
|
|
||||||
class NodeController < ApplicationController
|
class NodesController < ApplicationController
|
||||||
require "xml/libxml"
|
require "xml/libxml"
|
||||||
|
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
|
@ -1,4 +1,4 @@
|
||||||
class OldNodeController < OldController
|
class OldNodesController < OldController
|
||||||
private
|
private
|
||||||
|
|
||||||
def lookup_old_element
|
def lookup_old_element
|
|
@ -1,4 +1,4 @@
|
||||||
class OldRelationController < OldController
|
class OldRelationsController < OldController
|
||||||
private
|
private
|
||||||
|
|
||||||
def lookup_old_element
|
def lookup_old_element
|
|
@ -1,4 +1,4 @@
|
||||||
class OldWayController < OldController
|
class OldWaysController < OldController
|
||||||
private
|
private
|
||||||
|
|
||||||
def lookup_old_element
|
def lookup_old_element
|
|
@ -1,4 +1,4 @@
|
||||||
class RelationController < ApplicationController
|
class RelationsController < ApplicationController
|
||||||
require "xml/libxml"
|
require "xml/libxml"
|
||||||
|
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
|
@ -1,4 +1,4 @@
|
||||||
class WayController < ApplicationController
|
class WaysController < ApplicationController
|
||||||
require "xml/libxml"
|
require "xml/libxml"
|
||||||
|
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
|
@ -8,7 +8,7 @@
|
||||||
<%= render :partial => @type, :object => @feature %>
|
<%= render :partial => @type, :object => @feature %>
|
||||||
|
|
||||||
<div class='secondary-actions'>
|
<div class='secondary-actions'>
|
||||||
<%= link_to(t('browse.download_xml'), :controller => @type, :action => "read") %>
|
<%= link_to(t('browse.download_xml'), :controller => @type.pluralize, :action => "read") %>
|
||||||
·
|
·
|
||||||
<%= link_to(t('browse.view_history'), :action => "#{@type}_history") %>
|
<%= link_to(t('browse.view_history'), :action => "#{@type}_history") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<%= render :partial => @type, :collection => @feature.send("old_#{@type}s").reverse %>
|
<%= render :partial => @type, :collection => @feature.send("old_#{@type}s").reverse %>
|
||||||
|
|
||||||
<div class='secondary-actions'>
|
<div class='secondary-actions'>
|
||||||
<%= link_to(t('browse.download_xml'), :controller => "old_#{@type}", :action => "history") %>
|
<%= link_to(t('browse.download_xml'), :controller => "old_#{@type.pluralize}", :action => "history") %>
|
||||||
·
|
·
|
||||||
<%= link_to(t('browse.view_details'), :action => @type) %>
|
<%= link_to(t('browse.view_details'), :action => @type) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<h2><%= link_to h(diary_entry.title), diary_entry_path(diary_entry.user, diary_entry) %></h2>
|
<h2><%= link_to h(diary_entry.title), diary_entry_path(diary_entry.user, diary_entry) %></h2>
|
||||||
|
|
||||||
<small class='deemphasize'>
|
<small class='deemphasize'>
|
||||||
<%= raw(t '.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'index', :display_name => nil, :language => diary_entry.language_code)) %>
|
<%= raw(t '.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entries', :action => 'index', :display_name => nil, :language => diary_entry.language_code)) %>
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -43,7 +43,7 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<% if action_name == 'new' %>
|
<% if action_name == 'new' %>
|
||||||
<%= submit_tag t('diary_entry.new.publish_button') %>
|
<%= submit_tag t('diary_entries.new.publish_button') %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= submit_tag t('.save_button') %>
|
<%= submit_tag t('.save_button') %>
|
||||||
<% end %>
|
<% end %>
|
|
@ -13,13 +13,13 @@
|
||||||
<% if @user %>
|
<% if @user %>
|
||||||
<% if @user == current_user %>
|
<% if @user == current_user %>
|
||||||
<div>
|
<div>
|
||||||
<li><%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('.new_title')} %></li>
|
<li><%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), diary_new_path, {:title => t('.new_title')} %></li>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if current_user %>
|
<% if current_user %>
|
||||||
<div>
|
<div>
|
||||||
<li><%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('.new_title')} %></li>
|
<li><%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), diary_new_path, {:title => t('.new_title')} %></li>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
|
@ -18,11 +18,11 @@
|
||||||
<span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
|
<span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to t('.my diary'), :controller => 'diary_entry', :action => 'index', :display_name => current_user.display_name %>
|
<%= link_to t('.my diary'), :controller => 'diary_entries', :action => 'index', :display_name => current_user.display_name %>
|
||||||
<span class='count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
|
<span class='count-number'><%= number_with_delimiter(current_user.diary_entries.size) %></span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to t('.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => current_user.display_name %>
|
<%= link_to t('.my comments' ), :controller => 'diary_entries', :action => 'comments', :display_name => current_user.display_name %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to t('.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %>
|
<%= link_to t('.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %>
|
||||||
|
@ -66,11 +66,11 @@
|
||||||
<%= link_to t('.send message'), new_message_path(@user) %>
|
<%= link_to t('.send message'), new_message_path(@user) %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to t('.diary'), :controller => 'diary_entry', :action => 'index', :display_name => @user.display_name %>
|
<%= link_to t('.diary'), :controller => 'diary_entries', :action => 'index', :display_name => @user.display_name %>
|
||||||
<span class='count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
|
<span class='count-number'><%= number_with_delimiter(@user.diary_entries.size) %></span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to t('.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @user.display_name %>
|
<%= link_to t('.comments'), :controller => 'diary_entries', :action => 'comments', :display_name => @user.display_name %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<% if current_user and current_user.is_friends_with?(@user) %>
|
<% if current_user and current_user.is_friends_with?(@user) %>
|
||||||
|
|
|
@ -253,7 +253,7 @@ en:
|
||||||
title_particular: "OpenStreetMap changeset #%{changeset_id} discussion"
|
title_particular: "OpenStreetMap changeset #%{changeset_id} discussion"
|
||||||
timeout:
|
timeout:
|
||||||
sorry: "Sorry, the list of changeset comments you requested took too long to retrieve."
|
sorry: "Sorry, the list of changeset comments you requested took too long to retrieve."
|
||||||
diary_entry:
|
diary_entries:
|
||||||
new:
|
new:
|
||||||
title: New Diary Entry
|
title: New Diary Entry
|
||||||
publish_button: "Publish"
|
publish_button: "Publish"
|
||||||
|
|
|
@ -20,38 +20,38 @@ OpenStreetMap::Application.routes.draw do
|
||||||
post "changeset/comment/:id/hide" => "changeset_comments#destroy", :as => :changeset_comment_hide, :id => /\d+/
|
post "changeset/comment/:id/hide" => "changeset_comments#destroy", :as => :changeset_comment_hide, :id => /\d+/
|
||||||
post "changeset/comment/:id/unhide" => "changeset_comments#restore", :as => :changeset_comment_unhide, :id => /\d+/
|
post "changeset/comment/:id/unhide" => "changeset_comments#restore", :as => :changeset_comment_unhide, :id => /\d+/
|
||||||
|
|
||||||
put "node/create" => "node#create"
|
put "node/create" => "nodes#create"
|
||||||
get "node/:id/ways" => "way#ways_for_node", :id => /\d+/
|
get "node/:id/ways" => "ways#ways_for_node", :id => /\d+/
|
||||||
get "node/:id/relations" => "relation#relations_for_node", :id => /\d+/
|
get "node/:id/relations" => "relations#relations_for_node", :id => /\d+/
|
||||||
get "node/:id/history" => "old_node#history", :id => /\d+/
|
get "node/:id/history" => "old_nodes#history", :id => /\d+/
|
||||||
post "node/:id/:version/redact" => "old_node#redact", :version => /\d+/, :id => /\d+/
|
post "node/:id/:version/redact" => "old_nodes#redact", :version => /\d+/, :id => /\d+/
|
||||||
get "node/:id/:version" => "old_node#version", :id => /\d+/, :version => /\d+/
|
get "node/:id/:version" => "old_nodes#version", :id => /\d+/, :version => /\d+/
|
||||||
get "node/:id" => "node#read", :id => /\d+/
|
get "node/:id" => "nodes#read", :id => /\d+/
|
||||||
put "node/:id" => "node#update", :id => /\d+/
|
put "node/:id" => "nodes#update", :id => /\d+/
|
||||||
delete "node/:id" => "node#delete", :id => /\d+/
|
delete "node/:id" => "nodes#delete", :id => /\d+/
|
||||||
get "nodes" => "node#nodes"
|
get "nodes" => "nodes#nodes"
|
||||||
|
|
||||||
put "way/create" => "way#create"
|
put "way/create" => "ways#create"
|
||||||
get "way/:id/history" => "old_way#history", :id => /\d+/
|
get "way/:id/history" => "old_ways#history", :id => /\d+/
|
||||||
get "way/:id/full" => "way#full", :id => /\d+/
|
get "way/:id/full" => "ways#full", :id => /\d+/
|
||||||
get "way/:id/relations" => "relation#relations_for_way", :id => /\d+/
|
get "way/:id/relations" => "relations#relations_for_way", :id => /\d+/
|
||||||
post "way/:id/:version/redact" => "old_way#redact", :version => /\d+/, :id => /\d+/
|
post "way/:id/:version/redact" => "old_ways#redact", :version => /\d+/, :id => /\d+/
|
||||||
get "way/:id/:version" => "old_way#version", :id => /\d+/, :version => /\d+/
|
get "way/:id/:version" => "old_ways#version", :id => /\d+/, :version => /\d+/
|
||||||
get "way/:id" => "way#read", :id => /\d+/
|
get "way/:id" => "ways#read", :id => /\d+/
|
||||||
put "way/:id" => "way#update", :id => /\d+/
|
put "way/:id" => "ways#update", :id => /\d+/
|
||||||
delete "way/:id" => "way#delete", :id => /\d+/
|
delete "way/:id" => "ways#delete", :id => /\d+/
|
||||||
get "ways" => "way#ways"
|
get "ways" => "ways#ways"
|
||||||
|
|
||||||
put "relation/create" => "relation#create"
|
put "relation/create" => "relations#create"
|
||||||
get "relation/:id/relations" => "relation#relations_for_relation", :id => /\d+/
|
get "relation/:id/relations" => "relations#relations_for_relation", :id => /\d+/
|
||||||
get "relation/:id/history" => "old_relation#history", :id => /\d+/
|
get "relation/:id/history" => "old_relations#history", :id => /\d+/
|
||||||
get "relation/:id/full" => "relation#full", :id => /\d+/
|
get "relation/:id/full" => "relations#full", :id => /\d+/
|
||||||
post "relation/:id/:version/redact" => "old_relation#redact", :version => /\d+/, :id => /\d+/
|
post "relation/:id/:version/redact" => "old_relations#redact", :version => /\d+/, :id => /\d+/
|
||||||
get "relation/:id/:version" => "old_relation#version", :id => /\d+/, :version => /\d+/
|
get "relation/:id/:version" => "old_relations#version", :id => /\d+/, :version => /\d+/
|
||||||
get "relation/:id" => "relation#read", :id => /\d+/
|
get "relation/:id" => "relations#read", :id => /\d+/
|
||||||
put "relation/:id" => "relation#update", :id => /\d+/
|
put "relation/:id" => "relations#update", :id => /\d+/
|
||||||
delete "relation/:id" => "relation#delete", :id => /\d+/
|
delete "relation/:id" => "relations#delete", :id => /\d+/
|
||||||
get "relations" => "relation#relations"
|
get "relations" => "relations#relations"
|
||||||
|
|
||||||
get "map" => "api#map"
|
get "map" => "api#map"
|
||||||
|
|
||||||
|
@ -214,24 +214,24 @@ OpenStreetMap::Application.routes.draw do
|
||||||
post "/trace/:id/delete" => "traces#delete", :id => /\d+/
|
post "/trace/:id/delete" => "traces#delete", :id => /\d+/
|
||||||
|
|
||||||
# diary pages
|
# diary pages
|
||||||
match "/diary/new" => "diary_entry#new", :via => [:get, :post]
|
match "/diary/new" => "diary_entries#new", :via => [:get, :post]
|
||||||
get "/diary/friends" => "diary_entry#index", :friends => true, :as => "friend_diaries"
|
get "/diary/friends" => "diary_entries#index", :friends => true, :as => "friend_diaries"
|
||||||
get "/diary/nearby" => "diary_entry#index", :nearby => true, :as => "nearby_diaries"
|
get "/diary/nearby" => "diary_entries#index", :nearby => true, :as => "nearby_diaries"
|
||||||
get "/user/:display_name/diary/rss" => "diary_entry#rss", :defaults => { :format => :rss }
|
get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
|
||||||
get "/diary/:language/rss" => "diary_entry#rss", :defaults => { :format => :rss }
|
get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss }
|
||||||
get "/diary/rss" => "diary_entry#rss", :defaults => { :format => :rss }
|
get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss }
|
||||||
get "/user/:display_name/diary/comments/:page" => "diary_entry#comments", :page => /[1-9][0-9]*/
|
get "/user/:display_name/diary/comments/:page" => "diary_entries#comments", :page => /[1-9][0-9]*/
|
||||||
get "/user/:display_name/diary/comments/" => "diary_entry#comments"
|
get "/user/:display_name/diary/comments/" => "diary_entries#comments"
|
||||||
get "/user/:display_name/diary" => "diary_entry#index"
|
get "/user/:display_name/diary" => "diary_entries#index"
|
||||||
get "/diary/:language" => "diary_entry#index"
|
get "/diary/:language" => "diary_entries#index"
|
||||||
get "/diary" => "diary_entry#index"
|
get "/diary" => "diary_entries#index"
|
||||||
get "/user/:display_name/diary/:id" => "diary_entry#show", :id => /\d+/, :as => :diary_entry
|
get "/user/:display_name/diary/:id" => "diary_entries#show", :id => /\d+/, :as => :diary_entry
|
||||||
post "/user/:display_name/diary/:id/newcomment" => "diary_entry#comment", :id => /\d+/
|
post "/user/:display_name/diary/:id/newcomment" => "diary_entries#comment", :id => /\d+/
|
||||||
match "/user/:display_name/diary/:id/edit" => "diary_entry#edit", :via => [:get, :post], :id => /\d+/
|
match "/user/:display_name/diary/:id/edit" => "diary_entries#edit", :via => [:get, :post], :id => /\d+/
|
||||||
post "/user/:display_name/diary/:id/hide" => "diary_entry#hide", :id => /\d+/, :as => :hide_diary_entry
|
post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry
|
||||||
post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_entry#hidecomment", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
|
post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_entries#hidecomment", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
|
||||||
post "/user/:display_name/diary/:id/subscribe" => "diary_entry#subscribe", :as => :diary_entry_subscribe, :id => /\d+/
|
post "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :as => :diary_entry_subscribe, :id => /\d+/
|
||||||
post "/user/:display_name/diary/:id/unsubscribe" => "diary_entry#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/
|
post "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/
|
||||||
|
|
||||||
# user pages
|
# user pages
|
||||||
get "/user/:display_name" => "users#show", :as => "user"
|
get "/user/:display_name" => "users#show", :as => "user"
|
||||||
|
|
|
@ -1508,7 +1508,7 @@ CHANGESET
|
||||||
changeset_id = @response.body.to_i
|
changeset_id = @response.body.to_i
|
||||||
|
|
||||||
# add a single node to it
|
# add a single node to it
|
||||||
with_controller(NodeController.new) do
|
with_controller(NodesController.new) do
|
||||||
content "<osm><node lon='1' lat='2' changeset='#{changeset_id}'/></osm>"
|
content "<osm><node lon='1' lat='2' changeset='#{changeset_id}'/></osm>"
|
||||||
put :create
|
put :create
|
||||||
assert_response :success, "Couldn't create node."
|
assert_response :success, "Couldn't create node."
|
||||||
|
@ -1523,7 +1523,7 @@ CHANGESET
|
||||||
assert_select "osm>changeset[max_lat='2.0000000']", 1
|
assert_select "osm>changeset[max_lat='2.0000000']", 1
|
||||||
|
|
||||||
# add another node to it
|
# add another node to it
|
||||||
with_controller(NodeController.new) do
|
with_controller(NodesController.new) do
|
||||||
content "<osm><node lon='2' lat='1' changeset='#{changeset_id}'/></osm>"
|
content "<osm><node lon='2' lat='1' changeset='#{changeset_id}'/></osm>"
|
||||||
put :create
|
put :create
|
||||||
assert_response :success, "Couldn't create second node."
|
assert_response :success, "Couldn't create second node."
|
||||||
|
@ -1538,7 +1538,7 @@ CHANGESET
|
||||||
assert_select "osm>changeset[max_lat='2.0000000']", 1
|
assert_select "osm>changeset[max_lat='2.0000000']", 1
|
||||||
|
|
||||||
# add (delete) a way to it, which contains a point at (3,3)
|
# add (delete) a way to it, which contains a point at (3,3)
|
||||||
with_controller(WayController.new) do
|
with_controller(WaysController.new) do
|
||||||
content update_changeset(way.to_xml, changeset_id)
|
content update_changeset(way.to_xml, changeset_id)
|
||||||
put :delete, :params => { :id => way.id }
|
put :delete, :params => { :id => way.id }
|
||||||
assert_response :success, "Couldn't delete a way."
|
assert_response :success, "Couldn't delete a way."
|
||||||
|
@ -1818,7 +1818,7 @@ CHANGESET
|
||||||
changeset.num_changes = Changeset::MAX_ELEMENTS - offset
|
changeset.num_changes = Changeset::MAX_ELEMENTS - offset
|
||||||
changeset.save!
|
changeset.save!
|
||||||
|
|
||||||
with_controller(NodeController.new) do
|
with_controller(NodesController.new) do
|
||||||
# create a new node
|
# create a new node
|
||||||
content "<osm><node changeset='#{cs_id}' lat='0.0' lon='0.0'/></osm>"
|
content "<osm><node changeset='#{cs_id}' lat='0.0' lon='0.0'/></osm>"
|
||||||
put :create
|
put :create
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
class DiaryEntryControllerTest < ActionController::TestCase
|
class DiaryEntriesControllerTest < ActionController::TestCase
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
@ -16,86 +16,86 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary", :method => :get },
|
{ :path => "/diary", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "index" }
|
{ :controller => "diary_entries", :action => "index" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary/language", :method => :get },
|
{ :path => "/diary/language", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "index", :language => "language" }
|
{ :controller => "diary_entries", :action => "index", :language => "language" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary", :method => :get },
|
{ :path => "/user/username/diary", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "index", :display_name => "username" }
|
{ :controller => "diary_entries", :action => "index", :display_name => "username" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary/friends", :method => :get },
|
{ :path => "/diary/friends", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "index", :friends => true }
|
{ :controller => "diary_entries", :action => "index", :friends => true }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary/nearby", :method => :get },
|
{ :path => "/diary/nearby", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "index", :nearby => true }
|
{ :controller => "diary_entries", :action => "index", :nearby => true }
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary/rss", :method => :get },
|
{ :path => "/diary/rss", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "rss", :format => :rss }
|
{ :controller => "diary_entries", :action => "rss", :format => :rss }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary/language/rss", :method => :get },
|
{ :path => "/diary/language/rss", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "rss", :language => "language", :format => :rss }
|
{ :controller => "diary_entries", :action => "rss", :language => "language", :format => :rss }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/rss", :method => :get },
|
{ :path => "/user/username/diary/rss", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "rss", :display_name => "username", :format => :rss }
|
{ :controller => "diary_entries", :action => "rss", :display_name => "username", :format => :rss }
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/comments", :method => :get },
|
{ :path => "/user/username/diary/comments", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "comments", :display_name => "username" }
|
{ :controller => "diary_entries", :action => "comments", :display_name => "username" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/comments/1", :method => :get },
|
{ :path => "/user/username/diary/comments/1", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "comments", :display_name => "username", :page => "1" }
|
{ :controller => "diary_entries", :action => "comments", :display_name => "username", :page => "1" }
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary/new", :method => :get },
|
{ :path => "/diary/new", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "new" }
|
{ :controller => "diary_entries", :action => "new" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/diary/new", :method => :post },
|
{ :path => "/diary/new", :method => :post },
|
||||||
{ :controller => "diary_entry", :action => "new" }
|
{ :controller => "diary_entries", :action => "new" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1", :method => :get },
|
{ :path => "/user/username/diary/1", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "show", :display_name => "username", :id => "1" }
|
{ :controller => "diary_entries", :action => "show", :display_name => "username", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1/edit", :method => :get },
|
{ :path => "/user/username/diary/1/edit", :method => :get },
|
||||||
{ :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" }
|
{ :controller => "diary_entries", :action => "edit", :display_name => "username", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1/edit", :method => :post },
|
{ :path => "/user/username/diary/1/edit", :method => :post },
|
||||||
{ :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" }
|
{ :controller => "diary_entries", :action => "edit", :display_name => "username", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1/newcomment", :method => :post },
|
{ :path => "/user/username/diary/1/newcomment", :method => :post },
|
||||||
{ :controller => "diary_entry", :action => "comment", :display_name => "username", :id => "1" }
|
{ :controller => "diary_entries", :action => "comment", :display_name => "username", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1/hide", :method => :post },
|
{ :path => "/user/username/diary/1/hide", :method => :post },
|
||||||
{ :controller => "diary_entry", :action => "hide", :display_name => "username", :id => "1" }
|
{ :controller => "diary_entries", :action => "hide", :display_name => "username", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1/hidecomment/2", :method => :post },
|
{ :path => "/user/username/diary/1/hidecomment/2", :method => :post },
|
||||||
{ :controller => "diary_entry", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" }
|
{ :controller => "diary_entries", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1/subscribe", :method => :post },
|
{ :path => "/user/username/diary/1/subscribe", :method => :post },
|
||||||
{ :controller => "diary_entry", :action => "subscribe", :display_name => "username", :id => "1" }
|
{ :controller => "diary_entries", :action => "subscribe", :display_name => "username", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/diary/1/unsubscribe", :method => :post },
|
{ :path => "/user/username/diary/1/unsubscribe", :method => :post },
|
||||||
{ :controller => "diary_entry", :action => "unsubscribe", :display_name => "username", :id => "1" }
|
{ :controller => "diary_entries", :action => "unsubscribe", :display_name => "username", :id => "1" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
:params => { :display_name => entry.user.display_name, :id => entry.id },
|
:params => { :display_name => entry.user.display_name, :id => entry.id },
|
||||||
:session => { :user => entry.user }
|
:session => { :user => entry.user }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "diary_entry/show"
|
assert_template "show"
|
||||||
assert_select "title", :text => /Users' diaries | /, :count => 1
|
assert_select "title", :text => /Users' diaries | /, :count => 1
|
||||||
assert_select "div.content-heading", :count => 1 do
|
assert_select "div.content-heading", :count => 1 do
|
||||||
assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
|
assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
|
||||||
|
@ -337,7 +337,7 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
:params => { :display_name => entry.user.display_name, :id => entry.id },
|
:params => { :display_name => entry.user.display_name, :id => entry.id },
|
||||||
:session => { :user => create(:user) }
|
:session => { :user => create(:user) }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "diary_entry/show"
|
assert_template "show"
|
||||||
assert_select "title", :text => /Users' diaries | /, :count => 1
|
assert_select "title", :text => /Users' diaries | /, :count => 1
|
||||||
assert_select "div.content-heading", :count => 1 do
|
assert_select "div.content-heading", :count => 1 do
|
||||||
assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
|
assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
|
|
@ -1,28 +1,28 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
class NodeControllerTest < ActionController::TestCase
|
class NodesControllerTest < ActionController::TestCase
|
||||||
##
|
##
|
||||||
# test all routes which lead to this controller
|
# test all routes which lead to this controller
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/create", :method => :put },
|
{ :path => "/api/0.6/node/create", :method => :put },
|
||||||
{ :controller => "node", :action => "create" }
|
{ :controller => "nodes", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/1", :method => :get },
|
{ :path => "/api/0.6/node/1", :method => :get },
|
||||||
{ :controller => "node", :action => "read", :id => "1" }
|
{ :controller => "nodes", :action => "read", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/1", :method => :put },
|
{ :path => "/api/0.6/node/1", :method => :put },
|
||||||
{ :controller => "node", :action => "update", :id => "1" }
|
{ :controller => "nodes", :action => "update", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/1", :method => :delete },
|
{ :path => "/api/0.6/node/1", :method => :delete },
|
||||||
{ :controller => "node", :action => "delete", :id => "1" }
|
{ :controller => "nodes", :action => "delete", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/nodes", :method => :get },
|
{ :path => "/api/0.6/nodes", :method => :get },
|
||||||
{ :controller => "node", :action => "nodes" }
|
{ :controller => "nodes", :action => "nodes" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
require "old_node_controller"
|
|
||||||
|
|
||||||
class OldNodeControllerTest < ActionController::TestCase
|
class OldNodesControllerTest < ActionController::TestCase
|
||||||
#
|
#
|
||||||
# TODO: test history
|
# TODO: test history
|
||||||
#
|
#
|
||||||
|
@ -11,15 +10,15 @@ class OldNodeControllerTest < ActionController::TestCase
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/1/history", :method => :get },
|
{ :path => "/api/0.6/node/1/history", :method => :get },
|
||||||
{ :controller => "old_node", :action => "history", :id => "1" }
|
{ :controller => "old_nodes", :action => "history", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/1/2", :method => :get },
|
{ :path => "/api/0.6/node/1/2", :method => :get },
|
||||||
{ :controller => "old_node", :action => "version", :id => "1", :version => "2" }
|
{ :controller => "old_nodes", :action => "version", :id => "1", :version => "2" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/1/2/redact", :method => :post },
|
{ :path => "/api/0.6/node/1/2/redact", :method => :post },
|
||||||
{ :controller => "old_node", :action => "redact", :id => "1", :version => "2" }
|
{ :controller => "old_nodes", :action => "redact", :id => "1", :version => "2" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
||||||
# move the node somewhere else
|
# move the node somewhere else
|
||||||
xml_node["lat"] = precision(rand * 180 - 90).to_s
|
xml_node["lat"] = precision(rand * 180 - 90).to_s
|
||||||
xml_node["lon"] = precision(rand * 360 - 180).to_s
|
xml_node["lon"] = precision(rand * 360 - 180).to_s
|
||||||
with_controller(NodeController.new) do
|
with_controller(NodesController.new) do
|
||||||
content xml_doc
|
content xml_doc
|
||||||
put :update, :params => { :id => nodeid }
|
put :update, :params => { :id => nodeid }
|
||||||
assert_response :forbidden, "Should have rejected node update"
|
assert_response :forbidden, "Should have rejected node update"
|
||||||
|
@ -75,7 +74,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
||||||
xml_tag["k"] = random_string
|
xml_tag["k"] = random_string
|
||||||
xml_tag["v"] = random_string
|
xml_tag["v"] = random_string
|
||||||
xml_node << xml_tag
|
xml_node << xml_tag
|
||||||
with_controller(NodeController.new) do
|
with_controller(NodesController.new) do
|
||||||
content xml_doc
|
content xml_doc
|
||||||
put :update, :params => { :id => nodeid }
|
put :update, :params => { :id => nodeid }
|
||||||
assert_response :forbidden,
|
assert_response :forbidden,
|
||||||
|
@ -109,7 +108,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
||||||
# move the node somewhere else
|
# move the node somewhere else
|
||||||
xml_node["lat"] = precision(rand * 180 - 90).to_s
|
xml_node["lat"] = precision(rand * 180 - 90).to_s
|
||||||
xml_node["lon"] = precision(rand * 360 - 180).to_s
|
xml_node["lon"] = precision(rand * 360 - 180).to_s
|
||||||
with_controller(NodeController.new) do
|
with_controller(NodesController.new) do
|
||||||
content xml_doc
|
content xml_doc
|
||||||
put :update, :params => { :id => nodeid }
|
put :update, :params => { :id => nodeid }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -125,7 +124,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
||||||
xml_tag["k"] = random_string
|
xml_tag["k"] = random_string
|
||||||
xml_tag["v"] = random_string
|
xml_tag["v"] = random_string
|
||||||
xml_node << xml_tag
|
xml_node << xml_tag
|
||||||
with_controller(NodeController.new) do
|
with_controller(NodesController.new) do
|
||||||
content xml_doc
|
content xml_doc
|
||||||
put :update, :params => { :id => nodeid }
|
put :update, :params => { :id => nodeid }
|
||||||
assert_response :success,
|
assert_response :success,
|
||||||
|
@ -390,7 +389,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def check_current_version(node_id)
|
def check_current_version(node_id)
|
||||||
# get the current version of the node
|
# get the current version of the node
|
||||||
current_node = with_controller(NodeController.new) do
|
current_node = with_controller(NodesController.new) do
|
||||||
get :read, :params => { :id => node_id }
|
get :read, :params => { :id => node_id }
|
||||||
assert_response :success, "cant get current node #{node_id}"
|
assert_response :success, "cant get current node #{node_id}"
|
||||||
Node.from_xml(@response.body)
|
Node.from_xml(@response.body)
|
|
@ -1,21 +1,20 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
require "old_relation_controller"
|
|
||||||
|
|
||||||
class OldRelationControllerTest < ActionController::TestCase
|
class OldRelationsControllerTest < ActionController::TestCase
|
||||||
##
|
##
|
||||||
# test all routes which lead to this controller
|
# test all routes which lead to this controller
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1/history", :method => :get },
|
{ :path => "/api/0.6/relation/1/history", :method => :get },
|
||||||
{ :controller => "old_relation", :action => "history", :id => "1" }
|
{ :controller => "old_relations", :action => "history", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1/2", :method => :get },
|
{ :path => "/api/0.6/relation/1/2", :method => :get },
|
||||||
{ :controller => "old_relation", :action => "version", :id => "1", :version => "2" }
|
{ :controller => "old_relations", :action => "version", :id => "1", :version => "2" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1/2/redact", :method => :post },
|
{ :path => "/api/0.6/relation/1/2/redact", :method => :post },
|
||||||
{ :controller => "old_relation", :action => "redact", :id => "1", :version => "2" }
|
{ :controller => "old_relations", :action => "redact", :id => "1", :version => "2" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -225,7 +224,7 @@ class OldRelationControllerTest < ActionController::TestCase
|
||||||
# version which we're getting from the versions call.
|
# version which we're getting from the versions call.
|
||||||
def check_current_version(relation_id)
|
def check_current_version(relation_id)
|
||||||
# get the current version
|
# get the current version
|
||||||
current_relation = with_controller(RelationController.new) do
|
current_relation = with_controller(RelationsController.new) do
|
||||||
get :read, :params => { :id => relation_id }
|
get :read, :params => { :id => relation_id }
|
||||||
assert_response :success, "can't get current relation #{relation_id}"
|
assert_response :success, "can't get current relation #{relation_id}"
|
||||||
Relation.from_xml(@response.body)
|
Relation.from_xml(@response.body)
|
|
@ -1,21 +1,20 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
require "old_way_controller"
|
|
||||||
|
|
||||||
class OldWayControllerTest < ActionController::TestCase
|
class OldWaysControllerTest < ActionController::TestCase
|
||||||
##
|
##
|
||||||
# test all routes which lead to this controller
|
# test all routes which lead to this controller
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1/history", :method => :get },
|
{ :path => "/api/0.6/way/1/history", :method => :get },
|
||||||
{ :controller => "old_way", :action => "history", :id => "1" }
|
{ :controller => "old_ways", :action => "history", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1/2", :method => :get },
|
{ :path => "/api/0.6/way/1/2", :method => :get },
|
||||||
{ :controller => "old_way", :action => "version", :id => "1", :version => "2" }
|
{ :controller => "old_ways", :action => "version", :id => "1", :version => "2" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1/2/redact", :method => :post },
|
{ :path => "/api/0.6/way/1/2/redact", :method => :post },
|
||||||
{ :controller => "old_way", :action => "redact", :id => "1", :version => "2" }
|
{ :controller => "old_ways", :action => "redact", :id => "1", :version => "2" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -265,7 +264,7 @@ class OldWayControllerTest < ActionController::TestCase
|
||||||
# version which we're getting from the versions call.
|
# version which we're getting from the versions call.
|
||||||
def check_current_version(way_id)
|
def check_current_version(way_id)
|
||||||
# get the current version
|
# get the current version
|
||||||
current_way = with_controller(WayController.new) do
|
current_way = with_controller(WaysController.new) do
|
||||||
get :read, :params => { :id => way_id }
|
get :read, :params => { :id => way_id }
|
||||||
assert_response :success, "can't get current way #{way_id}"
|
assert_response :success, "can't get current way #{way_id}"
|
||||||
Way.from_xml(@response.body)
|
Way.from_xml(@response.body)
|
|
@ -1,46 +1,45 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
require "relation_controller"
|
|
||||||
|
|
||||||
class RelationControllerTest < ActionController::TestCase
|
class RelationsControllerTest < ActionController::TestCase
|
||||||
##
|
##
|
||||||
# test all routes which lead to this controller
|
# test all routes which lead to this controller
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/create", :method => :put },
|
{ :path => "/api/0.6/relation/create", :method => :put },
|
||||||
{ :controller => "relation", :action => "create" }
|
{ :controller => "relations", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1/full", :method => :get },
|
{ :path => "/api/0.6/relation/1/full", :method => :get },
|
||||||
{ :controller => "relation", :action => "full", :id => "1" }
|
{ :controller => "relations", :action => "full", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1", :method => :get },
|
{ :path => "/api/0.6/relation/1", :method => :get },
|
||||||
{ :controller => "relation", :action => "read", :id => "1" }
|
{ :controller => "relations", :action => "read", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1", :method => :put },
|
{ :path => "/api/0.6/relation/1", :method => :put },
|
||||||
{ :controller => "relation", :action => "update", :id => "1" }
|
{ :controller => "relations", :action => "update", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1", :method => :delete },
|
{ :path => "/api/0.6/relation/1", :method => :delete },
|
||||||
{ :controller => "relation", :action => "delete", :id => "1" }
|
{ :controller => "relations", :action => "delete", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relations", :method => :get },
|
{ :path => "/api/0.6/relations", :method => :get },
|
||||||
{ :controller => "relation", :action => "relations" }
|
{ :controller => "relations", :action => "relations" }
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/node/1/relations", :method => :get },
|
{ :path => "/api/0.6/node/1/relations", :method => :get },
|
||||||
{ :controller => "relation", :action => "relations_for_node", :id => "1" }
|
{ :controller => "relations", :action => "relations_for_node", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1/relations", :method => :get },
|
{ :path => "/api/0.6/way/1/relations", :method => :get },
|
||||||
{ :controller => "relation", :action => "relations_for_way", :id => "1" }
|
{ :controller => "relations", :action => "relations_for_way", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1/relations", :method => :get },
|
{ :path => "/api/0.6/relation/1/relations", :method => :get },
|
||||||
{ :controller => "relation", :action => "relations_for_relation", :id => "1" }
|
{ :controller => "relations", :action => "relations_for_relation", :id => "1" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -785,7 +784,7 @@ OSM
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
|
|
||||||
# check the ordering in the history tables:
|
# check the ordering in the history tables:
|
||||||
with_controller(OldRelationController.new) do
|
with_controller(OldRelationsController.new) do
|
||||||
get :version, :params => { :id => relation_id, :version => 2 }
|
get :version, :params => { :id => relation_id, :version => 2 }
|
||||||
assert_response :success, "can't read back version 2 of the relation #{relation_id}"
|
assert_response :success, "can't read back version 2 of the relation #{relation_id}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
|
@ -868,7 +867,7 @@ OSM
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
|
|
||||||
# check the ordering in the history tables:
|
# check the ordering in the history tables:
|
||||||
with_controller(OldRelationController.new) do
|
with_controller(OldRelationsController.new) do
|
||||||
get :version, :params => { :id => relation_id, :version => 1 }
|
get :version, :params => { :id => relation_id, :version => 1 }
|
||||||
assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
|
assert_response :success, "can't read back version 1 of the relation: #{@response.body}"
|
||||||
check_ordering(doc, @response.body)
|
check_ordering(doc, @response.body)
|
||||||
|
@ -982,7 +981,7 @@ OSM
|
||||||
if ver.nil?
|
if ver.nil?
|
||||||
get :read, :params => { :id => id }
|
get :read, :params => { :id => id }
|
||||||
else
|
else
|
||||||
with_controller(OldRelationController.new) do
|
with_controller(OldRelationsController.new) do
|
||||||
get :version, :params => { :id => id, :version => ver }
|
get :version, :params => { :id => id, :version => ver }
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,33 +1,32 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
require "way_controller"
|
|
||||||
|
|
||||||
class WayControllerTest < ActionController::TestCase
|
class WaysControllerTest < ActionController::TestCase
|
||||||
##
|
##
|
||||||
# test all routes which lead to this controller
|
# test all routes which lead to this controller
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/create", :method => :put },
|
{ :path => "/api/0.6/way/create", :method => :put },
|
||||||
{ :controller => "way", :action => "create" }
|
{ :controller => "ways", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1/full", :method => :get },
|
{ :path => "/api/0.6/way/1/full", :method => :get },
|
||||||
{ :controller => "way", :action => "full", :id => "1" }
|
{ :controller => "ways", :action => "full", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1", :method => :get },
|
{ :path => "/api/0.6/way/1", :method => :get },
|
||||||
{ :controller => "way", :action => "read", :id => "1" }
|
{ :controller => "ways", :action => "read", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1", :method => :put },
|
{ :path => "/api/0.6/way/1", :method => :put },
|
||||||
{ :controller => "way", :action => "update", :id => "1" }
|
{ :controller => "ways", :action => "update", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1", :method => :delete },
|
{ :path => "/api/0.6/way/1", :method => :delete },
|
||||||
{ :controller => "way", :action => "delete", :id => "1" }
|
{ :controller => "ways", :action => "delete", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/ways", :method => :get },
|
{ :path => "/api/0.6/ways", :method => :get },
|
||||||
{ :controller => "way", :action => "ways" }
|
{ :controller => "ways", :action => "ways" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ class ApplicationHelperTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rss_link_to
|
def test_rss_link_to
|
||||||
link = rss_link_to(:controller => :diary_entry, :action => :rss)
|
link = rss_link_to(:controller => :diary_entries, :action => :rss)
|
||||||
assert_dom_equal "<a class=\"rsssmall\" href=\"/diary/rss\"><img border=\"0\" height=\"16\" src=\"/images/RSS.png\" width=\"16\" /></a>", link
|
assert_dom_equal "<a class=\"rsssmall\" href=\"/diary/rss\"><img border=\"0\" height=\"16\" src=\"/images/RSS.png\" width=\"16\" /></a>", link
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class UserDiariesTest < ActionDispatch::IntegrationTest
|
||||||
follow_redirect!
|
follow_redirect!
|
||||||
|
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template "diary_entry/edit"
|
assert_template "diary_entries/edit"
|
||||||
# print @response.body
|
# print @response.body
|
||||||
# print @html_document.to_yaml
|
# print @html_document.to_yaml
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class ReportDiaryCommentTest < ApplicationSystemTestCase
|
||||||
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
||||||
assert page.has_content?(@comment.body)
|
assert page.has_content?(@comment.body)
|
||||||
|
|
||||||
assert_not page.has_content?(I18n.t("diary_entry.diary_comment.report"))
|
assert_not page.has_content?(I18n.t("diary_entries.diary_comment.report"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_it_works
|
def test_it_works
|
||||||
|
@ -19,7 +19,7 @@ class ReportDiaryCommentTest < ApplicationSystemTestCase
|
||||||
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
||||||
assert page.has_content? @diary_entry.title
|
assert page.has_content? @diary_entry.title
|
||||||
|
|
||||||
click_on I18n.t("diary_entry.diary_comment.report")
|
click_on I18n.t("diary_entries.diary_comment.report")
|
||||||
assert page.has_content? "Report"
|
assert page.has_content? "Report"
|
||||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase
|
||||||
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
||||||
assert page.has_content?(@diary_entry.title)
|
assert page.has_content?(@diary_entry.title)
|
||||||
|
|
||||||
assert_not page.has_content?(I18n.t("diary_entry.diary_entry.report"))
|
assert_not page.has_content?(I18n.t("diary_entries.diary_entry.report"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_it_works
|
def test_it_works
|
||||||
|
@ -18,7 +18,7 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase
|
||||||
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
||||||
assert page.has_content? @diary_entry.title
|
assert page.has_content? @diary_entry.title
|
||||||
|
|
||||||
click_on I18n.t("diary_entry.diary_entry.report")
|
click_on I18n.t("diary_entries.diary_entry.report")
|
||||||
assert page.has_content? "Report"
|
assert page.has_content? "Report"
|
||||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase
|
||||||
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
visit diary_entry_path(@diary_entry.user.display_name, @diary_entry)
|
||||||
assert page.has_content? @diary_entry.title
|
assert page.has_content? @diary_entry.title
|
||||||
|
|
||||||
click_on I18n.t("diary_entry.diary_entry.report")
|
click_on I18n.t("diary_entries.diary_entry.report")
|
||||||
assert page.has_content? "Report"
|
assert page.has_content? "Report"
|
||||||
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
assert page.has_content? I18n.t("reports.new.disclaimer.intro")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue