29 lines
768 B
Ruby
29 lines
768 B
Ruby
# encoding: utf-8
|
|
require File.expand_path('../../test_helper', __FILE__)
|
|
|
|
class CourseTest < ActiveSupport::TestCase
|
|
fixtures :courses, :roles, :member_roles, :members, :boards, :messages, :news
|
|
def setup
|
|
end
|
|
|
|
test 'name valid with CJK coding' do
|
|
name_quirk = '电路与电子学基础(软件工程专业)'
|
|
course = Course.find_by_id(74)
|
|
course.name = "test_course"
|
|
assert course.valid?
|
|
course.name = name_quirk
|
|
assert course.valid?
|
|
end
|
|
|
|
test 'description too long must be valid.' do
|
|
course = Course.find_by_id(8)
|
|
course.description = 'a' * 2048 # description length validate.
|
|
course.valid?
|
|
assert course.errors[:name].empty?
|
|
assert course.valid?
|
|
end
|
|
|
|
def teardown
|
|
end
|
|
end
|