From: Tom Hughes Date: Sat, 10 Mar 2012 15:30:25 +0000 (+0000) Subject: Merge branch 'master' into openstreetbugs X-Git-Tag: live~5125^2~109 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6aca6cfabf21da48567e8197457dae8785b7324d?hp=6de8c2e6b30485683a9d3aa3e21c4b256fe399bd Merge branch 'master' into openstreetbugs Conflicts: config/routes.rb db/structure.sql --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index 139a7a650..9f38f0dcd 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -45,66 +45,58 @@ class AmfController < ApplicationController # calls each action (private method) accordingly. def amf_read - if request.post? - self.status = :ok - self.content_type = Mime::AMF - self.response_body = Dispatcher.new(request.raw_post) do |message,*args| - logger.info("Executing AMF #{message}(#{args.join(',')})") - - case message - when 'getpresets'; result = getpresets(*args) - when 'whichways'; result = whichways(*args) - when 'whichways_deleted'; result = whichways_deleted(*args) - when 'getway'; result = getway(args[0].to_i) - when 'getrelation'; result = getrelation(args[0].to_i) - when 'getway_old'; result = getway_old(args[0].to_i,args[1]) - when 'getway_history'; result = getway_history(args[0].to_i) - when 'getnode_history'; result = getnode_history(args[0].to_i) - when 'findgpx'; result = findgpx(*args) - when 'findrelations'; result = findrelations(*args) - when 'getpoi'; result = getpoi(*args) - end - - result + self.status = :ok + self.content_type = Mime::AMF + self.response_body = Dispatcher.new(request.raw_post) do |message,*args| + logger.info("Executing AMF #{message}(#{args.join(',')})") + + case message + when 'getpresets'; result = getpresets(*args) + when 'whichways'; result = whichways(*args) + when 'whichways_deleted'; result = whichways_deleted(*args) + when 'getway'; result = getway(args[0].to_i) + when 'getrelation'; result = getrelation(args[0].to_i) + when 'getway_old'; result = getway_old(args[0].to_i,args[1]) + when 'getway_history'; result = getway_history(args[0].to_i) + when 'getnode_history'; result = getnode_history(args[0].to_i) + when 'findgpx'; result = findgpx(*args) + when 'findrelations'; result = findrelations(*args) + when 'getpoi'; result = getpoi(*args) end - else - render :nothing => true, :status => :method_not_allowed + + result end end def amf_write - if request.post? - renumberednodes = {} # Shared across repeated putways - renumberedways = {} # Shared across repeated putways - err = false # Abort batch on error - - self.status = :ok - self.content_type = Mime::AMF - self.response_body = Dispatcher.new(request.raw_post) do |message,*args| - logger.info("Executing AMF #{message}") - - if err - result = [-5, nil] - else - case message - when 'putway'; orn = renumberednodes.dup - result = putway(renumberednodes, *args) - result[4] = renumberednodes.reject { |k,v| orn.has_key?(k) } - if result[0] == 0 and result[2] != result[3] then renumberedways[result[2]] = result[3] end - when 'putrelation'; result = putrelation(renumberednodes, renumberedways, *args) - when 'deleteway'; result = deleteway(*args) - when 'putpoi'; result = putpoi(*args) - if result[0] == 0 and result[2] != result[3] then renumberednodes[result[2]] = result[3] end - when 'startchangeset'; result = startchangeset(*args) - end + renumberednodes = {} # Shared across repeated putways + renumberedways = {} # Shared across repeated putways + err = false # Abort batch on error + + self.status = :ok + self.content_type = Mime::AMF + self.response_body = Dispatcher.new(request.raw_post) do |message,*args| + logger.info("Executing AMF #{message}") - err = true if result[0] == -3 # If a conflict is detected, don't execute any more writes + if err + result = [-5, nil] + else + case message + when 'putway'; orn = renumberednodes.dup + result = putway(renumberednodes, *args) + result[4] = renumberednodes.reject { |k,v| orn.has_key?(k) } + if result[0] == 0 and result[2] != result[3] then renumberedways[result[2]] = result[3] end + when 'putrelation'; result = putrelation(renumberednodes, renumberedways, *args) + when 'deleteway'; result = deleteway(*args) + when 'putpoi'; result = putpoi(*args) + if result[0] == 0 and result[2] != result[3] then renumberednodes[result[2]] = result[3] end + when 'startchangeset'; result = startchangeset(*args) end - result + err = true if result[0] == -3 # If a conflict is detected, don't execute any more writes end - else - render :nothing => true, :status => :method_not_allowed + + result end end diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 53e14202c..002bd73b8 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -68,7 +68,7 @@ class ApiController < ApplicationController if gpx_file.identifiable? track << (XML::Node.new("name") << gpx_file.name) track << (XML::Node.new("desc") << gpx_file.description) - track << (XML::Node.new("url") << url_for(:controller => 'trace', :action => 'view', :id => gpx_file.id)) + track << (XML::Node.new("url") << url_for(:controller => 'trace', :action => 'view', :display_name => gpx_file.user.display_name, :id => gpx_file.id)) end else # use the anonymous track segment if the user hasn't allowed diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index e3f41f0ac..7b2314be3 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -187,7 +187,7 @@ class TraceController < ApplicationController @trace.tagstring = params[:trace][:tagstring] @trace.visibility = params[:trace][:visibility] if @trace.save - redirect_to :action => 'view' + redirect_to :action => 'view', :display_name => @user.display_name end end else @@ -201,13 +201,13 @@ class TraceController < ApplicationController trace = Trace.find(params[:id]) if @user and trace.user == @user - if request.post? and trace.visible? + if trace.visible? trace.visible = false trace.save flash[:notice] = t 'trace.delete.scheduled_for_deletion' redirect_to :action => :list, :display_name => @user.display_name else - render :nothing => true, :status => :bad_request + render :nothing => true, :status => :not_found end else render :nothing => true, :status => :forbidden @@ -333,34 +333,30 @@ class TraceController < ApplicationController end def api_create - if request.post? - tags = params[:tags] || "" - description = params[:description] || "" - visibility = params[:visibility] - - if visibility.nil? - if params[:public] && params[:public].to_i.nonzero? - visibility = "public" - else - visibility = "private" - end + tags = params[:tags] || "" + description = params[:description] || "" + visibility = params[:visibility] + + if visibility.nil? + if params[:public] && params[:public].to_i.nonzero? + visibility = "public" + else + visibility = "private" end + end - if params[:file].respond_to?(:read) - do_create(params[:file], tags, description, visibility) + if params[:file].respond_to?(:read) + do_create(params[:file], tags, description, visibility) - if @trace.id - render :text => @trace.id.to_s, :content_type => "text/plain" - elsif @trace.valid? - render :nothing => true, :status => :internal_server_error - else - render :nothing => true, :status => :bad_request - end + if @trace.id + render :text => @trace.id.to_s, :content_type => "text/plain" + elsif @trace.valid? + render :nothing => true, :status => :internal_server_error else render :nothing => true, :status => :bad_request end else - render :nothing => true, :status => :method_not_allowed + render :nothing => true, :status => :bad_request end end diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index 75c9df9dc..2bdafa80e 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -39,11 +39,13 @@ class UserBlocksController < ApplicationController return end - @user_block = UserBlock.new(:user_id => @this_user.id, - :creator_id => @user.id, - :reason => params[:user_block][:reason], - :ends_at => Time.now.getutc() + @block_period.hours, - :needs_view => params[:user_block][:needs_view]) + @user_block = UserBlock.new({ + :user_id => @this_user.id, + :creator_id => @user.id, + :reason => params[:user_block][:reason], + :ends_at => Time.now.getutc() + @block_period.hours, + :needs_view => params[:user_block][:needs_view] + }, :without_protection => true) if @user_block.save flash[:notice] = t('user_block.create.flash', :name => @this_user.display_name) @@ -67,7 +69,7 @@ class UserBlocksController < ApplicationController if @user_block.update_attributes({ :ends_at => Time.now.getutc() + @block_period.hours, :reason => params[:user_block][:reason], - :needs_view => params[:user_block][:needs_view] }) + :needs_view => params[:user_block][:needs_view] }, :without_protection => true) flash[:notice] = t('user_block.update.success') redirect_to(@user_block) else diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index a59190697..0aeab63b3 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -473,7 +473,8 @@ class UserController < ApplicationController ## # sets a user's status def set_status - @this_user.update_attributes(:status => params[:status]) + @this_user.status = params[:status] + @this_user.save redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name] end @@ -717,7 +718,7 @@ private # Choose the layout to use. See # https://rails.lighthouseapp.com/projects/8994/tickets/5371-layout-with-onlyexcept-options-makes-other-actions-render-without-layouts def choose_layout - oauth_url = url_for(:controller => :oauth, :action => :oauthorize, :only_path => true) + oauth_url = url_for(:controller => :oauth, :action => :authorize, :only_path => true) if [ 'api_details' ].include? action_name nil diff --git a/app/models/spam_observer.rb b/app/models/spam_observer.rb index 888b4a0b9..07fa84ffd 100644 --- a/app/models/spam_observer.rb +++ b/app/models/spam_observer.rb @@ -9,7 +9,7 @@ class SpamObserver < ActiveRecord::Observer end if user.status == "active" and user.spam_score > SPAM_THRESHOLD - user.update_attributes(:status => "suspended") + user.update_column(:status, "suspended") end end end diff --git a/app/models/trace_sweeper.rb b/app/models/trace_sweeper.rb index 52780f9e4..777a58a55 100644 --- a/app/models/trace_sweeper.rb +++ b/app/models/trace_sweeper.rb @@ -16,7 +16,6 @@ class TraceSweeper < ActionController::Caching::Sweeper private def expire_cache_for(record) - expire_action(:controller => 'trace', :action => 'view', :id => record.id) expire_action(:controller => 'trace', :action => 'view', :display_name => record.user.display_name, :id => record.id) expire_action(:controller => 'trace', :action => 'list', :display_name => nil, :tag => nil) diff --git a/app/models/user_sweeper.rb b/app/models/user_sweeper.rb index a58b93832..8ce48e5b3 100644 --- a/app/models/user_sweeper.rb +++ b/app/models/user_sweeper.rb @@ -34,7 +34,6 @@ private expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => nil, :display_name => old_record.display_name) old_record.traces.each do |trace| - expire_action(:controller => 'trace', :action => 'view', :id => trace.id) expire_action(:controller => 'trace', :action => 'view', :display_name => old_record.display_name, :id => trace.id) trace.tags.each do |tag| diff --git a/app/views/layouts/_piwik.html.erb b/app/views/layouts/_piwik.html.erb index 0b719932d..0ba307437 100644 --- a/app/views/layouts/_piwik.html.erb +++ b/app/views/layouts/_piwik.html.erb @@ -1,15 +1,14 @@ - - +var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; +s.parentNode.insertBefore(g,s); })(); + + diff --git a/app/views/message/_message_summary.html.erb b/app/views/message/_message_summary.html.erb index 70fd44035..82d528a04 100644 --- a/app/views/message/_message_summary.html.erb +++ b/app/views/message/_message_summary.html.erb @@ -1,7 +1,7 @@ <% this_colour = cycle('lightgrey', 'white') %> "> - <%= link_to h(message_summary.sender.display_name), :controller => 'user', :action => message_summary.sender.display_name %> + <%= link_to h(message_summary.sender.display_name), :controller => 'user', :action => 'view', :display_name => message_summary.sender.display_name %> <%= link_to h(message_summary.title), :controller => 'message', :action => 'read', :message_id => message_summary.id %> <%= l message_summary.sent_on, :format => :friendly %> <% if message_summary.message_read? %> diff --git a/app/views/message/inbox.html.erb b/app/views/message/inbox.html.erb index bcd2da33a..0cbc7c77c 100644 --- a/app/views/message/inbox.html.erb +++ b/app/views/message/inbox.html.erb @@ -1,4 +1,4 @@ -

<%= t'message.inbox.my_inbox'%>/<%= link_to t('message.inbox.outbox'), url_for(:controller => "user", :action => "outbox", :id => @user.display_name) %>

+

<%= t'message.inbox.my_inbox'%>/<%= link_to t('message.inbox.outbox'), outbox_path(@user.display_name) %>

<%= render :partial => "message_count" %> diff --git a/app/views/message/outbox.html.erb b/app/views/message/outbox.html.erb index fd8958126..ece514289 100644 --- a/app/views/message/outbox.html.erb +++ b/app/views/message/outbox.html.erb @@ -1,4 +1,4 @@ -

<%= raw(t'message.outbox.my_inbox', :inbox_link => link_to(t('message.outbox.inbox'), url_for(:controller => "user", :action => "inbox", :id => @user.display_name))) %>/<%= t'message.outbox.outbox' %>

+

<%= raw(t'message.outbox.my_inbox', :inbox_link => link_to(t('message.outbox.inbox'), inbox_path(@user.display_name))) %>/<%= t'message.outbox.outbox' %>

<%= t'message.outbox.messages', :count => @user.sent_messages.size %> diff --git a/app/views/user/view.html.erb b/app/views/user/view.html.erb index edf290c7b..834a8528f 100644 --- a/app/views/user/view.html.erb +++ b/app/views/user/view.html.erb @@ -19,7 +19,7 @@ <%= link_to t('user.view.my diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %> | - <%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %> + <%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new' %> | <%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %> | @@ -126,8 +126,8 @@ <% if friends.empty? %> <%= t 'user.view.no friends' %> <% else %> - <%= link_to t('user.view.friends_changesets'), {:controller => 'browse', :action => 'friends'} %>
- <%= link_to t('user.view.friends_diaries'), {:controller => 'diary', :action => 'friends'} %>

+ <%= link_to t('user.view.friends_changesets'), friend_changesets_path %>
+ <%= link_to t('user.view.friends_diaries'), friend_diaries_path %>

<%= render :partial => "contact", :collection => friends %>
@@ -138,8 +138,8 @@ <% if nearby.empty? %> <%= t 'user.view.no nearby users' %> <% else %> - <%= link_to t('user.view.nearby_changesets'), {:controller => 'browse', :action => 'nearby'} %>
- <%= link_to t('user.view.nearby_diaries'), {:controller => 'diary', :action => 'nearby'} %>

+ <%= link_to t('user.view.nearby_changesets'), nearby_changesets_path %>
+ <%= link_to t('user.view.nearby_diaries'), nearby_diaries_path %>

<%= render :partial => "contact", :collection => nearby %>
diff --git a/app/views/user_blocks/_block.html.erb b/app/views/user_blocks/_block.html.erb index 0e2b3a287..362cfd107 100644 --- a/app/views/user_blocks/_block.html.erb +++ b/app/views/user_blocks/_block.html.erb @@ -19,6 +19,6 @@ <%= link_to t('user_block.partial.show'), block %> <% if @user and @user.id == block.creator_id and block.active? %><%= link_to t('user_block.partial.edit'), edit_user_block_path(block) %><% end %> <% if show_revoke_link %> - <% if block.active? %><%= link_to t('user_block.partial.revoke'), block, :confirm => t('user_block.partial.confirm'), :action => :revoke %><% end %> + <% if block.active? %><%= link_to t('user_block.partial.revoke'), :controller => 'user_blocks', :action => 'revoke', :id => block.id %><% end %> <% end %> diff --git a/app/views/user_blocks/edit.html.erb b/app/views/user_blocks/edit.html.erb index 777022dab..a50ac75d7 100644 --- a/app/views/user_blocks/edit.html.erb +++ b/app/views/user_blocks/edit.html.erb @@ -1,8 +1,8 @@ <% @title = t 'user_block.edit.title', :name => h(@user_block.user.display_name) %> -

<%= t('user_block.edit.title', - :name => link_to( - h(@user_block.user.display_name), - {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name})) %>

+

<%= raw t('user_block.edit.title', + :name => link_to( + h(@user_block.user.display_name), + {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name})) %>

<%= form_for(@user_block) do |f| %> <%= f.error_messages %> diff --git a/app/views/user_blocks/revoke.html.erb b/app/views/user_blocks/revoke.html.erb index 0819357d3..28ae01930 100644 --- a/app/views/user_blocks/revoke.html.erb +++ b/app/views/user_blocks/revoke.html.erb @@ -1,13 +1,13 @@ <% @title = t('user_block.revoke.title', :block_on => h(@user_block.user.display_name), :block_by => h(@user_block.creator.display_name)) %> -

<%= t('user_block.revoke.heading', - :block_on => link_to( - h(@user_block.user.display_name), - {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name}), - :block_by => link_to( - h(@user_block.creator.display_name), - {:controller => 'user', :action => 'view', :display_name => @user_block.creator.display_name})) %>

+

<%= raw t('user_block.revoke.heading', + :block_on => link_to( + h(@user_block.user.display_name), + {:controller => 'user', :action => 'view', :display_name => @user_block.user.display_name}), + :block_by => link_to( + h(@user_block.creator.display_name), + {:controller => 'user', :action => 'view', :display_name => @user_block.creator.display_name})) %>

<% if @user_block.ends_at > Time.now %>

diff --git a/config/routes.rb b/config/routes.rb index 0c090ef3c..e466fc362 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,78 +1,77 @@ OpenStreetMap::Application.routes.draw do # API - match 'api/capabilities' => 'api#capabilities' - match 'api/0.6/capabilities' => 'api#capabilities' - - match 'api/0.6/changeset/create' => 'changeset#create' - match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :id => /\d+/ - match 'api/0.6/changeset/:id/download' => 'changeset#download', :as => :changeset_download, :id => /\d+/ - match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :id => /\d+/ - match 'api/0.6/changeset/:id' => 'changeset#read', :as => :changeset_read, :via => :get, :id => /\d+/ + match 'api/capabilities' => 'api#capabilities', :via => :get + match 'api/0.6/capabilities' => 'api#capabilities', :via => :get + + match 'api/0.6/changeset/create' => 'changeset#create', :via => :put + match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :via => :post, :id => /\d+/ + match 'api/0.6/changeset/:id/download' => 'changeset#download', :via => :get, :as => :changeset_download, :id => /\d+/ + match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :via => :post, :id => /\d+/ + match 'api/0.6/changeset/:id' => 'changeset#read', :via => :get, :as => :changeset_read, :via => :get, :id => /\d+/ match 'api/0.6/changeset/:id' => 'changeset#update', :via => :put, :id => /\d+/ - match 'api/0.6/changeset/:id/close' => 'changeset#close', :id => /\d+/ - match 'api/0.6/changesets' => 'changeset#query', :id => nil - - match 'api/0.6/node/create' => 'node#create' - match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :id => /\d+/ - match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :id => /\d+/ - match 'api/0.6/node/:id/history' => 'old_node#history', :id => /\d+/ - match 'api/0.6/node/:id/:version' => 'old_node#version', :version => /\d+/, :id => /\d+/ + match 'api/0.6/changeset/:id/close' => 'changeset#close', :via => :put, :id => /\d+/ + match 'api/0.6/changesets' => 'changeset#query', :via => :get + + match 'api/0.6/node/create' => 'node#create', :via => :put + match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :via => :get, :id => /\d+/ + match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :via => :get, :id => /\d+/ + match 'api/0.6/node/:id/history' => 'old_node#history', :via => :get, :id => /\d+/ + match 'api/0.6/node/:id/:version' => 'old_node#version', :via => :get, :id => /\d+/, :version => /\d+/ match 'api/0.6/node/:id' => 'node#read', :via => :get, :id => /\d+/ match 'api/0.6/node/:id' => 'node#update', :via => :put, :id => /\d+/ match 'api/0.6/node/:id' => 'node#delete', :via => :delete, :id => /\d+/ - match 'api/0.6/nodes' => 'node#nodes', :id => nil + match 'api/0.6/nodes' => 'node#nodes', :via => :get - match 'api/0.6/way/create' => 'way#create' - match 'api/0.6/way/:id/history' => 'old_way#history', :id => /\d+/ - match 'api/0.6/way/:id/full' => 'way#full', :id => /\d+/ - match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :id => /\d+/ - match 'api/0.6/way/:id/:version' => 'old_way#version', :version => /\d+/, :id => /\d+/ + match 'api/0.6/way/create' => 'way#create', :via => :put + match 'api/0.6/way/:id/history' => 'old_way#history', :via => :get, :id => /\d+/ + match 'api/0.6/way/:id/full' => 'way#full', :via => :get, :id => /\d+/ + match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :via => :get, :id => /\d+/ + match 'api/0.6/way/:id/:version' => 'old_way#version', :via => :get, :id => /\d+/, :version => /\d+/ match 'api/0.6/way/:id' => 'way#read', :via => :get, :id => /\d+/ match 'api/0.6/way/:id' => 'way#update', :via => :put, :id => /\d+/ match 'api/0.6/way/:id' => 'way#delete', :via => :delete, :id => /\d+/ - match 'api/0.6/ways' => 'way#ways', :id => nil + match 'api/0.6/ways' => 'way#ways', :via => :get - match 'api/0.6/relation/create' => 'relation#create' - match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :id => /\d+/ - match 'api/0.6/relation/:id/history' => 'old_relation#history', :id => /\d+/ - match 'api/0.6/relation/:id/full' => 'relation#full', :id => /\d+/ - match 'api/0.6/relation/:id/:version' => 'old_relation#version', :version => /\d+/, :id => /\d+/ + match 'api/0.6/relation/create' => 'relation#create', :via => :put + match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :via => :get, :id => /\d+/ + match 'api/0.6/relation/:id/history' => 'old_relation#history', :via => :get, :id => /\d+/ + match 'api/0.6/relation/:id/full' => 'relation#full', :via => :get, :id => /\d+/ + match 'api/0.6/relation/:id/:version' => 'old_relation#version', :via => :get, :id => /\d+/, :version => /\d+/ match 'api/0.6/relation/:id' => 'relation#read', :via => :get, :id => /\d+/ match 'api/0.6/relation/:id' => 'relation#update', :via => :put, :id => /\d+/ match 'api/0.6/relation/:id' => 'relation#delete', :via => :delete, :id => /\d+/ - match 'api/0.6/relations' => 'relation#relations' + match 'api/0.6/relations' => 'relation#relations', :via => :get - match 'api/0.6/map' => 'api#map' + match 'api/0.6/map' => 'api#map', :via => :get - match 'api/0.6/trackpoints' => 'api#trackpoints' + match 'api/0.6/trackpoints' => 'api#trackpoints', :via => :get - match 'api/0.6/changes' => 'api#changes' + match 'api/0.6/changes' => 'api#changes', :via => :get - match 'api/0.6/search' => 'search#search_all' - match 'api/0.6/ways/search' => 'search#search_ways' - match 'api/0.6/relations/search' => 'search#search_relations' - match 'api/0.6/nodes/search' => 'search#search_nodes' + match 'api/0.6/search' => 'search#search_all', :via => :get + match 'api/0.6/ways/search' => 'search#search_ways', :via => :get + match 'api/0.6/relations/search' => 'search#search_relations', :via => :get + match 'api/0.6/nodes/search' => 'search#search_nodes', :via => :get - match 'api/0.6/user/details' => 'user#api_details' + match 'api/0.6/user/details' => 'user#api_details', :via => :get match 'api/0.6/user/preferences' => 'user_preference#read', :via => :get match 'api/0.6/user/preferences/:preference_key' => 'user_preference#read_one', :via => :get match 'api/0.6/user/preferences' => 'user_preference#update', :via => :put match 'api/0.6/user/preferences/:preference_key' => 'user_preference#update_one', :via => :put match 'api/0.6/user/preferences/:preference_key' => 'user_preference#delete_one', :via => :delete - match 'api/0.6/user/gpx_files' => 'user#api_gpx_files' + match 'api/0.6/user/gpx_files' => 'user#api_gpx_files', :via => :get - match 'api/0.6/gpx/create' => 'trace#api_create' + match 'api/0.6/gpx/create' => 'trace#api_create', :via => :post match 'api/0.6/gpx/:id' => 'trace#api_read', :via => :get, :id => /\d+/ match 'api/0.6/gpx/:id' => 'trace#api_update', :via => :put, :id => /\d+/ match 'api/0.6/gpx/:id' => 'trace#api_delete', :via => :delete, :id => /\d+/ - match 'api/0.6/gpx/:id/details' => 'trace#api_read', :id => /\d+/ - match 'api/0.6/gpx/:id/data' => 'trace#api_data' - match 'api/0.6/gpx/:id/data.:format' => 'trace#api_data' + match 'api/0.6/gpx/:id/details' => 'trace#api_read', :via => :get, :id => /\d+/ + match 'api/0.6/gpx/:id/data' => 'trace#api_data', :via => :get # AMF (ActionScript) API - match 'api/0.6/amf/read' => 'amf#amf_read' - match 'api/0.6/amf/write' => 'amf#amf_write' - match 'api/0.6/swf/trackpoints' => 'swf#trackpoints' + match 'api/0.6/amf/read' => 'amf#amf_read', :via => :post + match 'api/0.6/amf/write' => 'amf#amf_write', :via => :post + match 'api/0.6/swf/trackpoints' => 'swf#trackpoints', :via => :get # Map notes API match 'api/0.6/notes' => 'note#list', :format => :xml @@ -90,145 +89,136 @@ OpenStreetMap::Application.routes.draw do match 'api/0.6/notes/getRSSfeed' => 'note#rss', :format => :rss # Data browsing - match '/browse/start' => 'browse#start' - match '/browse/way/:id' => 'browse#way', :id => /\d+/ - match '/browse/way/:id/history' => 'browse#way_history', :id => /\d+/ - match '/browse/node/:id' => 'browse#node', :id => /\d+/ - match '/browse/node/:id/history' => 'browse#node_history', :id => /\d+/ - match '/browse/relation/:id' => 'browse#relation', :id => /\d+/ - match '/browse/relation/:id/history' => 'browse#relation_history', :id => /\d+/ - match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/ - match '/user/:display_name/edits' => 'changeset#list' - match '/user/:display_name/edits/feed' => 'changeset#feed', :format => :atom - match '/browse/friends' => 'changeset#list', :friends => true - match '/browse/nearby' => 'changeset#list', :nearby => true - match '/browse/changesets' => 'changeset#list' - match '/browse/changesets/feed' => 'changeset#feed', :format => :atom - match '/browse/note/:id' => 'browse#note', :id => /\d+/ - match '/user/:display_name/notes' => 'note#mine' - match '/browse' => 'changeset#list' + match '/browse/start' => 'browse#start', :via => :get + match '/browse/way/:id' => 'browse#way', :via => :get, :id => /\d+/ + match '/browse/way/:id/history' => 'browse#way_history', :via => :get, :id => /\d+/ + match '/browse/node/:id' => 'browse#node', :via => :get, :id => /\d+/ + match '/browse/node/:id/history' => 'browse#node_history', :via => :get, :id => /\d+/ + match '/browse/relation/:id' => 'browse#relation', :via => :get, :id => /\d+/ + match '/browse/relation/:id/history' => 'browse#relation_history', :via => :get, :id => /\d+/ + match '/browse/changeset/:id' => 'browse#changeset', :via => :get, :as => :changeset, :id => /\d+/ + match '/browse/note/:id' => 'browse#note', :via => :get, :id => /\d+/ + match '/user/:display_name/edits' => 'changeset#list', :via => :get + match '/user/:display_name/edits/feed' => 'changeset#feed', :via => :get, :format => :atom + match '/user/:display_name/notes' => 'note#mine', :via => :get + match '/browse/friends' => 'changeset#list', :via => :get, :friends => true, :as => "friend_changesets" + match '/browse/nearby' => 'changeset#list', :via => :get, :nearby => true, :as => "nearby_changesets" + match '/browse/changesets' => 'changeset#list', :via => :get + match '/browse/changesets/feed' => 'changeset#feed', :via => :get, :format => :atom + match '/browse' => 'changeset#list', :via => :get # web site - root :to => 'site#index' - match '/edit' => 'site#edit' - match '/copyright/:copyright_locale' => 'site#copyright' - match '/copyright' => 'site#copyright' - match '/history' => 'changeset#list' - match '/history/feed' => 'changeset#feed', :format => :atom - match '/export' => 'site#export' - match '/login' => 'user#login' - match '/logout' => 'user#logout' - match '/offline' => 'site#offline' - match '/key' => 'site#key' - match '/user/new' => 'user#new' - match '/user/terms' => 'user#terms' - match '/user/save' => 'user#save' - match '/user/:display_name/confirm/resend' => 'user#confirm_resend' - match '/user/:display_name/confirm' => 'user#confirm' - match '/user/confirm' => 'user#confirm' - match '/user/confirm-email' => 'user#confirm_email' - match '/user/go_public' => 'user#go_public' - match '/user/reset-password' => 'user#reset_password' - match '/user/forgot-password' => 'user#lost_password' - match '/user/suspended' => 'user#suspended' - - match '/index.html' => 'site#index' - match '/edit.html' => 'site#edit' - match '/export.html' => 'site#export' - match '/login.html' => 'user#login' - match '/logout.html' => 'user#logout' - match '/create-account.html' => 'user#new' - match '/forgot-password.html' => 'user#lost_password' + root :to => 'site#index', :via => :get + match '/edit' => 'site#edit', :via => :get + match '/copyright/:copyright_locale' => 'site#copyright', :via => :get + match '/copyright' => 'site#copyright', :via => :get + match '/history' => 'changeset#list', :via => :get + match '/history/feed' => 'changeset#feed', :via => :get, :format => :atom + match '/export' => 'site#export', :via => :get + match '/login' => 'user#login', :via => [:get, :post] + match '/logout' => 'user#logout', :via => [:get, :post] + match '/offline' => 'site#offline', :via => :get + match '/key' => 'site#key', :via => :post + match '/user/new' => 'user#new', :via => :get + match '/user/terms' => 'user#terms', :via => [:get, :post] + match '/user/save' => 'user#save', :via => :post + match '/user/:display_name/confirm/resend' => 'user#confirm_resend', :via => :get + match '/user/:display_name/confirm' => 'user#confirm', :via => [:get, :post] + match '/user/confirm' => 'user#confirm', :via => [:get, :post] + match '/user/confirm-email' => 'user#confirm_email', :via => [:get, :post] + match '/user/go_public' => 'user#go_public', :via => :post + match '/user/reset-password' => 'user#reset_password', :via => [:get, :post] + match '/user/forgot-password' => 'user#lost_password', :via => [:get, :post] + match '/user/suspended' => 'user#suspended', :via => :get + + match '/index.html' => 'site#index', :via => :get + match '/create-account.html' => 'user#new', :via => :get + match '/forgot-password.html' => 'user#lost_password', :via => :get # permalink - match '/go/:code' => 'site#permalink', :code => /[a-zA-Z0-9_@~]+[=-]*/ + match '/go/:code' => 'site#permalink', :via => :get, :code => /[a-zA-Z0-9_@~]+[=-]*/ # traces - match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list' - match '/user/:display_name/traces/tag/:tag' => 'trace#list' - match '/user/:display_name/traces/page/:page' => 'trace#list' - match '/user/:display_name/traces' => 'trace#list' - match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss' - match '/user/:display_name/traces/rss' => 'trace#georss' - match '/user/:display_name/traces/:id' => 'trace#view' - match '/user/:display_name/traces/:id/picture' => 'trace#picture' - match '/user/:display_name/traces/:id/icon' => 'trace#icon' - match '/traces/tag/:tag/page/:page' => 'trace#list' - match '/traces/tag/:tag' => 'trace#list' - match '/traces/page/:page' => 'trace#list' - match '/traces' => 'trace#list' - match '/traces/tag/:tag/rss' => 'trace#georss' - match '/traces/rss' => 'trace#georss' - match '/traces/mine/tag/:tag/page/:page' => 'trace#mine' - match '/traces/mine/tag/:tag' => 'trace#mine' - match '/traces/mine/page/:page' => 'trace#mine' - match '/traces/mine' => 'trace#mine' - match '/trace/create' => 'trace#create' - match '/trace/:id/data' => 'trace#data' - match '/trace/:id/data.:format' => 'trace#data' - match '/trace/:id/edit' => 'trace#edit' - match '/trace/:id/delete' => 'trace#delete' + match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list', :via => :get + match '/user/:display_name/traces/tag/:tag' => 'trace#list', :via => :get + match '/user/:display_name/traces/page/:page' => 'trace#list', :via => :get + match '/user/:display_name/traces' => 'trace#list', :via => :get + match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss', :via => :get + match '/user/:display_name/traces/rss' => 'trace#georss', :via => :get + match '/user/:display_name/traces/:id' => 'trace#view', :via => :get + match '/user/:display_name/traces/:id/picture' => 'trace#picture', :via => :get + match '/user/:display_name/traces/:id/icon' => 'trace#icon', :via => :get + match '/traces/tag/:tag/page/:page' => 'trace#list', :via => :get + match '/traces/tag/:tag' => 'trace#list', :via => :get + match '/traces/page/:page' => 'trace#list', :via => :get + match '/traces' => 'trace#list', :via => :get + match '/traces/tag/:tag/rss' => 'trace#georss', :via => :get + match '/traces/rss' => 'trace#georss', :via => :get + match '/traces/mine/tag/:tag/page/:page' => 'trace#mine', :via => :get + match '/traces/mine/tag/:tag' => 'trace#mine', :via => :get + match '/traces/mine/page/:page' => 'trace#mine', :via => :get + match '/traces/mine' => 'trace#mine', :via => :get + match '/trace/create' => 'trace#create', :via => [:get, :post] + match '/trace/:id/data' => 'trace#data', :via => :get + match '/trace/:id/edit' => 'trace#edit', :via => [:get, :post, :put] + match '/trace/:id/delete' => 'trace#delete', :via => :post # diary pages - match '/diary/new' => 'diary_entry#new' - match '/diary/friends' => 'diary_entry#list', :friends => true - match '/diary/nearby' => 'diary_entry#list', :nearby => true - match '/user/:display_name/diary/rss' => 'diary_entry#rss', :format => :rss - match '/diary/:language/rss' => 'diary_entry#rss', :format => :rss - match '/diary/rss' => 'diary_entry#rss', :format => :rss - match '/user/:display_name/diary/comments/:page' => 'diary_entry#comments', :page => /\d+/ - match '/user/:display_name/diary/comments/' => 'diary_entry#comments' - match '/user/:display_name/diary' => 'diary_entry#list' - match '/diary/:language' => 'diary_entry#list' - match '/diary' => 'diary_entry#list' - match '/user/:display_name/diary/:id' => 'diary_entry#view', :id => /\d+/ - match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :id => /\d+/ - match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :id => /\d+/ - match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :id => /\d+/ - match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :id => /\d+/, :comment => /\d+/ + match '/diary/new' => 'diary_entry#new', :via => [:get, :post] + match '/diary/friends' => 'diary_entry#list', :friends => true, :via => :get, :as => "friend_diaries" + match '/diary/nearby' => 'diary_entry#list', :nearby => true, :via => :get, :as => "nearby_diaries" + match '/user/:display_name/diary/rss' => 'diary_entry#rss', :via => :get, :format => :rss + match '/diary/:language/rss' => 'diary_entry#rss', :via => :get, :format => :rss + match '/diary/rss' => 'diary_entry#rss', :via => :get, :format => :rss + match '/user/:display_name/diary/comments/:page' => 'diary_entry#comments', :via => :get, :page => /\d+/ + match '/user/:display_name/diary/comments/' => 'diary_entry#comments', :via => :get + match '/user/:display_name/diary' => 'diary_entry#list', :via => :get + match '/diary/:language' => 'diary_entry#list', :via => :get + match '/diary' => 'diary_entry#list', :via => :get + match '/user/:display_name/diary/:id' => 'diary_entry#view', :via => :get, :id => /\d+/ + match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :via => :post, :id => /\d+/ + match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :via => [:get, :post], :id => /\d+/ + match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :via => :post, :id => /\d+/ + match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :via => :post, :id => /\d+/, :comment => /\d+/ # user pages - match '/user/:display_name' => 'user#view' - match '/user/:display_name/make_friend' => 'user#make_friend' - match '/user/:display_name/remove_friend' => 'user#remove_friend' - match '/user/:display_name/account' => 'user#account' - match '/user/:display_name/set_status' => 'user#set_status' - match '/user/:display_name/delete' => 'user#delete' + match '/user/:display_name' => 'user#view', :via => :get + match '/user/:display_name/make_friend' => 'user#make_friend', :via => :get + match '/user/:display_name/remove_friend' => 'user#remove_friend', :via => :get + match '/user/:display_name/account' => 'user#account', :via => [:get, :post] + match '/user/:display_name/set_status' => 'user#set_status', :via => :get + match '/user/:display_name/delete' => 'user#delete', :via => :get # user lists - match '/users' => 'user#list' - match '/users/:status' => 'user#list' - - # test pages - match '/test/populate/:table/:from/:count' => 'test#populate' - match '/test/populate/:table/:count' => 'test#populate', :from => 1 + match '/users' => 'user#list', :via => [:get, :post] + match '/users/:status' => 'user#list', :via => [:get, :post] # geocoder - match '/geocoder/search' => 'geocoder#search' - match '/geocoder/search_latlon' => 'geocoder#search_latlon' - match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode' - match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode' - match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode' - match '/geocoder/search_osm_namefinder' => 'geocoder#search_osm_namefinder' - match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim' - match '/geocoder/search_geonames' => 'geocoder#search_geonames' - match '/geocoder/description' => 'geocoder#description' - match '/geocoder/description_osm_namefinder' => 'geocoder#description_osm_namefinder' - match '/geocoder/description_osm_nominatim' => 'geocoder#description_osm_nominatim' - match '/geocoder/description_geonames' => 'geocoder#description_geonames' + match '/geocoder/search' => 'geocoder#search', :via => :post + match '/geocoder/search_latlon' => 'geocoder#search_latlon', :via => :get + match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode', :via => :get + match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode', :via => :get + match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode', :via => :get + match '/geocoder/search_osm_namefinder' => 'geocoder#search_osm_namefinder', :via => :get + match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim', :via => :get + match '/geocoder/search_geonames' => 'geocoder#search_geonames', :via => :get + match '/geocoder/description' => 'geocoder#description', :via => :post + match '/geocoder/description_osm_namefinder' => 'geocoder#description_osm_namefinder', :via => :get + match '/geocoder/description_osm_nominatim' => 'geocoder#description_osm_nominatim', :via => :get + match '/geocoder/description_geonames' => 'geocoder#description_geonames', :via => :get # export - match '/export/start' => 'export#start' - match '/export/finish' => 'export#finish' + match '/export/start' => 'export#start', :via => :get + match '/export/finish' => 'export#finish', :via => :post # messages - match '/user/:display_name/inbox' => 'message#inbox' - match '/user/:display_name/outbox' => 'message#outbox' - match '/message/new/:display_name' => 'message#new' - match '/message/read/:message_id' => 'message#read' - match '/message/mark/:message_id' => 'message#mark' - match '/message/reply/:message_id' => 'message#reply' - match '/message/delete/:message_id' => 'message#delete' + match '/user/:display_name/inbox' => 'message#inbox', :via => :get, :as => "inbox" + match '/user/:display_name/outbox' => 'message#outbox', :via => :get, :as => "outbox" + match '/message/new/:display_name' => 'message#new', :via => [:get, :post] + match '/message/read/:message_id' => 'message#read', :via => :get + match '/message/mark/:message_id' => 'message#mark', :via => :post + match '/message/reply/:message_id' => 'message#reply', :via => [:get, :post] + match '/message/delete/:message_id' => 'message#delete', :via => :post # oauth admin pages (i.e: for setting up new clients, etc...) scope "/user/:display_name" do @@ -242,15 +232,11 @@ OpenStreetMap::Application.routes.draw do match '/oauth/test_request' => 'oauth#test_request', :as => :test_request # roles and banning pages - match '/user/:display_name/role/:role/grant' => 'user_roles#grant' - match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke' - match '/user/:display_name/blocks' => 'user_blocks#blocks_on' - match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by' - match '/blocks/new/:display_name' => 'user_blocks#new' + match '/user/:display_name/role/:role/grant' => 'user_roles#grant', :via => [:get, :post] + match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke', :via => [:get, :post] + match '/user/:display_name/blocks' => 'user_blocks#blocks_on', :via => :get + match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by', :via => :get + match '/blocks/new/:display_name' => 'user_blocks#new', :via => :get resources :user_blocks - match '/blocks/:id/revoke' => 'user_blocks#revoke' - - # fall through - match ':controller/:id/:action' => '#index' - match ':controller/:action' => '#index' + match '/blocks/:id/revoke' => 'user_blocks#revoke', :via => [:get, :post] end diff --git a/public/potlatch2/locales/ast.swf b/public/potlatch2/locales/ast.swf index 0c19e2f4f..15822bd7d 100644 Binary files a/public/potlatch2/locales/ast.swf and b/public/potlatch2/locales/ast.swf differ diff --git a/public/potlatch2/locales/br.swf b/public/potlatch2/locales/br.swf index 276f01d8a..1d6296aa2 100644 Binary files a/public/potlatch2/locales/br.swf and b/public/potlatch2/locales/br.swf differ diff --git a/public/potlatch2/locales/de_DE.swf b/public/potlatch2/locales/de_DE.swf index d39cf158f..7d1361a7d 100644 Binary files a/public/potlatch2/locales/de_DE.swf and b/public/potlatch2/locales/de_DE.swf differ diff --git a/public/potlatch2/locales/en_GB.swf b/public/potlatch2/locales/en_GB.swf index 1586a7965..bd25d16e1 100644 Binary files a/public/potlatch2/locales/en_GB.swf and b/public/potlatch2/locales/en_GB.swf differ diff --git a/public/potlatch2/locales/en_US.swf b/public/potlatch2/locales/en_US.swf index 13050fa37..9dc8630b4 100644 Binary files a/public/potlatch2/locales/en_US.swf and b/public/potlatch2/locales/en_US.swf differ diff --git a/public/potlatch2/locales/es_ES.swf b/public/potlatch2/locales/es_ES.swf index ef995c1cf..298d7cfe7 100644 Binary files a/public/potlatch2/locales/es_ES.swf and b/public/potlatch2/locales/es_ES.swf differ diff --git a/public/potlatch2/locales/fi.swf b/public/potlatch2/locales/fi.swf index 49e6cdb49..e334f2039 100644 Binary files a/public/potlatch2/locales/fi.swf and b/public/potlatch2/locales/fi.swf differ diff --git a/public/potlatch2/locales/fr_FR.swf b/public/potlatch2/locales/fr_FR.swf index 705787164..b65e3ede3 100644 Binary files a/public/potlatch2/locales/fr_FR.swf and b/public/potlatch2/locales/fr_FR.swf differ diff --git a/public/potlatch2/locales/he.swf b/public/potlatch2/locales/he.swf index 383829283..dd61e160b 100644 Binary files a/public/potlatch2/locales/he.swf and b/public/potlatch2/locales/he.swf differ diff --git a/public/potlatch2/locales/hsb.swf b/public/potlatch2/locales/hsb.swf index 66038f36d..772b366da 100644 Binary files a/public/potlatch2/locales/hsb.swf and b/public/potlatch2/locales/hsb.swf differ diff --git a/public/potlatch2/locales/ja_JP.swf b/public/potlatch2/locales/ja_JP.swf index b20221924..a0dd94810 100644 Binary files a/public/potlatch2/locales/ja_JP.swf and b/public/potlatch2/locales/ja_JP.swf differ diff --git a/public/potlatch2/locales/mk.swf b/public/potlatch2/locales/mk.swf index 61215e473..4c90b424e 100644 Binary files a/public/potlatch2/locales/mk.swf and b/public/potlatch2/locales/mk.swf differ diff --git a/public/potlatch2/locales/ms.swf b/public/potlatch2/locales/ms.swf index 0b09c6794..851623e23 100644 Binary files a/public/potlatch2/locales/ms.swf and b/public/potlatch2/locales/ms.swf differ diff --git a/public/potlatch2/locales/nb_NO.swf b/public/potlatch2/locales/nb_NO.swf index 3dca073c7..9287969dd 100644 Binary files a/public/potlatch2/locales/nb_NO.swf and b/public/potlatch2/locales/nb_NO.swf differ diff --git a/public/potlatch2/locales/nl_NL.swf b/public/potlatch2/locales/nl_NL.swf index 544130ad2..c4abcad7b 100644 Binary files a/public/potlatch2/locales/nl_NL.swf and b/public/potlatch2/locales/nl_NL.swf differ diff --git a/public/potlatch2/locales/nn_NO.swf b/public/potlatch2/locales/nn_NO.swf index ca73dfc23..006c5d236 100644 Binary files a/public/potlatch2/locales/nn_NO.swf and b/public/potlatch2/locales/nn_NO.swf differ diff --git a/public/potlatch2/locales/pl_PL.swf b/public/potlatch2/locales/pl_PL.swf index 00f3d2a0b..02024b5f2 100644 Binary files a/public/potlatch2/locales/pl_PL.swf and b/public/potlatch2/locales/pl_PL.swf differ diff --git a/public/potlatch2/locales/ru.swf b/public/potlatch2/locales/ru.swf index 68cce1c80..6c506069d 100644 Binary files a/public/potlatch2/locales/ru.swf and b/public/potlatch2/locales/ru.swf differ diff --git a/public/potlatch2/locales/sq.swf b/public/potlatch2/locales/sq.swf index 472338f5a..f65de2380 100644 Binary files a/public/potlatch2/locales/sq.swf and b/public/potlatch2/locales/sq.swf differ diff --git a/public/potlatch2/locales/tr.swf b/public/potlatch2/locales/tr.swf index a7b500ea3..89e2e16e6 100644 Binary files a/public/potlatch2/locales/tr.swf and b/public/potlatch2/locales/tr.swf differ diff --git a/public/potlatch2/locales/vi_VN.swf b/public/potlatch2/locales/vi_VN.swf index 703590e08..9a00b3770 100644 Binary files a/public/potlatch2/locales/vi_VN.swf and b/public/potlatch2/locales/vi_VN.swf differ diff --git a/public/potlatch2/locales/zh_CN.swf b/public/potlatch2/locales/zh_CN.swf index bfcfd6730..d0a7076db 100644 Binary files a/public/potlatch2/locales/zh_CN.swf and b/public/potlatch2/locales/zh_CN.swf differ diff --git a/public/potlatch2/potlatch2.swf b/public/potlatch2/potlatch2.swf index 10774290c..d2a082b2a 100644 Binary files a/public/potlatch2/potlatch2.swf and b/public/potlatch2/potlatch2.swf differ diff --git a/test/functional/amf_controller_test.rb b/test/functional/amf_controller_test.rb index 8bef10bd1..46ff71eb7 100644 --- a/test/functional/amf_controller_test.rb +++ b/test/functional/amf_controller_test.rb @@ -5,6 +5,19 @@ include Potlatch class AmfControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/amf/read", :method => :post }, + { :controller => "amf", :action => "amf_read" } + ) + assert_routing( + { :path => "/api/0.6/amf/write", :method => :post }, + { :controller => "amf", :action => "amf_write" } + ) + end + def test_getway # check a visible way id = current_ways(:visible_way).id diff --git a/test/functional/api_controller_test.rb b/test/functional/api_controller_test.rb index 9226e3892..adc433fe0 100644 --- a/test/functional/api_controller_test.rb +++ b/test/functional/api_controller_test.rb @@ -18,6 +18,31 @@ class ApiControllerTest < ActionController::TestCase # reall reject it, however this is to test to see if the api changes. end + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/capabilities", :method => :get }, + { :controller => "api", :action => "capabilities" } + ) + assert_recognizes( + { :controller => "api", :action => "capabilities" }, + { :path => "/api/0.6/capabilities", :method => :get } + ) + assert_routing( + { :path => "/api/0.6/map", :method => :get }, + { :controller => "api", :action => "map" } + ) + assert_routing( + { :path => "/api/0.6/trackpoints", :method => :get }, + { :controller => "api", :action => "trackpoints" } + ) + assert_routing( + { :path => "/api/0.6/changes", :method => :get }, + { :controller => "api", :action => "changes" } + ) + end + # ------------------------------------- # Test reading a bounding box. # ------------------------------------- diff --git a/test/functional/browse_controller_test.rb b/test/functional/browse_controller_test.rb index f4da4c1a8..04b690ebf 100644 --- a/test/functional/browse_controller_test.rb +++ b/test/functional/browse_controller_test.rb @@ -4,6 +4,43 @@ require 'browse_controller' class BrowseControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/browse/start", :method => :get }, + { :controller => "browse", :action => "start" } + ) + assert_routing( + { :path => "/browse/node/1", :method => :get }, + { :controller => "browse", :action => "node", :id => "1" } + ) + assert_routing( + { :path => "/browse/node/1/history", :method => :get }, + { :controller => "browse", :action => "node_history", :id => "1" } + ) + assert_routing( + { :path => "/browse/way/1", :method => :get }, + { :controller => "browse", :action => "way", :id => "1" } + ) + assert_routing( + { :path => "/browse/way/1/history", :method => :get }, + { :controller => "browse", :action => "way_history", :id => "1" } + ) + assert_routing( + { :path => "/browse/relation/1", :method => :get }, + { :controller => "browse", :action => "relation", :id => "1" } + ) + assert_routing( + { :path => "/browse/relation/1/history", :method => :get }, + { :controller => "browse", :action => "relation_history", :id => "1" } + ) + assert_routing( + { :path => "/browse/changeset/1", :method => :get }, + { :controller => "browse", :action => "changeset", :id => "1" } + ) + end + def test_start xhr :get, :start assert_response :success diff --git a/test/functional/changeset_controller_test.rb b/test/functional/changeset_controller_test.rb index ef8043340..a586b3dee 100644 --- a/test/functional/changeset_controller_test.rb +++ b/test/functional/changeset_controller_test.rb @@ -4,6 +4,79 @@ require 'changeset_controller' class ChangesetControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/changeset/create", :method => :put }, + { :controller => "changeset", :action => "create" } + ) + assert_routing( + { :path => "/api/0.6/changeset/1/upload", :method => :post }, + { :controller => "changeset", :action => "upload", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/changeset/1/download", :method => :get }, + { :controller => "changeset", :action => "download", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/changeset/1/expand_bbox", :method => :post }, + { :controller => "changeset", :action => "expand_bbox", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/changeset/1", :method => :get }, + { :controller => "changeset", :action => "read", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/changeset/1", :method => :put }, + { :controller => "changeset", :action => "update", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/changeset/1/close", :method => :put }, + { :controller => "changeset", :action => "close", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/changesets", :method => :get }, + { :controller => "changeset", :action => "query" } + ) + assert_routing( + { :path => "/user/name/edits", :method => :get }, + { :controller => "changeset", :action => "list", :display_name => "name" } + ) + assert_routing( + { :path => "/user/name/edits/feed", :method => :get }, + { :controller => "changeset", :action => "feed", :display_name => "name", :format => :atom } + ) + assert_routing( + { :path => "/browse/friends", :method => :get }, + { :controller => "changeset", :action => "list", :friends => true } + ) + assert_routing( + { :path => "/browse/nearby", :method => :get }, + { :controller => "changeset", :action => "list", :nearby => true } + ) + assert_routing( + { :path => "/browse/changesets", :method => :get }, + { :controller => "changeset", :action => "list" } + ) + assert_routing( + { :path => "/browse/changesets/feed", :method => :get }, + { :controller => "changeset", :action => "feed", :format => :atom } + ) + assert_recognizes( + { :controller => "changeset", :action => "list" }, + { :path => "/browse", :method => :get } + ) + assert_recognizes( + { :controller => "changeset", :action => "list" }, + { :path => "/history", :method => :get } + ) + assert_recognizes( + { :controller => "changeset", :action => "feed", :format => :atom }, + { :path => "/history/feed", :method => :get } + ) + end + # ----------------------- # Test simple changeset creation # ----------------------- diff --git a/test/functional/diary_entry_controller_test.rb b/test/functional/diary_entry_controller_test.rb index 738fbe671..7981edd95 100644 --- a/test/functional/diary_entry_controller_test.rb +++ b/test/functional/diary_entry_controller_test.rb @@ -5,6 +5,86 @@ class DiaryEntryControllerTest < ActionController::TestCase include ActionView::Helpers::NumberHelper + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/diary", :method => :get }, + { :controller => "diary_entry", :action => "list" } + ) + assert_routing( + { :path => "/diary/language", :method => :get }, + { :controller => "diary_entry", :action => "list", :language => "language" } + ) + assert_routing( + { :path => "/user/username/diary", :method => :get }, + { :controller => "diary_entry", :action => "list", :display_name => "username" } + ) + assert_routing( + { :path => "/diary/friends", :method => :get }, + { :controller => "diary_entry", :action => "list", :friends => true } + ) + assert_routing( + { :path => "/diary/nearby", :method => :get }, + { :controller => "diary_entry", :action => "list", :nearby => true } + ) + + assert_routing( + { :path => "/diary/rss", :method => :get }, + { :controller => "diary_entry", :action => "rss", :format => :rss } + ) + assert_routing( + { :path => "/diary/language/rss", :method => :get }, + { :controller => "diary_entry", :action => "rss", :language => "language", :format => :rss } + ) + assert_routing( + { :path => "/user/username/diary/rss", :method => :get }, + { :controller => "diary_entry", :action => "rss", :display_name => "username", :format => :rss } + ) + + assert_routing( + { :path => "/user/username/diary/comments", :method => :get }, + { :controller => "diary_entry", :action => "comments", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/diary/comments/1", :method => :get }, + { :controller => "diary_entry", :action => "comments", :display_name => "username", :page => "1" } + ) + + assert_routing( + { :path => "/diary/new", :method => :get }, + { :controller => "diary_entry", :action => "new" } + ) + assert_routing( + { :path => "/diary/new", :method => :post }, + { :controller => "diary_entry", :action => "new" } + ) + assert_routing( + { :path => "/user/username/diary/1", :method => :get }, + { :controller => "diary_entry", :action => "view", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/edit", :method => :get }, + { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/edit", :method => :post }, + { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/newcomment", :method => :post }, + { :controller => "diary_entry", :action => "comment", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/hide", :method => :post }, + { :controller => "diary_entry", :action => "hide", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/diary/1/hidecomment/2", :method => :post }, + { :controller => "diary_entry", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" } + ) + end + def test_showing_new_diary_entry @request.cookies["_osm_username"] = users(:normal_user).display_name @@ -42,31 +122,28 @@ class DiaryEntryControllerTest < ActionController::TestCase def test_editing_diary_entry @request.cookies["_osm_username"] = users(:normal_user).display_name + entry = diary_entries(:normal_user_entry_1) # Make sure that you are redirected to the login page when you are # not logged in, without and with the id of the entry you want to edit - get :edit + get :edit, :display_name => entry.user.display_name, :id => entry.id assert_response :redirect - assert_redirected_to :controller => :user, :action => "login", :referer => "/diary_entry/edit" + assert_redirected_to :controller => :user, :action => "login", :referer => "/user/#{entry.user.display_name}/diary/#{entry.id}/edit" - get :edit, :id => diary_entries(:normal_user_entry_1).id - assert_response :redirect - assert_redirected_to :controller => :user, :action => "login", :referer => "/diary_entry/edit" - - # Verify that you get a not found error, when you don't pass an id - get(:edit, nil, {'user' => users(:normal_user).id}) + # Verify that you get a not found error, when you pass a bogus id + get(:edit, {:display_name => entry.user.display_name, :id => 9999}, {'user' => entry.user.id}) assert_response :not_found assert_select "html", :count => 1 do assert_select "body", :count => 1 do assert_select "div#content", :count => 1 do - assert_select "h2", :text => "No entry with the id:", :count => 1 + assert_select "h2", :text => "No entry with the id: 9999", :count => 1 end end end # Now pass the id, and check that you can edit it, when using the same # user as the person who created the entry - get(:edit, {:id => diary_entries(:normal_user_entry_1).id}, {'user' => users(:normal_user).id}) + get(:edit, {:display_name => entry.user.display_name, :id => entry.id}, {'user' => entry.user.id}) assert_response :success assert_select "html", :count => 1 do assert_select "head", :count => 1 do @@ -75,9 +152,9 @@ class DiaryEntryControllerTest < ActionController::TestCase assert_select "body", :count => 1 do assert_select "div#content", :count => 1 do assert_select "h1", :text => /Edit diary entry/, :count => 1 - assert_select "form[action='/diary_entry/#{diary_entries(:normal_user_entry_1).id}/edit'][method=post]", :count => 1 do - assert_select "input#diary_entry_title[name='diary_entry[title]'][value='#{diary_entries(:normal_user_entry_1).title}']", :count => 1 - assert_select "textarea#diary_entry_body[name='diary_entry[body]']", :text => diary_entries(:normal_user_entry_1).body, :count => 1 + assert_select "form[action='/user/#{entry.user.display_name}/diary/#{entry.id}/edit'][method=post]", :count => 1 do + assert_select "input#diary_entry_title[name='diary_entry[title]'][value='#{entry.title}']", :count => 1 + assert_select "textarea#diary_entry_body[name='diary_entry[body]']", :text => entry.body, :count => 1 assert_select "select#diary_entry_language_code", :count => 1 assert_select "input#latitude[name='diary_entry[latitude]']", :count => 1 assert_select "input#longitude[name='diary_entry[longitude]']", :count => 1 @@ -94,15 +171,15 @@ class DiaryEntryControllerTest < ActionController::TestCase new_latitude = "1.1" new_longitude = "2.2" new_language_code = "en" - post(:edit, {:id => diary_entries(:normal_user_entry_1).id, 'commit' => 'save', + post(:edit, {:display_name => entry.user.display_name, :id => entry.id, 'commit' => 'save', 'diary_entry'=>{'title' => new_title, 'body' => new_body, 'latitude' => new_latitude, 'longitude' => new_longitude, 'language_code' => new_language_code} }, - {'user' => users(:normal_user).id}) + {'user' => entry.user.id}) assert_response :redirect - assert_redirected_to :action => :view, :id => diary_entries(:normal_user_entry_1).id + assert_redirected_to :action => :view, :display_name => entry.user.display_name, :id => entry.id # Now check that the new data is rendered, when logged in - get :view, {:id => diary_entries(:normal_user_entry_1).id, :display_name => 'test'}, {'user' => users(:normal_user).id} + get :view, {:display_name => entry.user.display_name, :id => entry.id}, {'user' => entry.user.id} assert_response :success assert_template 'diary_entry/view' assert_select "html", :count => 1 do @@ -111,7 +188,7 @@ class DiaryEntryControllerTest < ActionController::TestCase end assert_select "body", :count => 1 do assert_select "div#content", :count => 1 do - assert_select "h2", :text => /#{users(:normal_user).display_name}'s diary/, :count => 1 + assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1 assert_select "b", :text => /#{new_title}/, :count => 1 # This next line won't work if the text has been run through the htmlize function # due to formatting that could be introduced @@ -119,7 +196,7 @@ class DiaryEntryControllerTest < ActionController::TestCase assert_select "abbr[class=geo][title=#{number_with_precision(new_latitude, :precision => 4)}; #{number_with_precision(new_longitude, :precision => 4)}]", :count => 1 # As we're not logged in, check that you cannot edit #print @response.body - assert_select "a[href='/user/#{users(:normal_user).display_name}/diary/#{diary_entries(:normal_user_entry_1).id}/edit']", :text => "Edit this entry", :count => 1 + assert_select "a[href='/user/#{entry.user.display_name}/diary/#{entry.id}/edit']", :text => "Edit this entry", :count => 1 end end end @@ -127,7 +204,7 @@ class DiaryEntryControllerTest < ActionController::TestCase @request.cookies["_osm_username"] = users(:public_user).display_name # and when not logged in as the user who wrote the entry - get :view, {:id => diary_entries(:normal_user_entry_1).id, :display_name => 'test'}, {'user' => users(:public_user).id} + get :view, {:display_name => entry.user.display_name, :id => entry.id}, {'user' => entry.user.id} assert_response :success assert_template 'diary_entry/view' assert_select "html", :count => 1 do @@ -143,8 +220,8 @@ class DiaryEntryControllerTest < ActionController::TestCase assert_select "p", :text => /#{new_body}/, :count => 1 assert_select "abbr[class=geo][title=#{number_with_precision(new_latitude, :precision => 4)}; #{number_with_precision(new_longitude, :precision => 4)}]", :count => 1 # As we're not logged in, check that you cannot edit - assert_select "span[class=hidden show_if_user_#{users(:normal_user).id}]", :count => 1 do - assert_select "a[href='/user/#{users(:normal_user).display_name}/diary/#{diary_entries(:normal_user_entry_1).id}/edit']", :text => "Edit this entry", :count => 1 + assert_select "span[class=hidden show_if_user_#{entry.user.id}]", :count => 1 do + assert_select "a[href='/user/#{entry.user.display_name}/diary/#{entry.id}/edit']", :text => "Edit this entry", :count => 1 end end end diff --git a/test/functional/export_controller_test.rb b/test/functional/export_controller_test.rb index 0fa6398c1..75ed34a4a 100644 --- a/test/functional/export_controller_test.rb +++ b/test/functional/export_controller_test.rb @@ -1,7 +1,20 @@ require File.dirname(__FILE__) + '/../test_helper' class ExportControllerTest < ActionController::TestCase - # Replace this with your real tests. + + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/export/start", :method => :get }, + { :controller => "export", :action => "start" } + ) + assert_routing( + { :path => "/export/finish", :method => :post }, + { :controller => "export", :action => "finish" } + ) + end + def test_start xhr :get, :start assert_response :success diff --git a/test/functional/geocoder_controller_test.rb b/test/functional/geocoder_controller_test.rb index f63fe518d..b678125d2 100644 --- a/test/functional/geocoder_controller_test.rb +++ b/test/functional/geocoder_controller_test.rb @@ -2,9 +2,57 @@ require File.dirname(__FILE__) + '/../test_helper' require 'geocoder_controller' class GeocoderControllerTest < ActionController::TestCase + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/geocoder/search", :method => :post }, + { :controller => "geocoder", :action => "search" } + ) + assert_routing( + { :path => "/geocoder/search_latlon", :method => :get }, + { :controller => "geocoder", :action => "search_latlon" } + ) + assert_routing( + { :path => "/geocoder/search_us_postcode", :method => :get }, + { :controller => "geocoder", :action => "search_us_postcode" } + ) + assert_routing( + { :path => "/geocoder/search_uk_postcode", :method => :get }, + { :controller => "geocoder", :action => "search_uk_postcode" } + ) + assert_routing( + { :path => "/geocoder/search_ca_postcode", :method => :get }, + { :controller => "geocoder", :action => "search_ca_postcode" } + ) + assert_routing( + { :path => "/geocoder/search_osm_namefinder", :method => :get }, + { :controller => "geocoder", :action => "search_osm_namefinder" } + ) + assert_routing( + { :path => "/geocoder/search_osm_nominatim", :method => :get }, + { :controller => "geocoder", :action => "search_osm_nominatim" } + ) + assert_routing( + { :path => "/geocoder/search_geonames", :method => :get }, + { :controller => "geocoder", :action => "search_geonames" } + ) - # Replace this with your real tests. - def test_truth - assert true + assert_routing( + { :path => "/geocoder/description", :method => :post }, + { :controller => "geocoder", :action => "description" } + ) + assert_routing( + { :path => "/geocoder/description_osm_namefinder", :method => :get }, + { :controller => "geocoder", :action => "description_osm_namefinder" } + ) + assert_routing( + { :path => "/geocoder/description_osm_nominatim", :method => :get }, + { :controller => "geocoder", :action => "description_osm_nominatim" } + ) + assert_routing( + { :path => "/geocoder/description_geonames", :method => :get }, + { :controller => "geocoder", :action => "description_geonames" } + ) end end diff --git a/test/functional/message_controller_test.rb b/test/functional/message_controller_test.rb index 96f509cb0..a2bb1f805 100644 --- a/test/functional/message_controller_test.rb +++ b/test/functional/message_controller_test.rb @@ -2,9 +2,44 @@ require File.dirname(__FILE__) + '/../test_helper' require 'message_controller' class MessageControllerTest < ActionController::TestCase - - # Replace this with your real tests. - def test_truth - assert true + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/user/username/inbox", :method => :get }, + { :controller => "message", :action => "inbox", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/outbox", :method => :get }, + { :controller => "message", :action => "outbox", :display_name => "username" } + ) + assert_routing( + { :path => "/message/new/username", :method => :get }, + { :controller => "message", :action => "new", :display_name => "username" } + ) + assert_routing( + { :path => "/message/new/username", :method => :post }, + { :controller => "message", :action => "new", :display_name => "username" } + ) + assert_routing( + { :path => "/message/read/1", :method => :get }, + { :controller => "message", :action => "read", :message_id => "1" } + ) + assert_routing( + { :path => "/message/mark/1", :method => :post }, + { :controller => "message", :action => "mark", :message_id => "1" } + ) + assert_routing( + { :path => "/message/reply/1", :method => :get }, + { :controller => "message", :action => "reply", :message_id => "1" } + ) + assert_routing( + { :path => "/message/reply/1", :method => :post }, + { :controller => "message", :action => "reply", :message_id => "1" } + ) + assert_routing( + { :path => "/message/delete/1", :method => :post }, + { :controller => "message", :action => "delete", :message_id => "1" } + ) end end diff --git a/test/functional/node_controller_test.rb b/test/functional/node_controller_test.rb index fdefd0896..5544728f1 100644 --- a/test/functional/node_controller_test.rb +++ b/test/functional/node_controller_test.rb @@ -3,6 +3,31 @@ require File.dirname(__FILE__) + '/../test_helper' class NodeControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/node/create", :method => :put }, + { :controller => "node", :action => "create" } + ) + assert_routing( + { :path => "/api/0.6/node/1", :method => :get }, + { :controller => "node", :action => "read", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/node/1", :method => :put }, + { :controller => "node", :action => "update", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/node/1", :method => :delete }, + { :controller => "node", :action => "delete", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/nodes", :method => :get }, + { :controller => "node", :action => "nodes" } + ) + end + def test_create # cannot read password from fixture as it is stored as MD5 digest ## First try with no auth diff --git a/test/functional/oauth_clients_controller_test.rb b/test/functional/oauth_clients_controller_test.rb new file mode 100644 index 000000000..64a1e4e72 --- /dev/null +++ b/test/functional/oauth_clients_controller_test.rb @@ -0,0 +1,36 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class OauthClientsControllerTest < ActionController::TestCase + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/user/username/oauth_clients", :method => :get }, + { :controller => "oauth_clients", :action => "index", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/oauth_clients/new", :method => :get }, + { :controller => "oauth_clients", :action => "new", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/oauth_clients", :method => :post }, + { :controller => "oauth_clients", :action => "create", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/oauth_clients/1", :method => :get }, + { :controller => "oauth_clients", :action => "show", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/oauth_clients/1/edit", :method => :get }, + { :controller => "oauth_clients", :action => "edit", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/oauth_clients/1", :method => :put }, + { :controller => "oauth_clients", :action => "update", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/oauth_clients/1", :method => :delete }, + { :controller => "oauth_clients", :action => "destroy", :display_name => "username", :id => "1" } + ) + end +end diff --git a/test/functional/oauth_controller_test.rb b/test/functional/oauth_controller_test.rb new file mode 100644 index 000000000..b34416be6 --- /dev/null +++ b/test/functional/oauth_controller_test.rb @@ -0,0 +1,32 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class OauthControllerTest < ActionController::TestCase + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/oauth/revoke" }, + { :controller => "oauth", :action => "revoke" } + ) + assert_routing( + { :path => "/oauth/authorize" }, + { :controller => "oauth", :action => "authorize" } + ) + assert_routing( + { :path => "/oauth/token" }, + { :controller => "oauth", :action => "token" } + ) + assert_routing( + { :path => "/oauth/request_token" }, + { :controller => "oauth", :action => "request_token" } + ) + assert_routing( + { :path => "/oauth/access_token" }, + { :controller => "oauth", :action => "access_token" } + ) + assert_routing( + { :path => "/oauth/test_request" }, + { :controller => "oauth", :action => "test_request" } + ) + end +end diff --git a/test/functional/old_node_controller_test.rb b/test/functional/old_node_controller_test.rb index 69ea0f345..3c0358c2b 100644 --- a/test/functional/old_node_controller_test.rb +++ b/test/functional/old_node_controller_test.rb @@ -8,6 +8,19 @@ class OldNodeControllerTest < ActionController::TestCase # TODO: test history # + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/node/1/history", :method => :get }, + { :controller => "old_node", :action => "history", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/node/1/2", :method => :get }, + { :controller => "old_node", :action => "version", :id => "1", :version => "2" } + ) + end + ## # test the version call by submitting several revisions of a new node # to the API and ensuring that later calls to version return the diff --git a/test/functional/old_relation_controller_test.rb b/test/functional/old_relation_controller_test.rb index 54e1cd037..89676a175 100644 --- a/test/functional/old_relation_controller_test.rb +++ b/test/functional/old_relation_controller_test.rb @@ -4,6 +4,19 @@ require 'old_relation_controller' class OldRelationControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/relation/1/history", :method => :get }, + { :controller => "old_relation", :action => "history", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/relation/1/2", :method => :get }, + { :controller => "old_relation", :action => "version", :id => "1", :version => "2" } + ) + end + # ------------------------------------- # Test reading old relations. # ------------------------------------- diff --git a/test/functional/old_way_controller_test.rb b/test/functional/old_way_controller_test.rb index 9dd542c52..f0ab6bd85 100644 --- a/test/functional/old_way_controller_test.rb +++ b/test/functional/old_way_controller_test.rb @@ -4,6 +4,19 @@ require 'old_way_controller' class OldWayControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/way/1/history", :method => :get }, + { :controller => "old_way", :action => "history", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/way/1/2", :method => :get }, + { :controller => "old_way", :action => "version", :id => "1", :version => "2" } + ) + end + # ------------------------------------- # Test reading old ways. # ------------------------------------- diff --git a/test/functional/relation_controller_test.rb b/test/functional/relation_controller_test.rb index 8a59adb02..1f2640d46 100644 --- a/test/functional/relation_controller_test.rb +++ b/test/functional/relation_controller_test.rb @@ -4,6 +4,48 @@ require 'relation_controller' class RelationControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/relation/create", :method => :put }, + { :controller => "relation", :action => "create" } + ) + assert_routing( + { :path => "/api/0.6/relation/1/full", :method => :get }, + { :controller => "relation", :action => "full", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/relation/1", :method => :get }, + { :controller => "relation", :action => "read", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/relation/1", :method => :put }, + { :controller => "relation", :action => "update", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/relation/1", :method => :delete }, + { :controller => "relation", :action => "delete", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/relations", :method => :get }, + { :controller => "relation", :action => "relations" } + ) + + assert_routing( + { :path => "/api/0.6/node/1/relations", :method => :get }, + { :controller => "relation", :action => "relations_for_node", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/way/1/relations", :method => :get }, + { :controller => "relation", :action => "relations_for_way", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/relation/1/relations", :method => :get }, + { :controller => "relation", :action => "relations_for_relation", :id => "1" } + ) + end + # ------------------------------------- # Test reading relations. # ------------------------------------- diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index a213253ec..7fd060dc4 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -1,8 +1,24 @@ require File.dirname(__FILE__) + '/../test_helper' class SearchControllerTest < ActionController::TestCase - # Replace this with your real tests. - def test_truth - assert true + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/search", :method => :get }, + { :controller => "search", :action => "search_all" } + ) + assert_routing( + { :path => "/api/0.6/nodes/search", :method => :get }, + { :controller => "search", :action => "search_nodes" } + ) + assert_routing( + { :path => "/api/0.6/ways/search", :method => :get }, + { :controller => "search", :action => "search_ways" } + ) + assert_routing( + { :path => "/api/0.6/relations/search", :method => :get }, + { :controller => "search", :action => "search_relations" } + ) end end diff --git a/test/functional/site_controller_test.rb b/test/functional/site_controller_test.rb index 4d2162a71..caef3481b 100644 --- a/test/functional/site_controller_test.rb +++ b/test/functional/site_controller_test.rb @@ -3,6 +3,55 @@ require File.dirname(__FILE__) + '/../test_helper' class SiteControllerTest < ActionController::TestCase fixtures :users + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/", :method => :get }, + { :controller => "site", :action => "index" } + ) + assert_recognizes( + { :controller => "site", :action => "index" }, + { :path => "/index.html", :method => :get } + ) + assert_routing( + { :path => "/edit", :method => :get }, + { :controller => "site", :action => "edit" } + ) + assert_recognizes( + { :controller => "site", :action => "edit", :format => "html" }, + { :path => "/edit.html", :method => :get } + ) + assert_routing( + { :path => "/copyright", :method => :get }, + { :controller => "site", :action => "copyright" } + ) + assert_routing( + { :path => "/copyright/locale", :method => :get }, + { :controller => "site", :action => "copyright", :copyright_locale => "locale" } + ) + assert_routing( + { :path => "/export", :method => :get }, + { :controller => "site", :action => "export" } + ) + assert_recognizes( + { :controller => "site", :action => "export", :format => "html" }, + { :path => "/export.html", :method => :get } + ) + assert_routing( + { :path => "/offline", :method => :get }, + { :controller => "site", :action => "offline" } + ) + assert_routing( + { :path => "/key", :method => :post }, + { :controller => "site", :action => "key" } + ) + assert_routing( + { :path => "/go/shortcode", :method => :get }, + { :controller => "site", :action => "permalink", :code => "shortcode" } + ) + end + ## Lets check that we can get all the pages without any errors # Get the index def test_index diff --git a/test/functional/swf_controller_test.rb b/test/functional/swf_controller_test.rb index 862d3a8f0..09b8f3aae 100644 --- a/test/functional/swf_controller_test.rb +++ b/test/functional/swf_controller_test.rb @@ -1,8 +1,12 @@ require File.dirname(__FILE__) + '/../test_helper' class SwfControllerTest < ActionController::TestCase - # Replace this with your real tests. - def test_truth - assert true + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/swf/trackpoints", :method => :get }, + { :controller => "swf", :action => "trackpoints" } + ) end end diff --git a/test/functional/trace_controller_test.rb b/test/functional/trace_controller_test.rb index 28c09c899..8ff29c437 100644 --- a/test/functional/trace_controller_test.rb +++ b/test/functional/trace_controller_test.rb @@ -4,6 +4,152 @@ class TraceControllerTest < ActionController::TestCase fixtures :users, :gpx_files set_fixture_class :gpx_files => 'Trace' + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/gpx/create", :method => :post }, + { :controller => "trace", :action => "api_create" } + ) + assert_routing( + { :path => "/api/0.6/gpx/1", :method => :get }, + { :controller => "trace", :action => "api_read", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/gpx/1", :method => :put }, + { :controller => "trace", :action => "api_update", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/gpx/1", :method => :delete }, + { :controller => "trace", :action => "api_delete", :id => "1" } + ) + assert_recognizes( + { :controller => "trace", :action => "api_read", :id => "1" }, + { :path => "/api/0.6/gpx/1/details", :method => :get } + ) + assert_routing( + { :path => "/api/0.6/gpx/1/data", :method => :get }, + { :controller => "trace", :action => "api_data", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/gpx/1/data.xml", :method => :get }, + { :controller => "trace", :action => "api_data", :id => "1", :format => "xml" } + ) + + assert_routing( + { :path => "/traces", :method => :get }, + { :controller => "trace", :action => "list" } + ) + assert_routing( + { :path => "/traces/page/1", :method => :get }, + { :controller => "trace", :action => "list", :page => "1" } + ) + assert_routing( + { :path => "/traces/tag/tagname", :method => :get }, + { :controller => "trace", :action => "list", :tag => "tagname" } + ) + assert_routing( + { :path => "/traces/tag/tagname/page/1", :method => :get }, + { :controller => "trace", :action => "list", :tag => "tagname", :page => "1" } + ) + assert_routing( + { :path => "/user/username/traces", :method => :get }, + { :controller => "trace", :action => "list", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/traces/page/1", :method => :get }, + { :controller => "trace", :action => "list", :display_name => "username", :page => "1" } + ) + assert_routing( + { :path => "/user/username/traces/tag/tagname", :method => :get }, + { :controller => "trace", :action => "list", :display_name => "username", :tag => "tagname" } + ) + assert_routing( + { :path => "/user/username/traces/tag/tagname/page/1", :method => :get }, + { :controller => "trace", :action => "list", :display_name => "username", :tag => "tagname", :page => "1" } + ) + + assert_routing( + { :path => "/traces/mine", :method => :get }, + { :controller => "trace", :action => "mine" } + ) + assert_routing( + { :path => "/traces/mine/page/1", :method => :get }, + { :controller => "trace", :action => "mine", :page => "1" } + ) + assert_routing( + { :path => "/traces/mine/tag/tagname", :method => :get }, + { :controller => "trace", :action => "mine", :tag => "tagname" } + ) + assert_routing( + { :path => "/traces/mine/tag/tagname/page/1", :method => :get }, + { :controller => "trace", :action => "mine", :tag => "tagname", :page => "1" } + ) + + assert_routing( + { :path => "/traces/rss", :method => :get }, + { :controller => "trace", :action => "georss" } + ) + assert_routing( + { :path => "/traces/tag/tagname/rss", :method => :get }, + { :controller => "trace", :action => "georss", :tag => "tagname" } + ) + assert_routing( + { :path => "/user/username/traces/rss", :method => :get }, + { :controller => "trace", :action => "georss", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/traces/tag/tagname/rss", :method => :get }, + { :controller => "trace", :action => "georss", :display_name => "username", :tag => "tagname" } + ) + + assert_routing( + { :path => "/user/username/traces/1", :method => :get }, + { :controller => "trace", :action => "view", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/traces/1/picture", :method => :get }, + { :controller => "trace", :action => "picture", :display_name => "username", :id => "1" } + ) + assert_routing( + { :path => "/user/username/traces/1/icon", :method => :get }, + { :controller => "trace", :action => "icon", :display_name => "username", :id => "1" } + ) + + assert_routing( + { :path => "/trace/create", :method => :get }, + { :controller => "trace", :action => "create" } + ) + assert_routing( + { :path => "/trace/create", :method => :post }, + { :controller => "trace", :action => "create" } + ) + assert_routing( + { :path => "/trace/1/data", :method => :get }, + { :controller => "trace", :action => "data", :id => "1" } + ) + assert_routing( + { :path => "/trace/1/data.xml", :method => :get }, + { :controller => "trace", :action => "data", :id => "1", :format => "xml" } + ) + assert_routing( + { :path => "/trace/1/edit", :method => :get }, + { :controller => "trace", :action => "edit", :id => "1" } + ) + assert_routing( + { :path => "/trace/1/edit", :method => :post }, + { :controller => "trace", :action => "edit", :id => "1" } + ) + assert_routing( + { :path => "/trace/1/edit", :method => :put }, + { :controller => "trace", :action => "edit", :id => "1" } + ) + assert_routing( + { :path => "/trace/1/delete", :method => :post }, + { :controller => "trace", :action => "delete", :id => "1" } + ) + end + # Check that the list of changesets is displayed def test_list get :list diff --git a/test/functional/user_blocks_controller_test.rb b/test/functional/user_blocks_controller_test.rb new file mode 100644 index 000000000..adf0f3631 --- /dev/null +++ b/test/functional/user_blocks_controller_test.rb @@ -0,0 +1,58 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class UserBlocksControllerTest < ActionController::TestCase + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/blocks/new/username", :method => :get }, + { :controller => "user_blocks", :action => "new", :display_name => "username" } + ) + + assert_routing( + { :path => "/user_blocks", :method => :get }, + { :controller => "user_blocks", :action => "index" } + ) + assert_routing( + { :path => "/user_blocks/new", :method => :get }, + { :controller => "user_blocks", :action => "new" } + ) + assert_routing( + { :path => "/user_blocks", :method => :post }, + { :controller => "user_blocks", :action => "create" } + ) + assert_routing( + { :path => "/user_blocks/1", :method => :get }, + { :controller => "user_blocks", :action => "show", :id => "1" } + ) + assert_routing( + { :path => "/user_blocks/1/edit", :method => :get }, + { :controller => "user_blocks", :action => "edit", :id => "1" } + ) + assert_routing( + { :path => "/user_blocks/1", :method => :put }, + { :controller => "user_blocks", :action => "update", :id => "1" } + ) + assert_routing( + { :path => "/user_blocks/1", :method => :delete }, + { :controller => "user_blocks", :action => "destroy", :id => "1" } + ) + assert_routing( + { :path => "/blocks/1/revoke", :method => :get }, + { :controller => "user_blocks", :action => "revoke", :id => "1" } + ) + assert_routing( + { :path => "/blocks/1/revoke", :method => :post }, + { :controller => "user_blocks", :action => "revoke", :id => "1" } + ) + + assert_routing( + { :path => "/user/username/blocks", :method => :get }, + { :controller => "user_blocks", :action => "blocks_on", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/blocks_by", :method => :get }, + { :controller => "user_blocks", :action => "blocks_by", :display_name => "username" } + ) + end +end diff --git a/test/functional/user_controller_test.rb b/test/functional/user_controller_test.rb index 309eb5e24..24daa1a6c 100644 --- a/test/functional/user_controller_test.rb +++ b/test/functional/user_controller_test.rb @@ -3,6 +3,178 @@ require File.dirname(__FILE__) + '/../test_helper' class UserControllerTest < ActionController::TestCase fixtures :users + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/user/details", :method => :get }, + { :controller => "user", :action => "api_details" } + ) + assert_routing( + { :path => "/api/0.6/user/gpx_files", :method => :get }, + { :controller => "user", :action => "api_gpx_files" } + ) + + assert_routing( + { :path => "/login", :method => :get }, + { :controller => "user", :action => "login" } + ) + assert_routing( + { :path => "/login", :method => :post }, + { :controller => "user", :action => "login" } + ) + assert_recognizes( + { :controller => "user", :action => "login", :format => "html" }, + { :path => "/login.html", :method => :get } + ) + + assert_routing( + { :path => "/logout", :method => :get }, + { :controller => "user", :action => "logout" } + ) + assert_routing( + { :path => "/logout", :method => :post }, + { :controller => "user", :action => "logout" } + ) + assert_recognizes( + { :controller => "user", :action => "logout", :format => "html" }, + { :path => "/logout.html", :method => :get } + ) + + assert_routing( + { :path => "/user/new", :method => :get }, + { :controller => "user", :action => "new" } + ) + assert_recognizes( + { :controller => "user", :action => "new" }, + { :path => "/create-account.html", :method => :get } + ) + + assert_routing( + { :path => "/user/terms", :method => :get }, + { :controller => "user", :action => "terms" } + ) + assert_routing( + { :path => "/user/terms", :method => :post }, + { :controller => "user", :action => "terms" } + ) + + assert_routing( + { :path => "/user/save", :method => :post }, + { :controller => "user", :action => "save" } + ) + + assert_routing( + { :path => "/user/username/confirm", :method => :get }, + { :controller => "user", :action => "confirm", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/confirm", :method => :post }, + { :controller => "user", :action => "confirm", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/confirm/resend", :method => :get }, + { :controller => "user", :action => "confirm_resend", :display_name => "username" } + ) + + assert_routing( + { :path => "/user/confirm", :method => :get }, + { :controller => "user", :action => "confirm" } + ) + assert_routing( + { :path => "/user/confirm", :method => :post }, + { :controller => "user", :action => "confirm" } + ) + assert_routing( + { :path => "/user/confirm-email", :method => :get }, + { :controller => "user", :action => "confirm_email" } + ) + assert_routing( + { :path => "/user/confirm-email", :method => :post }, + { :controller => "user", :action => "confirm_email" } + ) + + assert_routing( + { :path => "/user/go_public", :method => :post }, + { :controller => "user", :action => "go_public" } + ) + + assert_routing( + { :path => "/user/forgot-password", :method => :get }, + { :controller => "user", :action => "lost_password" } + ) + assert_routing( + { :path => "/user/forgot-password", :method => :post }, + { :controller => "user", :action => "lost_password" } + ) + assert_recognizes( + { :controller => "user", :action => "lost_password" }, + { :path => "/forgot-password.html", :method => :get } + ) + assert_routing( + { :path => "/user/reset-password", :method => :get }, + { :controller => "user", :action => "reset_password" } + ) + assert_routing( + { :path => "/user/reset-password", :method => :post }, + { :controller => "user", :action => "reset_password" } + ) + + assert_routing( + { :path => "/user/suspended", :method => :get }, + { :controller => "user", :action => "suspended" } + ) + + assert_routing( + { :path => "/user/username", :method => :get }, + { :controller => "user", :action => "view", :display_name => "username" } + ) + + assert_routing( + { :path => "/user/username/account", :method => :get }, + { :controller => "user", :action => "account", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/account", :method => :post }, + { :controller => "user", :action => "account", :display_name => "username" } + ) + + assert_routing( + { :path => "/user/username/make_friend", :method => :get }, + { :controller => "user", :action => "make_friend", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/remove_friend", :method => :get }, + { :controller => "user", :action => "remove_friend", :display_name => "username" } + ) + + assert_routing( + { :path => "/user/username/set_status", :method => :get }, + { :controller => "user", :action => "set_status", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/delete", :method => :get }, + { :controller => "user", :action => "delete", :display_name => "username" } + ) + + assert_routing( + { :path => "/users", :method => :get }, + { :controller => "user", :action => "list" } + ) + assert_routing( + { :path => "/users", :method => :post }, + { :controller => "user", :action => "list" } + ) + assert_routing( + { :path => "/users/status", :method => :get }, + { :controller => "user", :action => "list", :status => "status" } + ) + assert_routing( + { :path => "/users/status", :method => :post }, + { :controller => "user", :action => "list", :status => "status" } + ) + end + # The user creation page loads def test_user_create_view get :new diff --git a/test/functional/user_preference_controller_test.rb b/test/functional/user_preference_controller_test.rb index 2c6ca446b..3921fe536 100644 --- a/test/functional/user_preference_controller_test.rb +++ b/test/functional/user_preference_controller_test.rb @@ -2,7 +2,32 @@ require File.dirname(__FILE__) + '/../test_helper' class UserPreferenceControllerTest < ActionController::TestCase fixtures :users, :user_preferences - + + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/user/preferences", :method => :get }, + { :controller => "user_preference", :action => "read" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences", :method => :put }, + { :controller => "user_preference", :action => "update" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences/key", :method => :get }, + { :controller => "user_preference", :action => "read_one", :preference_key => "key" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences/key", :method => :put }, + { :controller => "user_preference", :action => "update_one", :preference_key => "key" } + ) + assert_routing( + { :path => "/api/0.6/user/preferences/key", :method => :delete }, + { :controller => "user_preference", :action => "delete_one", :preference_key => "key" } + ) + end + def test_read # first try without auth get :read @@ -21,5 +46,4 @@ class UserPreferenceControllerTest < ActionController::TestCase end end end - end diff --git a/test/functional/user_roles_controller_test.rb b/test/functional/user_roles_controller_test.rb new file mode 100644 index 000000000..1e2d29b45 --- /dev/null +++ b/test/functional/user_roles_controller_test.rb @@ -0,0 +1,24 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class UserRolesControllerTest < ActionController::TestCase + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/user/username/role/rolename/grant", :method => :get }, + { :controller => "user_roles", :action => "grant", :display_name => "username", :role => "rolename" } + ) + assert_routing( + { :path => "/user/username/role/rolename/grant", :method => :post }, + { :controller => "user_roles", :action => "grant", :display_name => "username", :role => "rolename" } + ) + assert_routing( + { :path => "/user/username/role/rolename/revoke", :method => :get }, + { :controller => "user_roles", :action => "revoke", :display_name => "username", :role => "rolename" } + ) + assert_routing( + { :path => "/user/username/role/rolename/revoke", :method => :post }, + { :controller => "user_roles", :action => "revoke", :display_name => "username", :role => "rolename" } + ) + end +end diff --git a/test/functional/way_controller_test.rb b/test/functional/way_controller_test.rb index bba13062c..a4b5a192a 100644 --- a/test/functional/way_controller_test.rb +++ b/test/functional/way_controller_test.rb @@ -4,6 +4,35 @@ require 'way_controller' class WayControllerTest < ActionController::TestCase api_fixtures + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/api/0.6/way/create", :method => :put }, + { :controller => "way", :action => "create" } + ) + assert_routing( + { :path => "/api/0.6/way/1/full", :method => :get }, + { :controller => "way", :action => "full", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/way/1", :method => :get }, + { :controller => "way", :action => "read", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/way/1", :method => :put }, + { :controller => "way", :action => "update", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/way/1", :method => :delete }, + { :controller => "way", :action => "delete", :id => "1" } + ) + assert_routing( + { :path => "/api/0.6/ways", :method => :get }, + { :controller => "way", :action => "ways" } + ) + end + # ------------------------------------- # Test reading ways. # ------------------------------------- diff --git a/test/integration/user_roles_test.rb b/test/integration/user_roles_test.rb index 8bf06374f..17531ef3f 100644 --- a/test/integration/user_roles_test.rb +++ b/test/integration/user_roles_test.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../test_helper' -class UserRolesControllerTest < ActionController::IntegrationTest +class UserRolesTest < ActionController::IntegrationTest fixtures :users, :user_roles test "grant" do diff --git a/test/integration/user_terms_seen_test.rb b/test/integration/user_terms_seen_test.rb index eac5daf24..64a101024 100644 --- a/test/integration/user_terms_seen_test.rb +++ b/test/integration/user_terms_seen_test.rb @@ -39,7 +39,7 @@ class UserTermsSeenTest < ActionController::IntegrationTest assert_response :success # don't agree to the terms, but hit decline - post "/user/#{user.display_name}/save", {'decline' => 'decline', 'referer' => '/'} + post "/user/save", {'decline' => 'decline', 'referer' => '/'} assert_redirected_to "/" follow_redirect!