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