fixes timelog routes

* time_entries scoped under project and issues have been removed
pull/1186/head
Jens Ulferts 12 years ago
parent d242e8296a
commit dfbc8aee7f
  1. 7
      config/routes.rb
  2. 169
      test/integration/routing_test.rb

@ -34,8 +34,6 @@ OpenProject::Application.routes.draw do
match '/time_entries/report(.:format)'
end
resources :time_entries, :controller => 'timelog'
match '/projects/:id/wiki' => 'wikis#edit', :via => :post
match '/projects/:id/wiki/destroy' => 'wikis#destroy', :via => [:get, :post]
@ -123,7 +121,7 @@ OpenProject::Application.routes.draw do
match '/roadmap' => 'versions#index', :via => :get
resources :news, :shallow => true
resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
resources :time_entries, :controller => 'timelog'
resources :wiki, :except => [:index, :new, :create] do
collection do
@ -241,6 +239,8 @@ OpenProject::Application.routes.draw do
match '/projects/:id/issues/report/:detail', :action => :issue_report_details
end
resources :time_entries, :controller => 'timelog'
resources :activity, :activities, :only => :index, :controller => 'activities'
scope :controller => 'issue_relations', :via => :post do
@ -323,7 +323,6 @@ OpenProject::Application.routes.draw do
match '/boards/:board_id/topics/:action/:id', :controller => 'messages'
match '/issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
match '/projects/:project_id/news/:action', :controller => 'news'
match '/projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
scope :controller => 'repositories' do
match '/repositories/browse/:id/*path', :action => 'browse', :as => 'repositories_show'
match '/repositories/changes/:id/*path', :action => 'changes', :as => 'repositories_changes'

@ -428,67 +428,114 @@ class RoutingTest < ActionController::IntegrationTest
# should route(:post, "/projects/redmine/repository/edit").to( :controller => 'repositories', :action => 'edit', :id => 'redmine')
end
#
# context "timelogs (global)" do
# should route(:get, "/time_entries").to( :controller => 'timelog', :action => 'index')
# should route(:get, "/time_entries.csv").to( :controller => 'timelog', :action => 'index', :format => 'csv')
# should route(:get, "/time_entries.atom").to( :controller => 'timelog', :action => 'index', :format => 'atom')
# should route(:get, "/time_entries/new").to( :controller => 'timelog', :action => 'new')
# should route(:get, "/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22')
#
# should route(:post, "/time_entries").to( :controller => 'timelog', :action => 'create')
#
# should route(:put, "/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22')
#
# should route(:delete, "/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55')
# end
#
# context "timelogs (scoped under project)" do
# should route(:get, "/projects/567/time_entries").to( :controller => 'timelog', :action => 'index', :project_id => '567')
# should route(:get, "/projects/567/time_entries.csv").to( :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv')
# should route(:get, "/projects/567/time_entries.atom").to( :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom')
# should route(:get, "/projects/567/time_entries/new").to( :controller => 'timelog', :action => 'new', :project_id => '567')
# should route(:get, "/projects/567/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567')
#
# should route(:post, "/projects/567/time_entries").to( :controller => 'timelog', :action => 'create', :project_id => '567')
#
# should route(:put, "/projects/567/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567')
#
# should route(:delete, "/projects/567/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567')
# end
#
# context "timelogs (scoped under issues)" do
# should route(:get, "/issues/234/time_entries").to( :controller => 'timelog', :action => 'index', :issue_id => '234')
# should route(:get, "/issues/234/time_entries.csv").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv')
# should route(:get, "/issues/234/time_entries.atom").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom')
# should route(:get, "/issues/234/time_entries/new").to( :controller => 'timelog', :action => 'new', :issue_id => '234')
# should route(:get, "/issues/234/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234')
#
# should route(:post, "/issues/234/time_entries").to( :controller => 'timelog', :action => 'create', :issue_id => '234')
#
# should route(:put, "/issues/234/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234')
#
# should route(:delete, "/issues/234/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234')
# end
#
# context "timelogs (scoped under project and issues)" do
# should route(:get, "/projects/ecookbook/issues/234/time_entries").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook')
# should route(:get, "/projects/ecookbook/issues/234/time_entries.csv").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv')
# should route(:get, "/projects/ecookbook/issues/234/time_entries.atom").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom')
# should route(:get, "/projects/ecookbook/issues/234/time_entries/new").to( :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook')
# should route(:get, "/projects/ecookbook/issues/234/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook')
#
# should route(:post, "/projects/ecookbook/issues/234/time_entries").to( :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook')
#
# should route(:put, "/projects/ecookbook/issues/234/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook')
#
# should route(:delete, "/projects/ecookbook/issues/234/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook')
# end
#
# context "time_entry_reports" do
# should route(:get, "/time_entries/report").to( :controller => 'time_entry_reports', :action => 'report')
# should route(:get, "/projects/567/time_entries/report").to( :controller => 'time_entry_reports', :action => 'report', :project_id => '567')
# should route(:get, "/projects/567/time_entries/report.csv").to( :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv')
# end
context "timelogs" do
should route(:get, "/time_entries").to( :controller => 'timelog',
:action => 'index' )
should route(:get, "/time_entries.csv").to( :controller => 'timelog',
:action => 'index',
:format => 'csv' )
should route(:get, "/time_entries.atom").to( :controller => 'timelog',
:action => 'index',
:format => 'atom' )
should route(:get, "/time_entries/new").to( :controller => 'timelog',
:action => 'new' )
should route(:get, "/time_entries/22/edit").to( :controller => 'timelog',
:action => 'edit',
:id => '22' )
should route(:post, "/time_entries").to( :controller => 'timelog',
:action => 'create' )
should route(:put, "/time_entries/22").to( :controller => 'timelog',
:action => 'update',
:id => '22' )
should route(:delete, "/time_entries/55").to( :controller => 'timelog',
:action => 'destroy',
:id => '55' )
context "project scoped" do
should route(:get, "/projects/567/time_entries").to( :controller => 'timelog',
:action => 'index',
:project_id => '567' )
should route(:get, "/projects/567/time_entries.csv").to( :controller => 'timelog',
:action => 'index',
:project_id => '567',
:format => 'csv' )
should route(:get, "/projects/567/time_entries.atom").to( :controller => 'timelog',
:action => 'index',
:project_id => '567',
:format => 'atom' )
should route(:get, "/projects/567/time_entries/new").to( :controller => 'timelog',
:action => 'new',
:project_id => '567' )
should route(:get, "/projects/567/time_entries/22/edit").to( :controller => 'timelog',
:action => 'edit',
:id => '22',
:project_id => '567' )
should route(:post, "/projects/567/time_entries").to( :controller => 'timelog',
:action => 'create',
:project_id => '567' )
should route(:put, "/projects/567/time_entries/22").to( :controller => 'timelog',
:action => 'update',
:id => '22',
:project_id => '567' )
should route(:delete, "/projects/567/time_entries/55").to( :controller => 'timelog',
:action => 'destroy',
:id => '55',
:project_id => '567' )
end
context "issue scoped" do
should route(:get, "/issues/234/time_entries").to( :controller => 'timelog',
:action => 'index',
:issue_id => '234' )
should route(:get, "/issues/234/time_entries.csv").to( :controller => 'timelog',
:action => 'index',
:issue_id => '234',
:format => 'csv' )
should route(:get, "/issues/234/time_entries.atom").to( :controller => 'timelog',
:action => 'index',
:issue_id => '234',
:format => 'atom' )
should route(:get, "/issues/234/time_entries/new").to( :controller => 'timelog',
:action => 'new',
:issue_id => '234' )
should route(:get, "/issues/234/time_entries/22/edit").to( :controller => 'timelog',
:action => 'edit',
:id => '22',
:issue_id => '234' )
should route(:post, "/issues/234/time_entries").to( :controller => 'timelog',
:action => 'create',
:issue_id => '234' )
should route(:put, "/issues/234/time_entries/22").to( :controller => 'timelog',
:action => 'update',
:id => '22',
:issue_id => '234' )
should route(:delete, "/issues/234/time_entries/55").to( :controller => 'timelog',
:action => 'destroy',
:id => '55',
:issue_id => '234' )
end
end
#
# context "users" do
# should route(:get, "/users").to( :controller => 'users', :action => 'index')

Loading…
Cancel
Save