Refactor: Move the rest of the routing tests to RoutingTest.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3687 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user