2014-02-22 09:54:23 +08:00
|
|
|
# encoding: utf-8
|
2014-02-22 09:44:14 +08:00
|
|
|
require File.expand_path('../../test_helper', __FILE__)
|
|
|
|
|
|
|
|
class CourseTest < ActiveSupport::TestCase
|
2014-07-18 11:08:36 +08:00
|
|
|
fixtures :courses, :roles, :member_roles, :members, :boards, :messages, :news
|
2014-02-22 09:44:14 +08:00
|
|
|
def setup
|
2014-07-18 11:08:36 +08:00
|
|
|
end
|
2014-02-22 09:44:14 +08:00
|
|
|
|
2014-07-18 11:08:36 +08:00
|
|
|
test 'name valid with CJK coding' do
|
|
|
|
course = Course.find_by_id(74)
|
|
|
|
name_quirk = '电路与电子学基础(软件工程专业)'
|
|
|
|
course.name = "test_course"
|
|
|
|
assert course.valid?
|
|
|
|
course.name = name_quirk
|
|
|
|
assert course.valid?
|
2014-02-22 09:44:14 +08:00
|
|
|
end
|
2014-07-18 11:08:36 +08:00
|
|
|
|
|
|
|
test 'description too long must be valid.' do
|
|
|
|
course = Course.find_by_id(8)
|
|
|
|
course.description = course.description * 100
|
|
|
|
course.valid?
|
|
|
|
assert_equal course.errors.full_messages.count, 0
|
|
|
|
assert course.valid?
|
2014-02-22 09:44:14 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
|
|
|
end
|
|
|
|
end
|