From 8496d6e0d2942fd1c3a6214960b0734e6e57c032 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 22 Jul 2014 09:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4project=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E5=85=B3=E8=81=94=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/project.rb | 5 ++--- test/functional/courses_controller_test.rb | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 35a360ac3..d6283e44f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -56,13 +56,12 @@ class Project < ActiveRecord::Base #added by xianbo for delete biding_project has_many :biding_projects, :dependent => :destroy has_many :contesting_projects, :dependent => :destroy - has_many :projecting_softapplications, :dependent => :destroy has_many :softapplications, :through => :projecting_softapplications #ended by xianbo # added by fq has_many :journals_for_messages, :as => :jour, :dependent => :destroy - has_many :homework_for_courses, :dependent => :destroy - has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy + #has_many :homework_for_courses, :dependent => :destroy + #has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy has_many :shares, :dependent => :destroy # has_many :students_for_courses, :dependent => :destroy has_many :student, :through => :students_for_courses, :source => :user diff --git a/test/functional/courses_controller_test.rb b/test/functional/courses_controller_test.rb index a1551a717..7185f6303 100644 --- a/test/functional/courses_controller_test.rb +++ b/test/functional/courses_controller_test.rb @@ -10,6 +10,7 @@ class CoursesControllerTest < ActionController::TestCase Setting.default_language = 'en' end + # Get :index def test_index_by_anonymous_should_not_show_private_projects get :index assert_response :success @@ -19,6 +20,7 @@ class CoursesControllerTest < ActionController::TestCase assert courses.all?(&:is_public?) end + # Get :new # 人员添加课程的权限是不属于任何角色 def test_new_course_anyone_temporary @request.session[:user_id] = 5 @@ -29,6 +31,7 @@ class CoursesControllerTest < ActionController::TestCase assert_template :new end + # post :create def test_create_course_with_access_control @request.session[:user_id] = 5 Role.find_by_name("Non member").add_permission! :add_course #Non member @@ -54,6 +57,7 @@ class CoursesControllerTest < ActionController::TestCase # assert_redirected_to "courses/#{course.id}/settings" end + # post :create 403 def test_create_course_without_access_control @request.session[:user_id] = 5 #Role.find_by_name("Non member").add_permission! :add_course #Non member