test.course.model
This commit is contained in:
parent
5087f90a26
commit
3f6a298eb4
|
@ -7,8 +7,8 @@ class CourseTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'name valid with CJK coding' do
|
test 'name valid with CJK coding' do
|
||||||
course = Course.find_by_id(74)
|
|
||||||
name_quirk = '电路与电子学基础(软件工程专业)'
|
name_quirk = '电路与电子学基础(软件工程专业)'
|
||||||
|
course = Course.find_by_id(74)
|
||||||
course.name = "test_course"
|
course.name = "test_course"
|
||||||
assert course.valid?
|
assert course.valid?
|
||||||
course.name = name_quirk
|
course.name = name_quirk
|
||||||
|
@ -17,9 +17,9 @@ class CourseTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
test 'description too long must be valid.' do
|
test 'description too long must be valid.' do
|
||||||
course = Course.find_by_id(8)
|
course = Course.find_by_id(8)
|
||||||
course.description = course.description * 100
|
course.description = 'a' * 2048 # description length validate.
|
||||||
course.valid?
|
course.valid?
|
||||||
assert_equal course.errors.full_messages.count, 0
|
assert course.errors[:name].empty?
|
||||||
assert course.valid?
|
assert course.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue