diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index e81355260..c074be37b 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -642,9 +642,9 @@ class UsersController < ApplicationController
return
end
if @obj.save
- ## 执行成功的操作。
+ logger.debug "#{__FILE__}:#{__LINE__} ===> #{@obj.to_json}"
else
- #捕获异常
+ logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}"
end
respond_to do |format|
format.js
diff --git a/app/helpers/stores_helper.rb b/app/helpers/stores_helper.rb
index b4cd47eb1..5a161dc85 100644
--- a/app/helpers/stores_helper.rb
+++ b/app/helpers/stores_helper.rb
@@ -42,7 +42,6 @@ module StoresHelper
container = attachment.container
case container.class.to_s
when 'Message'
- # binding.pry
# '项目 > zzz > 论坛 > 帖子xxx'
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index 5367f9f7c..db51eca1d 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -97,7 +97,6 @@
diff --git a/test/fixtures/courses.yml b/test/fixtures/courses.yml
index c3b7c22a3..0eedd1960 100644
--- a/test/fixtures/courses.yml
+++ b/test/fixtures/courses.yml
@@ -124,3 +124,29 @@ courses_061:
rgt:
is_public: 0
inherit_members: 1
+course_trustie_074:
+ id: 74
+ tea_id: 698
+ name: 电路与电子学基础(软件工程专业)
+ state:
+ code:
+ time: 2014
+ extra: course2014-05-22_16-09-25
+ created_at: 2014-05-22 08:09:25.000000000 Z
+ updated_at: 2014-05-22 08:09:25.000000000 Z
+ location:
+ term: 春季学期
+ string:
+ password: '12345678'
+ setup_time:
+ endup_time:
+ class_period: '54'
+ school_id: 117
+ description: "电路与电子学基础,软件工程小班\\r\ 模拟电子技术部分\ "
+ status: 1
+ attachmenttype: 2
+ lft:
+ rgt:
+ is_public: 1
+ inherit_members: 1
+
diff --git a/test/unit/course_test.rb b/test/unit/course_test.rb
index cc5bb934b..a29501066 100644
--- a/test/unit/course_test.rb
+++ b/test/unit/course_test.rb
@@ -1,68 +1,26 @@
# encoding: utf-8
-# 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 CourseTest < ActiveSupport::TestCase
+ fixtures :courses, :roles, :member_roles, :members, :boards, :messages, :news
def setup
- @course_1 = Course.new
- @course_1.id = 1
- @course_1.tea_id = 1
- @course_1.name = 'course1'
- @course_1.state = 1234
- @course_1.time = 2012
- @course_1.term = '秋季学期'
- @course_1.password = 1234
- @course_1.class_period = 40
-
- @course_2 = Course.new
- @course_2.id = 2
- @course_2.tea_id = 1
- @course_2.name = 'course2'
- @course_2.state = 1234
- @course_2.time = 2013
- @course_2.term = '秋季学期'
- @course_2.password = 1234
- @course_2.class_period = 40
-
- @course_3 = Course.new
- @course_3.id = 3
- @course_3.tea_id = 1
- @course_3.name = 'course3'
- @course_3.state = 1234
- @course_3.time = 2014
- @course_3.term = '秋季学期'
- @course_3.password = 1234
- @course_3.class_period = 40
-
- @course_now = Course.new
- @course_now.id = 4
- @course_now.tea_id = 1
- @course_now.name = 'course4'
- @course_now.state = 1234
- @course_now.time = 2013
- @course_now.term = '秋季学期'
- @course_now.password = 1234
- @course_now.class_period = 40
end
-
- test 'test course whether out of date.' do
- true
+
+ 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?
+ end
+
+ 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?
end
def teardown