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:
Eric Davis
2010-04-21 16:02:55 +00:00
parent 0fc884cf42
commit 9b595c689d
15 changed files with 167 additions and 702 deletions
-105
View File
@@ -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