test test

This commit is contained in:
yanxd 2014-07-15 10:27:24 +08:00
parent ba3d1755d4
commit 37d0560b70
2 changed files with 70 additions and 2 deletions

View File

@ -577,7 +577,6 @@ RedmineApp::Application.routes.draw do
end
end
match 'projects/course', :to => 'courses#course', :as => 'courses_course'
match 'courses/search', :to => 'courses#search'
# add by nwb
# 课程路由设置

View File

@ -21,7 +21,76 @@ class RoutingProjectsTest < ActionController::IntegrationTest
def test_courses
assert_routing(
{ :method => 'get', :path => "/courses" },
{ :controller => 'projects', :action => 'index' }
{ :controller => 'courses', :action => 'index' }
)
end
def test_courses_search
assert_routing(
"/courses/search",
{controller: 'courses', action: 'search'}
)
end
def test_courses_item
assert_routing(
'courses/233',
{controller: 'courses', action: 'show', id: '233'}
)
# id eq str
assert_routing(
'courses/timestypo',
{controller: 'courses', action: 'show', id: 'timestypo'}
)
end
def test_course_setting
assert_routing(
'courses/233/settings',
{controller: 'courses', action: 'settings', id: '233'}
)
end
def test_course_homework
assert_routing(
'courses/233/homework',
{controller: 'courses', action: 'homework', id: '233'}
)
assert_routing(
'courses/233/new_homework',
{controller: 'courses', action: 'new_homework', id: '233'}
)
end
def test_course_file
assert_routing(
'courses/233/file',
{controller: 'courses', action: 'file', id: '233'}
)
end
def test_course_feedback
assert_routing(
'courses/233/feedback',
{controller: 'courses', action: 'feedback', id: '233'}
)
end
def test_course_member
assert_routing(
'courses/233/member',
{controller: 'courses', action: 'member', id: '233'}
)
end
def test_course_finish_restart_course
assert_routing(
{path: 'courses/233/finishcourse', method: :post},
{controller: 'courses', action: 'finishcourse', id: '233'}
)
assert_routing(
{path: 'courses/233/restartcourse', method: :post},
{controller: 'courses', action: 'restartcourse', id: '233'}
)
end
end