socialforge/test/integration/routing/courses_test.rb

97 lines
2.6 KiB
Ruby

# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.expand_path('../../../test_helper', __FILE__)
class RoutingProjectsTest < ActionController::IntegrationTest
def test_courses
assert_routing(
{ :method => 'get', :path => "/courses" },
{ :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