print tag exception, course name valid test.
This commit is contained in:
parent
a4d06fbb12
commit
df848ca756
|
@ -642,9 +642,9 @@ class UsersController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if @obj.save
|
if @obj.save
|
||||||
## 执行成功的操作。
|
logger.debug "#{__FILE__}:#{__LINE__} ===> #{@obj.to_json}"
|
||||||
else
|
else
|
||||||
#捕获异常
|
logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}"
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -42,7 +42,6 @@ module StoresHelper
|
||||||
container = attachment.container
|
container = attachment.container
|
||||||
case container.class.to_s
|
case container.class.to_s
|
||||||
when 'Message'
|
when 'Message'
|
||||||
# binding.pry
|
|
||||||
# '项目 > zzz > 论坛 > 帖子xxx'
|
# '项目 > zzz > 论坛 > 帖子xxx'
|
||||||
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
|
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,6 @@
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<ul>
|
<ul>
|
||||||
<%= pagination_links_full @events_pages %>
|
<%= pagination_links_full @events_pages %>
|
||||||
<% #binding.pry %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -124,3 +124,29 @@ courses_061:
|
||||||
rgt:
|
rgt:
|
||||||
is_public: 0
|
is_public: 0
|
||||||
inherit_members: 1
|
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
|
||||||
|
|
||||||
|
|
|
@ -1,68 +1,26 @@
|
||||||
# encoding: utf-8
|
# 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__)
|
require File.expand_path('../../test_helper', __FILE__)
|
||||||
|
|
||||||
class CourseTest < ActiveSupport::TestCase
|
class CourseTest < ActiveSupport::TestCase
|
||||||
|
fixtures :courses, :roles, :member_roles, :members, :boards, :messages, :news
|
||||||
def setup
|
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
|
end
|
||||||
|
|
||||||
test 'test course whether out of date.' do
|
test 'name valid with CJK coding' do
|
||||||
true
|
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
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
|
Loading…
Reference in New Issue