diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index f00cbb03d..0aec29e6a 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -181,7 +181,8 @@ class AttachmentsController < ApplicationController respond_to do |format| # modify by nwb - if !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) &&(@attachment.container.is_a?(Course) || @attachment.container.course) + if !@attachment.container.nil? && + (@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course ) ) if @attachment.container.is_a?(News) format.html { redirect_to_referer_or news_path(@attachment.container) } elsif @course.nil? diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 438dd0aaf..b364440c9 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -85,7 +85,7 @@ class MessagesController < ApplicationController @reply.board = @board @reply.safe_attributes = params[:reply] @topic.children << @reply - @topic.update_attribute(:updated_on, Time.now) + #@topic.update_attribute(:updated_on, Time.now) if !@reply.new_record? call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) attachments = Attachment.attach_files(@reply, params[:attachments]) diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 1808a3eaa..c216a3e93 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -304,6 +304,36 @@ class SoftapplicationsController < ApplicationController end end + def search + @softapplications = Softapplication.where("name like '%#{params[:name]}%'") + + #new added fenyefunction + @limit = 5 + @softapplication_count = @softapplications.count + @softapplication_pages = Paginator.new @softapplication_count, @limit, params['page'] + @offset ||= @softapplication_pages.offset + + #new added sort + if params[:softapplication_sort_type].present? + case params[:softapplication_sort_type] + when '0' + @softapplications = @softapplications[@offset, @limit] + @s_state = 0 + when '1' + @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] + @s_state = 1 + end + else + @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] + @s_state = 1 + end + #new added end + + respond_to do |format| + format.html + end + end + private def find_softapplication @softapplication = Softapplication.find_by_id(params[:id]) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ecc7a8d91..156b6a8c5 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -167,12 +167,6 @@ class Mailer < ActionMailer::Base #缺陷到期邮件通知 def issue_expire issue - #@issues = issues - #s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}") - #puts s + "////" + issue.assigned_to.mail - #@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id) - #mail :to => issue.assigned_to.mail, - # :subject => s issue_id = issue.project_index redmine_headers 'Project' => issue.project.identifier, 'Issue-Id' => issue_id, @@ -183,10 +177,32 @@ class Mailer < ActionMailer::Base @issue = issue @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) recipients = issue.recipients - cc = issue.watcher_recipients - recipients + s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}") mail :to => recipients, - :cc => cc, - :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" + :subject => s + ######################################################################################################### + #@issues = issues + #s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}") + #puts s + "////" + issue.assigned_to.mail + #@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id) + #mail :to => issue.assigned_to.mail, + # :subject => s + ######################################################################################################### + #issue_id = issue.project_index + #redmine_headers 'Project' => issue.project.identifier, + # 'Issue-Id' => issue_id, + # 'Issue-Author' => issue.author.login + #redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to + #message_id issue + #@author = issue.author + #@issue = issue + #@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) + #recipients = issue.recipients + #cc = issue.watcher_recipients - recipients + #mail :to => recipients, + # :cc => cc, + # :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" + ###################################################################################################### end @@ -567,9 +583,10 @@ class Mailer < ActionMailer::Base end #缺陷到期后发送邮件提示 + #只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。 def mail_issue threads = [] - issues = Issue.where("done_ratio <> 100 && closed_on is null && due_date is not null") + issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null and due_date > '#{Time.now.to_date}'") issues.each do |issue| thread = Thread.start do while true @@ -582,7 +599,7 @@ class Mailer < ActionMailer::Base sleep 3600 else #发邮件 - puts issue.id.to_s + #puts issue.id.to_s Mailer.issue_expire(issue).deliver #Mailer.issue_add(issue).deliver break @@ -591,7 +608,6 @@ class Mailer < ActionMailer::Base end threads << thread end - puts threads.count.to_s threads end diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index f8447590c..a1efc32fc 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb @@ -1,6 +1,6 @@

<%=l(:label_administration)%>

- + <%= render :partial => 'menu' %>
diff --git a/app/views/layouts/_base_softapplication_index_top_content.html.erb b/app/views/layouts/_base_softapplication_index_top_content.html.erb index 7fa65bec4..ff897a866 100644 --- a/app/views/layouts/_base_softapplication_index_top_content.html.erb +++ b/app/views/layouts/_base_softapplication_index_top_content.html.erb @@ -1,21 +1,36 @@ + +
- + -
<%=l(:label_contest_innovate_community)%> <%= l(:label_user_location) %> : - +
<%=link_to request.host()+"/softapplications", :controller=>'softapplications', :action=>'index' %><%=link_to l(:field_homepage), home_path %> > - <%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %> + <%=link_to l(:field_homepage), home_path %> > + <%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %>
diff --git a/app/views/softapplications/_list.html.erb b/app/views/softapplications/_list.html.erb new file mode 100644 index 000000000..4f99519b5 --- /dev/null +++ b/app/views/softapplications/_list.html.erb @@ -0,0 +1,24 @@ + + <% @softapplications.each do |softapplication| %> +
+ <%= link_to softapplication.name, softapplication, :target => "_blank" %> + <%= rating_for softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> + +
+
<%= image_tag('/images/app1.png')%>
+
<%= softapplication.description.truncate(95, omission: '...') %>
+
+ <%contest = softapplication.contests.first%> +

<%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

+

<%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(10, omission: '...') %>

+

<%=l(:label_attendingcontestwork_adaptive_system)%>:<%= softapplication.android_min_version_available %>

+
+
+ <%=l(:label_attendingcontestwork_developers)%>:<%= softapplication.application_developers %> + <%=l(:label_attendingcontestwork_release_time)%>:<%=format_time softapplication.created_at %> +
+
+
+ <% end %> + + \ No newline at end of file diff --git a/app/views/softapplications/index.html.erb b/app/views/softapplications/index.html.erb index 5b355f65c..bccbd9bee 100644 --- a/app/views/softapplications/index.html.erb +++ b/app/views/softapplications/index.html.erb @@ -3,37 +3,15 @@ <%=render :partial => 'layouts/base_softapplication_index_top_content'%> <% if @softapplications.size > 0%> - <%= sort_softapplication(@s_state)%> - -
- <% @softapplications.each do |softapplication| %> -
- <%= link_to softapplication.name, softapplication, :target => "_blank" %> - <%= rating_for softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> - -
-
<%= image_tag('/images/app1.png')%>
-
<%= softapplication.description.truncate(95, omission: '...') %>
-
- <%contest = softapplication.contests.first%> -

<%=l(:label_attendingcontestwork_belongs_contest)%>:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

-

<%=l(:label_attendingcontestwork_belongs_type)%>:<%= softapplication.app_type_name.truncate(10, omission: '...') %>

-

<%=l(:label_attendingcontestwork_adaptive_system)%>:<%= softapplication.android_min_version_available %>

-
-
- <%=l(:label_attendingcontestwork_developers)%>:<%= softapplication.application_developers %> - <%=l(:label_attendingcontestwork_release_time)%>:<%=format_time softapplication.created_at %> -
-
-
- <% end %> +
+ <%= sort_softapplication(@s_state)%> + <%= render :partial => "list" %>
- <% else %> <%= render :partial => "layouts/no_content"%> <% end %> - + <% html_title l(:label_contest_work_list)%> \ No newline at end of file diff --git a/app/views/softapplications/search.html.erb b/app/views/softapplications/search.html.erb new file mode 100644 index 000000000..0f0913139 --- /dev/null +++ b/app/views/softapplications/search.html.erb @@ -0,0 +1,11 @@ +<%=render :partial => 'layouts/base_softapplication_index_top_content'%> + +<% if @softapplications.size > 0%> + <%#= sort_softapplication(@s_state)%> +
+ <%= render :partial => "list" %> +
+<% else %> + <%= render :partial => "layouts/no_content"%> +<% end %> +<% html_title l(:label_contest_work_list)%> \ No newline at end of file diff --git a/app/views/softapplications/search.js.erb b/app/views/softapplications/search.js.erb new file mode 100644 index 000000000..8b4b8afb2 --- /dev/null +++ b/app/views/softapplications/search.js.erb @@ -0,0 +1,2 @@ + +$('#softapplications_list').html('<%= escape_javascript(render(:partial => 'list' )) %>'); \ No newline at end of file diff --git a/config/configuration.yml b/config/configuration.yml index a329ff100..833b19083 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -87,12 +87,12 @@ default: - address: smtp.gmail.com + address: smtp.qq.com port: 587 - domain: smtp.gmail.com + domain: smtp.qq.com authentication: :plain - user_name: trustieforge@gmail.com - password: '!@#$%^&*(' + user_name: 939547590@qq.com + password: 'suwen11223344' # Absolute path to the directory where attachments are stored. # The default is the 'files' directory in your Redmine instance. diff --git a/config/initializers/task.rb b/config/initializers/task.rb index f42741864..5b4f35098 100644 --- a/config/initializers/task.rb +++ b/config/initializers/task.rb @@ -1,4 +1,4 @@ -#Mailer.mail_issue.each do |t| -# t.join -#end +Mailer.mail_issue.each do |t| + t.join +end diff --git a/config/routes.rb b/config/routes.rb index 948eee4a5..8d55fe300 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -76,6 +76,7 @@ RedmineApp::Application.routes.draw do collection do match 'new_message', via: :get + match 'search', via: [:get, :post] end member do match 'create_message' , via: :post diff --git a/db/schema.rb b/db/schema.rb index 5199b4c0d..3cbfefa76 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -439,26 +439,6 @@ ActiveRecord::Schema.define(:version => 20140728014933) do t.datetime "updated_at", :null => false end - create_table "gitlab_projects", :force => true do |t| - t.integer "gitlab_project_id" - t.integer "project_id" - t.string "repository_url" - t.string "web_url" - t.string "localfile_url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "gitlab_users", :force => true do |t| - t.integer "gitlab_user_id" - t.integer "user_id" - t.string "email" - t.string "password" - t.string "login", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "groups_users", :id => false, :force => true do |t| t.integer "group_id", :null => false t.integer "user_id", :null => false @@ -901,6 +881,19 @@ ActiveRecord::Schema.define(:version => 20140728014933) do add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + create_table "roles", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.integer "position", :default => 1 diff --git a/test/fixtures/course_infos.yml b/test/fixtures/course_infos.yml index 79b5cfde7..dfd5db89c 100644 --- a/test/fixtures/course_infos.yml +++ b/test/fixtures/course_infos.yml @@ -1,9 +1,15 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html -one: - typeId: 1 - typeName: MyString +courses_001_infos: + id: 1 + course_id: 1 + user_id: 20 + created_at: 2013-09-30 15:36:00 + updated_at: 2014-04-19 01:50:41 +courses_002_infos: + id: 2 + course_id: 2 + user_id: 20 + created_at: 2013-09-30 15:36:00 + updated_at: 2014-04-19 01:50:41 -two: - typeId: 1 - typeName: MyString diff --git a/test/fixtures/course_statuses.yml b/test/fixtures/course_statuses.yml index 8396c1d54..b2aa0f6f5 100644 --- a/test/fixtures/course_statuses.yml +++ b/test/fixtures/course_statuses.yml @@ -1,15 +1,18 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - -one: +courses_001_statuses: changesets_count: 1 watchers_count: 1 course_id: 1 grade: 1.5 course_ac_para: 1 + created_at: 2013-09-30 15:36:00 + updated_at: 2014-04-19 01:50:41 -two: +courses_002_statuses: changesets_count: 1 watchers_count: 1 - course_id: 1 + course_id: 2 grade: 1.5 course_ac_para: 1 + created_at: 2013-09-30 15:36:00 + updated_at: 2014-04-19 01:50:41 diff --git a/test/fixtures/courses.yml b/test/fixtures/courses.yml index 803c14c26..d6cbea59b 100644 --- a/test/fixtures/courses.yml +++ b/test/fixtures/courses.yml @@ -1,23 +1,23 @@ --- -courses_invalid_001: +courses_001: id: 1 - tea_id: - name: '' + tea_id: 20 + name: courses_001 state: code: - time: + time: 2013 extra: - created_at: 2013-09-30 15:36:00.000000000 Z - updated_at: 2014-04-19 01:50:41.000000000 Z + created_at: 2013-09-30 15:36:00 + updated_at: 2014-04-19 01:50:41 location: - term: + term: 春季学期 string: - password: + password: '1234' setup_time: - endup_time: - class_period: - school_id: - description: + endup_time: '2014-04-18 00:00:00' + class_period: '32' + school_id: 117 + description: 'courses_001 description' status: 1 attachmenttype: 2 lft: @@ -25,16 +25,16 @@ courses_invalid_001: is_public: 1 inherit_members: 1 -courses_008: - id: 8 - tea_id: 5 +courses_002: + id: 2 + tea_id: 20 name: 分布式计算环境 state: code: time: 2013 extra: course2013-09-30_23-36-00 - created_at: 2013-09-30 15:36:00.000000000 Z - updated_at: 2014-04-19 01:50:41.000000000 Z + created_at: 2013-09-30 15:36:00 + updated_at: 2014-04-19 01:50:41 location: term: 春季学期 string: @@ -50,129 +50,3 @@ courses_008: rgt: is_public: 1 inherit_members: 1 -courses_058: - id: 58 - tea_id: 1168 - name: 软件工程实践 - state: - code: - time: 2014 - extra: course2014-04-17_17-12-17 - created_at: 2014-04-17 09:12:17.000000000 Z - updated_at: 2014-04-17 09:12:17.000000000 Z - location: - term: 春季学期 - string: - password: SEP2014 - setup_time: - endup_time: - class_period: '18' - school_id: 0 - description: 国防科技大学计算机学院工程硕士专业选修课。 - status: 1 - attachmenttype: 2 - lft: - rgt: - is_public: 1 - inherit_members: 1 -courses_059: - id: 59 - tea_id: 193 - name: 软件项目管理 - state: - code: - time: 2014 - extra: course2014-04-18_18-10-46 - created_at: 2014-04-18 10:10:46.000000000 Z - updated_at: 2014-04-18 10:10:46.000000000 Z - location: - term: 春季学期 - string: - password: software - setup_time: - endup_time: - class_period: '30' - school_id: 0 - description: 面向“软件工程”专业的本科生 - status: 1 - attachmenttype: 2 - lft: - rgt: - is_public: 1 - inherit_members: 1 -courses_060: - id: 60 - tea_id: 1179 - name: android开发 - state: - code: - time: 2014 - extra: course2014-04-19_15-40-39 - created_at: 2014-04-19 07:40:39.000000000 Z - updated_at: 2014-04-19 07:40:39.000000000 Z - location: - term: 春季学期 - string: - password: trustie740208 - setup_time: - endup_time: - class_period: '48' - school_id: 37 - description: '' - status: 1 - attachmenttype: 2 - lft: - rgt: - is_public: 1 - inherit_members: 1 -courses_061: - id: 61 - tea_id: 29 - name: 测试课程1 - state: - code: - time: 2014 - extra: course2014-06-04_14-51-56 - created_at: 2014-06-04 06:51:56.000000000 Z - updated_at: 2014-07-15 01:40:49.000000000 Z - location: - term: 春季学期 - string: - password: '1234' - setup_time: - endup_time: '2014-07-14 00:00:00' - class_period: '23' - school_id: 1579 - description: '233' - status: 1 - attachmenttype: 2 - lft: - 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/fixtures/member_roles.yml b/test/fixtures/member_roles.yml index 79a8a8530..999985395 100644 --- a/test/fixtures/member_roles.yml +++ b/test/fixtures/member_roles.yml @@ -47,8 +47,3 @@ member_roles_011: role_id: 2 member_id: 10 inherited_from: 10 -member_roles_179: - id: 179 - member_id: 126 - role_id: 3 - inherited_from: diff --git a/test/fixtures/members.yml b/test/fixtures/members.yml index 7f918f683..10d52f300 100644 --- a/test/fixtures/members.yml +++ b/test/fixtures/members.yml @@ -60,10 +60,3 @@ members_010: project_id: 2 user_id: 8 mail_notification: false -members_course_001: - id: 126 - user_id: 5 - project_id: -1 - created_on: 2013-09-30 15:36:00.000000000 Z - mail_notification: false - course_id: 8 diff --git a/test/fixtures/schools.yml b/test/fixtures/schools.yml index 953c725bf..fb97019ca 100644 --- a/test/fixtures/schools.yml +++ b/test/fixtures/schools.yml @@ -1,9 +1,13 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html -one: - name: - province: MyString +school_117: + id: 117 + name: 国防科学技术大学 + province: 湖南省 + logo_link: -two: - name: - province: MyString +school_001: + id: 1 + name: 摧毁地球人学校 + province: 火星 + logo_link: diff --git a/test/fixtures/user_extensions.yml b/test/fixtures/user_extensions.yml index 8c19ad7b1..94ee5d0e0 100644 --- a/test/fixtures/user_extensions.yml +++ b/test/fixtures/user_extensions.yml @@ -1,76 +1,57 @@ -person_one_extra: - id: 44 - user_id: 29 - birthday: "2013-09-30 21:19:25" - brief_introduction: nil - gender: 1 - location: "江苏" - occupation: "" - work_experience: nil - zip_code: nil - created_at: "2013-09-30 21:19:25" - updated_at: "2013-10-09 19:00:06" - technical_title: nil - identity: 2 - student_id: nil - teacher_realname: nil - student_realname: nil - location_city: "南京" - -person_mao_extra: - id: 22 - user_id: 193 - birthday: "2013-09-30 21:19:25" - brief_introduction: "期待..." - gender: 0 - location: "湖南长沙" - occupation: "国防科技大学计算机学院" - work_experience: nil - zip_code: nil - created_at: "2013-09-30 21:19:25" - updated_at: "2013-10-09 19:00:06" - technical_title: "教授" - identity: 0 - student_id: nil - teacher_realname: nil - student_realname: nil - location_city: nil -ue_lirongzhen: - id: 587 - user_id: 642 +user_extension_006: + id: 6 + user_id: 6 birthday: brief_introduction: gender: 0 - location: 河南 + location: + occupation: + work_experience: + zip_code: + created_at: 2014-07-29 02:54:09 + updated_at: 2014-07-29 02:54:09 + technical_title: + identity: 0 + student_id: + teacher_realname: + student_realname: + location_city: + school_id: +user_extension_020: + id: 20 + user_id: 20 + birthday: + brief_introduction: 哈尔 + gender: 0 + location: 黑龙江 occupation: kylinos-cloud work_experience: zip_code: - created_at: 2014-03-18 14:52:55.000000000 Z - updated_at: 2014-03-26 07:19:04.000000000 Z - technical_title: - identity: 1 - student_id: '14066023' + created_at: 2014-07-29 02:54:09 + updated_at: 2014-07-29 02:54:09 + technical_title: 助教 + identity: 0 + student_id: teacher_realname: student_realname: - location_city: 周口 + location_city: 哈尔滨 school_id: -ue_yingang: - id: 6 - user_id: 5 +user_extension_025: + id: 25 + user_id: 25 birthday: - brief_introduction: 现有功能的精细化! + brief_introduction: 哈尔 gender: 0 - location: 湖南 - occupation: 国防科学技术大学计算机学院 + location: 黑龙江 + occupation: kylinos-cloud work_experience: zip_code: - created_at: 2013-09-24 09:36:12.000000000 Z - updated_at: 2014-04-19 08:16:55.000000000 Z - technical_title: 副教授 - identity: 0 - student_id: '' + created_at: 2014-07-29 02:54:09 + updated_at: 2014-07-29 02:54:09 + technical_title: 助教 + identity: 1 #student + student_id: 10060342 teacher_realname: - student_realname: - location_city: 长沙 + student_realname: 'ue_realname' + location_city: 哈尔滨 school_id: 117 - diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index cf7f6da7c..48aa9c0da 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -72,7 +72,7 @@ users_003: login: dlopper type: User users_005: - id: 12 + id: 5 created_on: 2006-07-19 19:33:19 +02:00 # Locked status: 3 @@ -165,26 +165,27 @@ groups_011: id: 11 lastname: B Team type: Group -users_yingang_teacher: - id: 5 - login: jacknudt - hashed_password: dbbd96684c9a64afe9c4935ce0b517e5e9c08064 - firstname: 刚 - lastname: 尹 - mail: jack_nudt@163.com +users_020: + id: 20 + login: teacher1 + # password: foobar + hashed_password: 6b6095d977621a3071ae2670be95b88092e94b53 + firstname: wang + lastname: dr + mail: jack_nudt@foo.bar admin: false status: 1 - last_login_on: 2014-04-27 13:49:18.000000000 Z + last_login_on: 2014-07-29 02:54:09 language: zh auth_source_id: - created_on: 2013-06-25 05:20:59.000000000 Z - updated_on: 2014-07-16 03:37:51.000000000 Z + created_on: 2014-07-29 02:54:09 + updated_on: 2014-07-29 02:54:09 type: User identity_url: mail_notification: only_my_events - salt: 92944df2ce4dae1a4f01007263c5d8bb -users_lirongzhen_student: - id: 642 + salt: 9db798ee4c462d9614479e6738790891 +users_025: + id: 25 login: lirongzhen hashed_password: 070922b015398577c3ae0d87a68d5ffa93bf82e9 firstname: 荣振 diff --git a/test/functional/courses_controller_test.rb b/test/functional/courses_controller_test.rb index 7185f6303..b905b5038 100644 --- a/test/functional/courses_controller_test.rb +++ b/test/functional/courses_controller_test.rb @@ -1,7 +1,18 @@ require File.expand_path('../../test_helper', __FILE__) class CoursesControllerTest < ActionController::TestCase - fixtures :courses, :users, :user_extensions, :roles, :members, :member_roles, :enabled_modules, :boards, :messages + fixtures :courses, + :course_infos, + :course_statuses, + :users, + :user_extensions, + :schools, + :roles, + :members, + :member_roles, + :enabled_modules, + :boards, + :messages def setup @request.session[:user_id] = nil @@ -23,7 +34,7 @@ class CoursesControllerTest < ActionController::TestCase # Get :new # 人员添加课程的权限是不属于任何角色 def test_new_course_anyone_temporary - @request.session[:user_id] = 5 + @request.session[:user_id] = 20 Role.find_by_name("Non member").add_permission! :add_course #Non member get :new @@ -33,7 +44,7 @@ class CoursesControllerTest < ActionController::TestCase # post :create def test_create_course_with_access_control - @request.session[:user_id] = 5 + @request.session[:user_id] = 20 Role.find_by_name("Non member").add_permission! :add_course #Non member course_name = 'course_one' @@ -59,7 +70,7 @@ class CoursesControllerTest < ActionController::TestCase # post :create 403 def test_create_course_without_access_control - @request.session[:user_id] = 5 + @request.session[:user_id] = 20 #Role.find_by_name("Non member").add_permission! :add_course #Non member course_name = 'course_one'