git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3687 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/1.0.0
@@ -34,21 +34,6 @@ class AttachmentsControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_routing | |||
assert_routing('/attachments/1', :controller => 'attachments', :action => 'show', :id => '1') | |||
assert_routing('/attachments/1/filename.ext', :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext') | |||
assert_routing('/attachments/download/1', :controller => 'attachments', :action => 'download', :id => '1') | |||
assert_routing('/attachments/download/1/filename.ext', :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext') | |||
end | |||
def test_recognizes | |||
assert_recognizes({:controller => 'attachments', :action => 'show', :id => '1'}, '/attachments/1') | |||
assert_recognizes({:controller => 'attachments', :action => 'show', :id => '1'}, '/attachments/show/1') | |||
assert_recognizes({:controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'}, '/attachments/1/filename.ext') | |||
assert_recognizes({:controller => 'attachments', :action => 'download', :id => '1'}, '/attachments/download/1') | |||
assert_recognizes({:controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'},'/attachments/download/1/filename.ext') | |||
end | |||
def test_show_diff | |||
get :show, :id => 5 | |||
assert_response :success |
@@ -31,13 +31,6 @@ class BoardsControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_index_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/world_domination/boards'}, | |||
:controller => 'boards', :action => 'index', :project_id => 'world_domination' | |||
) | |||
end | |||
def test_index | |||
get :index, :project_id => 1 | |||
assert_response :success | |||
@@ -60,17 +53,6 @@ class BoardsControllerTest < ActionController::TestCase | |||
assert_not_nil assigns(:topics) | |||
end | |||
def test_new_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/world_domination/boards/new'}, | |||
:controller => 'boards', :action => 'new', :project_id => 'world_domination' | |||
) | |||
assert_recognizes( | |||
{:controller => 'boards', :action => 'new', :project_id => 'world_domination'}, | |||
{:method => :post, :path => '/projects/world_domination/boards'} | |||
) | |||
end | |||
def test_post_new | |||
@request.session[:user_id] = 2 | |||
assert_difference 'Board.count' do | |||
@@ -79,17 +61,6 @@ class BoardsControllerTest < ActionController::TestCase | |||
assert_redirected_to '/projects/ecookbook/settings/boards' | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/world_domination/boards/44'}, | |||
:controller => 'boards', :action => 'show', :id => '44', :project_id => 'world_domination' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/projects/world_domination/boards/44.atom'}, | |||
:controller => 'boards', :action => 'show', :id => '44', :project_id => 'world_domination', :format => 'atom' | |||
) | |||
end | |||
def test_show | |||
get :show, :project_id => 1, :id => 1 | |||
assert_response :success | |||
@@ -108,17 +79,6 @@ class BoardsControllerTest < ActionController::TestCase | |||
assert_not_nil assigns(:messages) | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/world_domination/boards/44/edit'}, | |||
:controller => 'boards', :action => 'edit', :id => '44', :project_id => 'world_domination' | |||
) | |||
assert_recognizes(#TODO: use PUT method to board_path, modify form accordingly | |||
{:controller => 'boards', :action => 'edit', :id => '44', :project_id => 'world_domination'}, | |||
{:method => :post, :path => '/projects/world_domination/boards/44/edit'} | |||
) | |||
end | |||
def test_post_edit | |||
@request.session[:user_id] = 2 | |||
assert_no_difference 'Board.count' do | |||
@@ -128,13 +88,6 @@ class BoardsControllerTest < ActionController::TestCase | |||
assert_equal 'Testing', Board.find(2).name | |||
end | |||
def test_destroy_routing | |||
assert_routing(#TODO: use DELETE method to board_path, modify form accoringly | |||
{:method => :post, :path => '/projects/world_domination/boards/44/destroy'}, | |||
:controller => 'boards', :action => 'destroy', :id => '44', :project_id => 'world_domination' | |||
) | |||
end | |||
def test_post_destroy | |||
@request.session[:user_id] = 2 | |||
assert_difference 'Board.count', -1 do |
@@ -31,13 +31,6 @@ class DocumentsControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_index_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/documents'}, | |||
:controller => 'documents', :action => 'index', :project_id => '567' | |||
) | |||
end | |||
def test_index | |||
# Sets a default category | |||
e = Enumeration.find_by_name('Technical documentation') | |||
@@ -54,17 +47,6 @@ class DocumentsControllerTest < ActionController::TestCase | |||
:content => 'Technical documentation'} | |||
end | |||
def test_new_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/documents/new'}, | |||
:controller => 'documents', :action => 'new', :project_id => '567' | |||
) | |||
assert_recognizes( | |||
{:controller => 'documents', :action => 'new', :project_id => '567'}, | |||
{:method => :post, :path => '/projects/567/documents'} | |||
) | |||
end | |||
def test_new_with_one_attachment | |||
ActionMailer::Base.deliveries.clear | |||
Setting.notified_events << 'document_added' | |||
@@ -87,31 +69,6 @@ class DocumentsControllerTest < ActionController::TestCase | |||
assert_equal 1, ActionMailer::Base.deliveries.size | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
{:method => :get, :path => '/documents/22/edit'}, | |||
:controller => 'documents', :action => 'edit', :id => '22' | |||
) | |||
assert_recognizes(#TODO: should be using PUT on document URI | |||
{:controller => 'documents', :action => 'edit', :id => '567'}, | |||
{:method => :post, :path => '/documents/567/edit'} | |||
) | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/documents/22'}, | |||
:controller => 'documents', :action => 'show', :id => '22' | |||
) | |||
end | |||
def test_destroy_routing | |||
assert_recognizes(#TODO: should be using DELETE on document URI | |||
{:controller => 'documents', :action => 'destroy', :id => '567'}, | |||
{:method => :post, :path => '/documents/567/destroy'} | |||
) | |||
end | |||
def test_destroy | |||
@request.session[:user_id] = 2 | |||
post :destroy, :id => 1 |
@@ -32,17 +32,6 @@ class IssueCategoriesControllerTest < ActionController::TestCase | |||
@request.session[:user_id] = 2 | |||
end | |||
def test_new_routing | |||
assert_routing( | |||
{:method => :get, :path => 'projects/test/issue_categories/new'}, | |||
:controller => 'issue_categories', :action => 'new', :project_id => 'test' | |||
) | |||
assert_routing( | |||
{:method => :post, :path => 'projects/test/issue_categories/new'}, | |||
:controller => 'issue_categories', :action => 'new', :project_id => 'test' | |||
) | |||
end | |||
def test_get_new | |||
@request.session[:user_id] = 2 # manager | |||
get :new, :project_id => '1' |
@@ -25,13 +25,6 @@ class IssueRelationsControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_new_routing | |||
assert_routing( | |||
{:method => :post, :path => '/issues/1/relations'}, | |||
{:controller => 'issue_relations', :action => 'new', :issue_id => '1'} | |||
) | |||
end | |||
def test_new | |||
assert_difference 'IssueRelation.count' do | |||
@request.session[:user_id] = 3 | |||
@@ -69,13 +62,6 @@ class IssueRelationsControllerTest < ActionController::TestCase | |||
end | |||
end | |||
def test_destroy_routing | |||
assert_recognizes( #TODO: use DELETE on issue URI | |||
{:controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23'}, | |||
{:method => :post, :path => '/issues/1/relations/23/destroy'} | |||
) | |||
end | |||
def test_destroy | |||
assert_difference 'IssueRelation.count', -1 do | |||
@request.session[:user_id] = 3 |
@@ -33,13 +33,6 @@ class MembersControllerTest < ActionController::TestCase | |||
@request.session[:user_id] = 2 | |||
end | |||
def test_members_routing | |||
assert_routing( | |||
{:method => :post, :path => 'projects/5234/members/new'}, | |||
:controller => 'members', :action => 'new', :id => '5234' | |||
) | |||
end | |||
def test_create | |||
assert_difference 'Member.count' do | |||
post :new, :id => 1, :member => {:role_ids => [1], :user_id => 7} |
@@ -31,13 +31,6 @@ class MessagesControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/boards/22/topics/2'}, | |||
:controller => 'messages', :action => 'show', :id => '2', :board_id => '22' | |||
) | |||
end | |||
def test_show | |||
get :show, :board_id => 1, :id => 1 | |||
assert_response :success | |||
@@ -77,17 +70,6 @@ class MessagesControllerTest < ActionController::TestCase | |||
assert_response 404 | |||
end | |||
def test_new_routing | |||
assert_routing( | |||
{:method => :get, :path => '/boards/lala/topics/new'}, | |||
:controller => 'messages', :action => 'new', :board_id => 'lala' | |||
) | |||
assert_recognizes(#TODO: POST to collection, need to adjust form accordingly | |||
{:controller => 'messages', :action => 'new', :board_id => 'lala'}, | |||
{:method => :post, :path => '/boards/lala/topics/new'} | |||
) | |||
end | |||
def test_get_new | |||
@request.session[:user_id] = 2 | |||
get :new, :board_id => 1 | |||
@@ -120,17 +102,6 @@ class MessagesControllerTest < ActionController::TestCase | |||
assert mail.bcc.include?('dlopper@somenet.foo') | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
{:method => :get, :path => '/boards/lala/topics/22/edit'}, | |||
:controller => 'messages', :action => 'edit', :board_id => 'lala', :id => '22' | |||
) | |||
assert_recognizes( #TODO: use PUT to topic_path, modify form accordingly | |||
{:controller => 'messages', :action => 'edit', :board_id => 'lala', :id => '22'}, | |||
{:method => :post, :path => '/boards/lala/topics/22/edit'} | |||
) | |||
end | |||
def test_get_edit | |||
@request.session[:user_id] = 2 | |||
get :edit, :board_id => 1, :id => 1 | |||
@@ -149,13 +120,6 @@ class MessagesControllerTest < ActionController::TestCase | |||
assert_equal 'New body', message.content | |||
end | |||
def test_reply_routing | |||
assert_recognizes( | |||
{:controller => 'messages', :action => 'reply', :board_id => '22', :id => '555'}, | |||
{:method => :post, :path => '/boards/22/topics/555/replies'} | |||
) | |||
end | |||
def test_reply | |||
@request.session[:user_id] = 2 | |||
post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } | |||
@@ -164,13 +128,6 @@ class MessagesControllerTest < ActionController::TestCase | |||
assert Message.find_by_subject('Test reply') | |||
end | |||
def test_destroy_routing | |||
assert_recognizes(#TODO: use DELETE to topic_path, adjust form accordingly | |||
{:controller => 'messages', :action => 'destroy', :board_id => '22', :id => '555'}, | |||
{:method => :post, :path => '/boards/22/topics/555/destroy'} | |||
) | |||
end | |||
def test_destroy_topic | |||
@request.session[:user_id] = 2 | |||
post :destroy, :board_id => 1, :id => 1 |
@@ -31,20 +31,6 @@ class NewsControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_index_routing | |||
assert_routing( | |||
{:method => :get, :path => '/news'}, | |||
:controller => 'news', :action => 'index' | |||
) | |||
end | |||
def test_index_routing_formatted | |||
assert_routing( | |||
{:method => :get, :path => '/news.atom'}, | |||
:controller => 'news', :action => 'index', :format => 'atom' | |||
) | |||
end | |||
def test_index | |||
get :index | |||
assert_response :success | |||
@@ -53,20 +39,6 @@ class NewsControllerTest < ActionController::TestCase | |||
assert_nil assigns(:project) | |||
end | |||
def test_index_with_project_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/news'}, | |||
:controller => 'news', :action => 'index', :project_id => '567' | |||
) | |||
end | |||
def test_index_with_project_routing_formatted | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/news.atom'}, | |||
:controller => 'news', :action => 'index', :project_id => '567', :format => 'atom' | |||
) | |||
end | |||
def test_index_with_project | |||
get :index, :project_id => 1 | |||
assert_response :success | |||
@@ -74,13 +46,6 @@ class NewsControllerTest < ActionController::TestCase | |||
assert_not_nil assigns(:newss) | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/news/2'}, | |||
:controller => 'news', :action => 'show', :id => '2' | |||
) | |||
end | |||
def test_show | |||
get :show, :id => 1 | |||
assert_response :success | |||
@@ -93,17 +58,6 @@ class NewsControllerTest < ActionController::TestCase | |||
assert_response 404 | |||
end | |||
def test_new_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/news/new'}, | |||
:controller => 'news', :action => 'new', :project_id => '567' | |||
) | |||
assert_recognizes( | |||
{:controller => 'news', :action => 'new', :project_id => '567'}, | |||
{:method => :post, :path => '/projects/567/news'} | |||
) | |||
end | |||
def test_get_new | |||
@request.session[:user_id] = 2 | |||
get :new, :project_id => 1 | |||
@@ -129,17 +83,6 @@ class NewsControllerTest < ActionController::TestCase | |||
assert_equal 1, ActionMailer::Base.deliveries.size | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
{:method => :get, :path => '/news/234'}, | |||
:controller => 'news', :action => 'show', :id => '234' | |||
) | |||
assert_recognizes(#TODO: PUT to news URI instead, need to modify form | |||
{:controller => 'news', :action => 'edit', :id => '567'}, | |||
{:method => :post, :path => '/news/567/edit'} | |||
) | |||
end | |||
def test_get_edit | |||
@request.session[:user_id] = 2 | |||
get :edit, :id => 1 | |||
@@ -197,13 +140,6 @@ class NewsControllerTest < ActionController::TestCase | |||
assert_equal comments_count - 1, News.find(1).comments.size | |||
end | |||
def test_destroy_routing | |||
assert_recognizes(#TODO: should use DELETE to news URI, need to change form | |||
{:controller => 'news', :action => 'destroy', :id => '567'}, | |||
{:method => :post, :path => '/news/567/destroy'} | |||
) | |||
end | |||
def test_destroy | |||
@request.session[:user_id] = 2 | |||
post :destroy, :id => 1 |
@@ -34,13 +34,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
Setting.default_language = 'en' | |||
end | |||
def test_index_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects'}, | |||
:controller => 'projects', :action => 'index' | |||
) | |||
end | |||
def test_index | |||
get :index | |||
assert_response :success | |||
@@ -59,13 +52,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert_no_tag :a, :content => /Private child of eCookbook/ | |||
end | |||
def test_index_atom_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects.atom'}, | |||
:controller => 'projects', :action => 'index', :format => 'atom' | |||
) | |||
end | |||
def test_index_atom | |||
get :index, :format => 'atom' | |||
assert_response :success | |||
@@ -74,21 +60,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert_select 'feed>entry', :count => Project.count(:conditions => Project.visible_by(User.current)) | |||
end | |||
def test_add_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/new'}, | |||
:controller => 'projects', :action => 'add' | |||
) | |||
assert_recognizes( | |||
{:controller => 'projects', :action => 'add'}, | |||
{:method => :post, :path => '/projects/new'} | |||
) | |||
assert_recognizes( | |||
{:controller => 'projects', :action => 'add'}, | |||
{:method => :post, :path => '/projects'} | |||
) | |||
end | |||
context "#add" do | |||
context "by admin user" do | |||
setup do | |||
@@ -248,13 +219,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
end | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/test'}, | |||
:controller => 'projects', :action => 'show', :id => 'test' | |||
) | |||
end | |||
def test_show_by_id | |||
get :show, :id => 1 | |||
assert_response :success | |||
@@ -295,17 +259,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert_tag :tag => 'a', :content => /Private child/ | |||
end | |||
def test_settings_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/4223/settings'}, | |||
:controller => 'projects', :action => 'settings', :id => '4223' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/projects/4223/settings/members'}, | |||
:controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' | |||
) | |||
end | |||
def test_settings | |||
@request.session[:user_id] = 2 # manager | |||
get :settings, :id => 1 | |||
@@ -313,13 +266,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert_template 'settings' | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
{:method => :post, :path => '/projects/4223/edit'}, | |||
:controller => 'projects', :action => 'edit', :id => '4223' | |||
) | |||
end | |||
def test_edit | |||
@request.session[:user_id] = 2 # manager | |||
post :edit, :id => 1, :project => {:name => 'Test changed name', | |||
@@ -329,18 +275,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert_equal 'Test changed name', project.name | |||
end | |||
def test_destroy_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/destroy'}, | |||
:controller => 'projects', :action => 'destroy', :id => '567' | |||
) | |||
assert_routing( | |||
#TODO: use DELETE and update form | |||
{:method => :post, :path => 'projects/64/destroy'}, | |||
:controller => 'projects', :action => 'destroy', :id => '64' | |||
) | |||
end | |||
def test_get_destroy | |||
@request.session[:user_id] = 1 # admin | |||
get :destroy, :id => 1 | |||
@@ -377,17 +311,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert mail.body.include?('testfile.txt') | |||
end | |||
def test_add_file_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/33/files/new'}, | |||
:controller => 'projects', :action => 'add_file', :id => '33' | |||
) | |||
assert_routing( | |||
{:method => :post, :path => '/projects/33/files/new'}, | |||
:controller => 'projects', :action => 'add_file', :id => '33' | |||
) | |||
end | |||
def test_add_version_file | |||
set_tmp_attachments_directory | |||
@request.session[:user_id] = 2 | |||
@@ -418,20 +341,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
:attributes => { :href => '/attachments/download/9/version_file.zip' } | |||
end | |||
def test_list_files_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/33/files'}, | |||
:controller => 'projects', :action => 'list_files', :id => '33' | |||
) | |||
end | |||
def test_roadmap_routing | |||
assert_routing( | |||
{:method => :get, :path => 'projects/33/roadmap'}, | |||
:controller => 'projects', :action => 'roadmap', :id => '33' | |||
) | |||
end | |||
def test_roadmap | |||
get :roadmap, :id => 1 | |||
assert_response :success | |||
@@ -462,21 +371,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
# Version on subproject appears | |||
assert assigns(:versions).include?(Version.find(4)) | |||
end | |||
def test_project_activity_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/1/activity'}, | |||
:controller => 'projects', :action => 'activity', :id => '1' | |||
) | |||
end | |||
def test_project_activity_atom_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/1/activity.atom'}, | |||
:controller => 'projects', :action => 'activity', :id => '1', :format => 'atom' | |||
) | |||
end | |||
def test_project_activity | |||
get :activity, :id => 1, :with_subprojects => 0 | |||
assert_response :success | |||
@@ -513,10 +407,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
} | |||
end | |||
def test_global_activity_routing | |||
assert_routing({:method => :get, :path => '/activity'}, :controller => 'projects', :action => 'activity', :id => nil) | |||
end | |||
def test_global_activity | |||
get :activity | |||
assert_response :success | |||
@@ -553,24 +443,12 @@ class ProjectsControllerTest < ActionController::TestCase | |||
} | |||
end | |||
def test_global_activity_atom_routing | |||
assert_routing({:method => :get, :path => '/activity.atom'}, :controller => 'projects', :action => 'activity', :id => nil, :format => 'atom') | |||
end | |||
def test_activity_atom_feed | |||
get :activity, :format => 'atom' | |||
assert_response :success | |||
assert_template 'common/feed.atom.rxml' | |||
end | |||
def test_archive_routing | |||
assert_routing( | |||
#TODO: use PUT to project path and modify form | |||
{:method => :post, :path => 'projects/64/archive'}, | |||
:controller => 'projects', :action => 'archive', :id => '64' | |||
) | |||
end | |||
def test_archive | |||
@request.session[:user_id] = 1 # admin | |||
post :archive, :id => 1 | |||
@@ -578,14 +456,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert !Project.find(1).active? | |||
end | |||
def test_unarchive_routing | |||
assert_routing( | |||
#TODO: use PUT to project path and modify form | |||
{:method => :post, :path => '/projects/567/unarchive'}, | |||
:controller => 'projects', :action => 'unarchive', :id => '567' | |||
) | |||
end | |||
def test_unarchive | |||
@request.session[:user_id] = 1 # admin | |||
Project.find(1).archive | |||
@@ -643,11 +513,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert_template 'show' | |||
end | |||
def test_reset_activities_routing | |||
assert_routing({:method => :delete, :path => 'projects/64/reset_activities'}, | |||
:controller => 'projects', :action => 'reset_activities', :id => '64') | |||
end | |||
def test_reset_activities | |||
@request.session[:user_id] = 2 # manager | |||
project_activity = TimeEntryActivity.new({ | |||
@@ -694,11 +559,6 @@ class ProjectsControllerTest < ActionController::TestCase | |||
assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size, "TimeEntries still assigned to project specific activity" | |||
end | |||
def test_save_activities_routing | |||
assert_routing({:method => :post, :path => 'projects/64/activities/save'}, | |||
:controller => 'projects', :action => 'save_activities', :id => '64') | |||
end | |||
def test_save_activities_to_override_system_activities | |||
@request.session[:user_id] = 2 # manager | |||
billable_field = TimeEntryActivityCustomField.find_by_name("Billable") |
@@ -31,38 +31,6 @@ class RepositoriesControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/redmine/repository'}, | |||
:controller => 'repositories', :action => 'show', :id => 'redmine' | |||
) | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/world_domination/repository/edit'}, | |||
:controller => 'repositories', :action => 'edit', :id => 'world_domination' | |||
) | |||
assert_routing( | |||
{:method => :post, :path => '/projects/world_domination/repository/edit'}, | |||
:controller => 'repositories', :action => 'edit', :id => 'world_domination' | |||
) | |||
end | |||
def test_revisions_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/redmine/repository/revisions'}, | |||
:controller => 'repositories', :action => 'revisions', :id => 'redmine' | |||
) | |||
end | |||
def test_revisions_atom_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/redmine/repository/revisions.atom'}, | |||
:controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' | |||
) | |||
end | |||
def test_revisions | |||
get :revisions, :id => 1 | |||
assert_response :success | |||
@@ -70,13 +38,6 @@ class RepositoriesControllerTest < ActionController::TestCase | |||
assert_not_nil assigns(:changesets) | |||
end | |||
def test_revision_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/revisions/2457'}, | |||
:controller => 'repositories', :action => 'revision', :id => 'restmine', :rev => '2457' | |||
) | |||
end | |||
def test_revision | |||
get :revision, :id => 1, :rev => 1 | |||
assert_response :success | |||
@@ -96,90 +57,6 @@ class RepositoriesControllerTest < ActionController::TestCase | |||
} | |||
end | |||
def test_diff_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/revisions/2457/diff'}, | |||
:controller => 'repositories', :action => 'diff', :id => 'restmine', :rev => '2457' | |||
) | |||
end | |||
def test_unified_diff_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/revisions/2457/diff.diff'}, | |||
:controller => 'repositories', :action => 'diff', :id => 'restmine', :rev => '2457', :format => 'diff' | |||
) | |||
end | |||
def test_diff_path_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/diff/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'diff', :id => 'restmine', :path => %w[path to file.c] | |||
) | |||
end | |||
def test_diff_path_routing_with_revision | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/revisions/2/diff/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'diff', :id => 'restmine', :path => %w[path to file.c], :rev => '2' | |||
) | |||
end | |||
def test_browse_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/browse/path/to/dir'}, | |||
:controller => 'repositories', :action => 'browse', :id => 'restmine', :path => %w[path to dir] | |||
) | |||
end | |||
def test_entry_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/entry/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c] | |||
) | |||
end | |||
def test_entry_routing_with_revision | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/revisions/2/entry/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c], :rev => '2' | |||
) | |||
end | |||
def test_raw_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/raw/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c], :format => 'raw' | |||
) | |||
end | |||
def test_raw_routing_with_revision | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/revisions/2/raw/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'entry', :id => 'restmine', :path => %w[path to file.c], :format => 'raw', :rev => '2' | |||
) | |||
end | |||
def test_annotate_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/annotate/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'annotate', :id => 'restmine', :path => %w[path to file.c] | |||
) | |||
end | |||
def test_changesrouting | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/changes/path/to/file.c'}, | |||
:controller => 'repositories', :action => 'changes', :id => 'restmine', :path => %w[path to file.c] | |||
) | |||
end | |||
def test_statistics_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/restmine/repository/statistics'}, | |||
:controller => 'repositories', :action => 'stats', :id => 'restmine' | |||
) | |||
end | |||
def test_graph_commits_per_month | |||
get :graph, :id => 1, :graph => 'commits_per_month' | |||
assert_response :success |
@@ -31,28 +31,6 @@ class TimelogControllerTest < ActionController::TestCase | |||
@response = ActionController::TestResponse.new | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
{:method => :get, :path => '/issues/567/time_entries/new'}, | |||
:controller => 'timelog', :action => 'edit', :issue_id => '567' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/projects/ecookbook/time_entries/new'}, | |||
:controller => 'timelog', :action => 'edit', :project_id => 'ecookbook' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/projects/ecookbook/issues/567/time_entries/new'}, | |||
:controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567' | |||
) | |||
#TODO: change new form to POST to issue_time_entries_path instead of to edit action | |||
#TODO: change edit form to PUT to time_entry_path | |||
assert_routing( | |||
{:method => :get, :path => '/time_entries/22/edit'}, | |||
:controller => 'timelog', :action => 'edit', :id => '22' | |||
) | |||
end | |||
def test_get_edit | |||
@request.session[:user_id] = 3 | |||
get :edit, :project_id => 1 | |||
@@ -134,14 +112,6 @@ class TimelogControllerTest < ActionController::TestCase | |||
assert_equal 2, entry.user_id | |||
end | |||
def test_destroy_routing | |||
#TODO: use DELETE to time_entry_path | |||
assert_routing( | |||
{:method => :post, :path => '/time_entries/55/destroy'}, | |||
:controller => 'timelog', :action => 'destroy', :id => '55' | |||
) | |||
end | |||
def test_destroy | |||
@request.session[:user_id] = 2 | |||
post :destroy, :id => 1 | |||
@@ -149,30 +119,12 @@ class TimelogControllerTest < ActionController::TestCase | |||
assert_nil TimeEntry.find_by_id(1) | |||
end | |||
def test_report_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/time_entries/report'}, | |||
:controller => 'timelog', :action => 'report', :project_id => '567' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/time_entries/report.csv'}, | |||
:controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv' | |||
) | |||
end | |||
def test_report_no_criteria | |||
get :report, :project_id => 1 | |||
assert_response :success | |||
assert_template 'report' | |||
end | |||
def test_report_routing_for_all_projects | |||
assert_routing( | |||
{:method => :get, :path => '/time_entries/report'}, | |||
:controller => 'timelog', :action => 'report' | |||
) | |||
end | |||
def test_report_all_projects | |||
get :report | |||
assert_response :success | |||
@@ -302,13 +254,6 @@ class TimelogControllerTest < ActionController::TestCase | |||
assert_equal "162.90", "%.2f" % assigns(:total_hours) | |||
end | |||
def test_project_details_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/time_entries'}, | |||
:controller => 'timelog', :action => 'details', :project_id => '567' | |||
) | |||
end | |||
def test_details_at_project_level | |||
get :details, :project_id => 1 | |||
assert_response :success | |||
@@ -354,23 +299,6 @@ class TimelogControllerTest < ActionController::TestCase | |||
assert_equal "4.25", "%.2f" % assigns(:total_hours) | |||
end | |||
def test_issue_details_routing | |||
assert_routing( | |||
{:method => :get, :path => 'time_entries'}, | |||
:controller => 'timelog', :action => 'details' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/issues/234/time_entries'}, | |||
:controller => 'timelog', :action => 'details', :issue_id => '234' | |||
) | |||
# TODO: issue detail page shouldnt link to project_issue_time_entries_path but to normal issues one | |||
# doesnt seem to have effect on resulting page so controller can be left untouched | |||
assert_routing( | |||
{:method => :get, :path => '/projects/ecookbook/issues/123/time_entries'}, | |||
:controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123' | |||
) | |||
end | |||
def test_details_at_issue_level | |||
get :details, :issue_id => 1 | |||
assert_response :success | |||
@@ -384,39 +312,6 @@ class TimelogControllerTest < ActionController::TestCase | |||
assert_equal '2007-04-22'.to_date, assigns(:to) | |||
end | |||
def test_details_formatted_routing | |||
assert_routing( | |||
{:method => :get, :path => 'time_entries.atom'}, | |||
:controller => 'timelog', :action => 'details', :format => 'atom' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => 'time_entries.csv'}, | |||
:controller => 'timelog', :action => 'details', :format => 'csv' | |||
) | |||
end | |||
def test_details_for_project_formatted_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/time_entries.atom'}, | |||
:controller => 'timelog', :action => 'details', :format => 'atom', :project_id => '567' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/projects/567/time_entries.csv'}, | |||
:controller => 'timelog', :action => 'details', :format => 'csv', :project_id => '567' | |||
) | |||
end | |||
def test_details_for_issue_formatted_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/ecookbook/issues/123/time_entries.atom'}, | |||
:controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123', :format => 'atom' | |||
) | |||
assert_routing( | |||
{:method => :get, :path => '/projects/ecookbook/issues/123/time_entries.csv'}, | |||
:controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123', :format => 'csv' | |||
) | |||
end | |||
def test_details_atom_feed | |||
get :details, :project_id => 1, :format => 'atom' | |||
assert_response :success |
@@ -31,14 +31,6 @@ class WikisControllerTest < ActionController::TestCase | |||
User.current = nil | |||
end | |||
def test_edit_routing | |||
assert_routing( | |||
#TODO: use PUT | |||
{:method => :post, :path => 'projects/ladida/wiki'}, | |||
:controller => 'wikis', :action => 'edit', :id => 'ladida' | |||
) | |||
end | |||
def test_create | |||
@request.session[:user_id] = 1 | |||
assert_nil Project.find(3).wiki | |||
@@ -49,17 +41,6 @@ class WikisControllerTest < ActionController::TestCase | |||
assert_equal 'Start page', wiki.start_page | |||
end | |||
def test_destroy_routing | |||
assert_routing( | |||
{:method => :get, :path => 'projects/ladida/wiki/destroy'}, | |||
:controller => 'wikis', :action => 'destroy', :id => 'ladida' | |||
) | |||
assert_recognizes( #TODO: use DELETE and update form | |||
{:controller => 'wikis', :action => 'destroy', :id => 'ladida'}, | |||
{:method => :post, :path => 'projects/ladida/wiki/destroy'} | |||
) | |||
end | |||
def test_destroy | |||
@request.session[:user_id] = 1 | |||
post :destroy, :id => 1, :confirm => 1 |
@@ -46,13 +46,6 @@ class IssuesApiTest < ActionController::IntegrationTest | |||
Setting.rest_api_enabled = '1' | |||
end | |||
def test_index_routing | |||
assert_routing( | |||
{:method => :get, :path => '/issues.xml'}, | |||
:controller => 'issues', :action => 'index', :format => 'xml' | |||
) | |||
end | |||
def test_index | |||
get '/issues.xml' | |||
assert_response :success | |||
@@ -68,26 +61,12 @@ class IssuesApiTest < ActionController::IntegrationTest | |||
:only => { :tag => 'issue' } } | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/issues/1.xml'}, | |||
:controller => 'issues', :action => 'show', :id => '1', :format => 'xml' | |||
) | |||
end | |||
def test_show | |||
get '/issues/1.xml' | |||
assert_response :success | |||
assert_equal 'application/xml', @response.content_type | |||
end | |||
def test_create_routing | |||
assert_routing( | |||
{:method => :post, :path => '/issues.xml'}, | |||
:controller => 'issues', :action => 'new', :format => 'xml' | |||
) | |||
end | |||
def test_create | |||
attributes = {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3} | |||
assert_difference 'Issue.count' do | |||
@@ -111,13 +90,6 @@ class IssuesApiTest < ActionController::IntegrationTest | |||
assert_tag :errors, :child => {:tag => 'error', :content => "Subject can't be blank"} | |||
end | |||
def test_update_routing | |||
assert_routing( | |||
{:method => :put, :path => '/issues/1.xml'}, | |||
:controller => 'issues', :action => 'update', :id => '1', :format => 'xml' | |||
) | |||
end | |||
def test_update | |||
attributes = {:subject => 'API update'} | |||
assert_no_difference 'Issue.count' do | |||
@@ -145,13 +117,6 @@ class IssuesApiTest < ActionController::IntegrationTest | |||
assert_tag :errors, :child => {:tag => 'error', :content => "Subject can't be blank"} | |||
end | |||
def test_destroy_routing | |||
assert_routing( | |||
{:method => :delete, :path => '/issues/1.xml'}, | |||
:controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' | |||
) | |||
end | |||
def test_destroy | |||
assert_difference 'Issue.count', -1 do | |||
delete '/issues/1.xml', {}, :authorization => credentials('jsmith') |
@@ -26,39 +26,18 @@ class ProjectsApiTest < ActionController::IntegrationTest | |||
Setting.rest_api_enabled = '1' | |||
end | |||
def test_index_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects.xml'}, | |||
:controller => 'projects', :action => 'index', :format => 'xml' | |||
) | |||
end | |||
def test_index | |||
get '/projects.xml' | |||
assert_response :success | |||
assert_equal 'application/xml', @response.content_type | |||
end | |||
def test_show_routing | |||
assert_routing( | |||
{:method => :get, :path => '/projects/1.xml'}, | |||
:controller => 'projects', :action => 'show', :id => '1', :format => 'xml' | |||
) | |||
end | |||
def test_show | |||
get '/projects/1.xml' | |||
assert_response :success | |||
assert_equal 'application/xml', @response.content_type | |||
end | |||
def test_create_routing | |||
assert_routing( | |||
{:method => :post, :path => '/projects.xml'}, | |||
:controller => 'projects', :action => 'add', :format => 'xml' | |||
) | |||
end | |||
def test_create | |||
attributes = {:name => 'API test', :identifier => 'api-test'} | |||
assert_difference 'Project.count' do | |||
@@ -82,13 +61,6 @@ class ProjectsApiTest < ActionController::IntegrationTest | |||
assert_tag :errors, :child => {:tag => 'error', :content => "Identifier can't be blank"} | |||
end | |||
def test_update_routing | |||
assert_routing( | |||
{:method => :put, :path => '/projects/1.xml'}, | |||
:controller => 'projects', :action => 'edit', :id => '1', :format => 'xml' | |||
) | |||
end | |||
def test_update | |||
attributes = {:name => 'API update'} | |||
assert_no_difference 'Project.count' do | |||
@@ -112,13 +84,6 @@ class ProjectsApiTest < ActionController::IntegrationTest | |||
assert_tag :errors, :child => {:tag => 'error', :content => "Name can't be blank"} | |||
end | |||
def test_destroy_routing | |||
assert_routing( | |||
{:method => :delete, :path => '/projects/1.xml'}, | |||
:controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' | |||
) | |||
end | |||
def test_destroy | |||
assert_difference 'Project.count', -1 do | |||
delete '/projects/2.xml', {}, :authorization => credentials('admin') |
@@ -18,6 +18,42 @@ | |||
require "#{File.dirname(__FILE__)}/../test_helper" | |||
class RoutingTest < ActionController::IntegrationTest | |||
context "activities" do | |||
should_route :get, "/activity", :controller => 'projects', :action => 'activity', :id => nil | |||
should_route :get, "/activity.atom", :controller => 'projects', :action => 'activity', :id => nil, :format => 'atom' | |||
end | |||
context "attachments" do | |||
should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1' | |||
should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext' | |||
should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' | |||
should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' | |||
end | |||
context "boards" do | |||
should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' | |||
should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |||
should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44' | |||
should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom' | |||
should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' | |||
should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' | |||
should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' | |||
should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' | |||
end | |||
context "documents" do | |||
should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567' | |||
should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' | |||
should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22' | |||
should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22' | |||
should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567' | |||
should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' | |||
should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' | |||
end | |||
context "issues" do | |||
# REST actions | |||
should_route :get, "/issues", :controller => 'issues', :action => 'index' | |||
@@ -34,13 +70,16 @@ class RoutingTest < ActionController::IntegrationTest | |||
should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml' | |||
should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' | |||
should_route :post, "/issues.xml", :controller => 'issues', :action => 'new', :format => 'xml' | |||
should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' | |||
# TODO: Should use PUT | |||
should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' | |||
should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml' | |||
# TODO: Should use DELETE | |||
should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' | |||
should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' | |||
# Extra actions | |||
should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' | |||
@@ -62,12 +101,132 @@ class RoutingTest < ActionController::IntegrationTest | |||
should_route :get, "/issues/auto_complete", :controller => 'issues', :action => 'auto_complete' | |||
end | |||
context "issue categories" do | |||
should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' | |||
should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' | |||
end | |||
context "issue relations" do | |||
should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' | |||
should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' | |||
end | |||
context "issue reports" do | |||
should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' | |||
should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' | |||
end | |||
context "members" do | |||
should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234' | |||
end | |||
context "messages" do | |||
should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' | |||
should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |||
should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |||
should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' | |||
should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' | |||
should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' | |||
should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' | |||
end | |||
context "news" do | |||
should_route :get, "/news", :controller => 'news', :action => 'index' | |||
should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' | |||
should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' | |||
should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' | |||
should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' | |||
should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' | |||
should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567' | |||
should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567' | |||
should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2' | |||
should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' | |||
should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' | |||
should_route :post, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567' | |||
should_route :post, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' | |||
should_route :post, "/news/567/destroy", :controller => 'news', :action => 'destroy', :id => '567' | |||
end | |||
context "projects" do | |||
should_route :get, "/projects", :controller => 'projects', :action => 'index' | |||
should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom' | |||
should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml' | |||
should_route :get, "/projects/new", :controller => 'projects', :action => 'add' | |||
should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test' | |||
should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml' | |||
should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223' | |||
should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members' | |||
should_route :get, "/projects/567/destroy", :controller => 'projects', :action => 'destroy', :id => '567' | |||
should_route :get, "/projects/33/files", :controller => 'projects', :action => 'list_files', :id => '33' | |||
should_route :get, "/projects/33/files/new", :controller => 'projects', :action => 'add_file', :id => '33' | |||
should_route :get, "/projects/33/roadmap", :controller => 'projects', :action => 'roadmap', :id => '33' | |||
should_route :get, "/projects/33/activity", :controller => 'projects', :action => 'activity', :id => '33' | |||
should_route :get, "/projects/33/activity.atom", :controller => 'projects', :action => 'activity', :id => '33', :format => 'atom' | |||
should_route :post, "/projects/new", :controller => 'projects', :action => 'add' | |||
should_route :post, "/projects.xml", :controller => 'projects', :action => 'add', :format => 'xml' | |||
should_route :post, "/projects/4223/edit", :controller => 'projects', :action => 'edit', :id => '4223' | |||
should_route :post, "/projects/64/destroy", :controller => 'projects', :action => 'destroy', :id => '64' | |||
should_route :post, "/projects/33/files/new", :controller => 'projects', :action => 'add_file', :id => '33' | |||
should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64' | |||
should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64' | |||
should_route :post, "/projects/64/activities/save", :controller => 'projects', :action => 'save_activities', :id => '64' | |||
should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'edit', :id => '1', :format => 'xml' | |||
should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml' | |||
should_route :delete, "/projects/64/reset_activities", :controller => 'projects', :action => 'reset_activities', :id => '64' | |||
end | |||
context "repositories" do | |||
should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine' | |||
should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |||
should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine' | |||
should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom' | |||
should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457' | |||
should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457' | |||
should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff' | |||
should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c] | |||
should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2' | |||
should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c] | |||
should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c] | |||
should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2' | |||
should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw' | |||
should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw' | |||
should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] | |||
should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] | |||
should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' | |||
should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' | |||
end | |||
context "timelogs" do | |||
should_route :get, "/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :issue_id => '567' | |||
should_route :get, "/projects/ecookbook/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook' | |||
should_route :get, "/projects/ecookbook/issues/567/time_entries/new", :controller => 'timelog', :action => 'edit', :project_id => 'ecookbook', :issue_id => '567' | |||
should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22' | |||
should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report' | |||
should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567' | |||
should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv' | |||
should_route :get, "/time_entries", :controller => 'timelog', :action => 'details' | |||
should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'details', :format => 'csv' | |||
should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'details', :format => 'atom' | |||
should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'details', :project_id => '567' | |||
should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'csv' | |||
should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'details', :project_id => '567', :format => 'atom' | |||
should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'details', :issue_id => '234' | |||
should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'csv' | |||
should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'details', :issue_id => '234', :format => 'atom' | |||
should_route :get, "/projects/ecookbook/issues/123/time_entries", :controller => 'timelog', :action => 'details', :project_id => 'ecookbook', :issue_id => '123' | |||
should_route :post, "/time_entries/55/destroy", :controller => 'timelog', :action => 'destroy', :id => '55' | |||
end | |||
context "users" do | |||
should_route :get, "/users", :controller => 'users', :action => 'index' | |||
should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' | |||
@@ -88,7 +247,7 @@ class RoutingTest < ActionController::IntegrationTest | |||
should_route :post, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' | |||
end | |||
context "wikis" do | |||
context "wiki (singular, project's pages)" do | |||
should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'index', :id => '567' | |||
should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'index', :id => '567', :page => 'lalala' | |||
should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :id => '567', :page => 'my_page' | |||
@@ -108,6 +267,13 @@ class RoutingTest < ActionController::IntegrationTest | |||
should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :id => '22', :page => 'ladida' | |||
end | |||
context "wikis (plural, admin setup)" do | |||
should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |||
should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' | |||
should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' | |||
end | |||
context "administration panel" do | |||
should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' | |||
end |