删除project多余导致删除项目失败的关联关系
This commit is contained in:
parent
edee2b2327
commit
8496d6e0d2
|
@ -56,13 +56,12 @@ class Project < ActiveRecord::Base
|
||||||
#added by xianbo for delete biding_project
|
#added by xianbo for delete biding_project
|
||||||
has_many :biding_projects, :dependent => :destroy
|
has_many :biding_projects, :dependent => :destroy
|
||||||
has_many :contesting_projects, :dependent => :destroy
|
has_many :contesting_projects, :dependent => :destroy
|
||||||
has_many :projecting_softapplications, :dependent => :destroy
|
|
||||||
has_many :softapplications, :through => :projecting_softapplications
|
has_many :softapplications, :through => :projecting_softapplications
|
||||||
#ended by xianbo
|
#ended by xianbo
|
||||||
# added by fq
|
# added by fq
|
||||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||||
has_many :homework_for_courses, :dependent => :destroy
|
#has_many :homework_for_courses, :dependent => :destroy
|
||||||
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
#has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||||
has_many :shares, :dependent => :destroy
|
has_many :shares, :dependent => :destroy
|
||||||
# has_many :students_for_courses, :dependent => :destroy
|
# has_many :students_for_courses, :dependent => :destroy
|
||||||
has_many :student, :through => :students_for_courses, :source => :user
|
has_many :student, :through => :students_for_courses, :source => :user
|
||||||
|
|
|
@ -10,6 +10,7 @@ class CoursesControllerTest < ActionController::TestCase
|
||||||
Setting.default_language = 'en'
|
Setting.default_language = 'en'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get :index
|
||||||
def test_index_by_anonymous_should_not_show_private_projects
|
def test_index_by_anonymous_should_not_show_private_projects
|
||||||
get :index
|
get :index
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -19,6 +20,7 @@ class CoursesControllerTest < ActionController::TestCase
|
||||||
assert courses.all?(&:is_public?)
|
assert courses.all?(&:is_public?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get :new
|
||||||
# 人员添加课程的权限是不属于任何角色
|
# 人员添加课程的权限是不属于任何角色
|
||||||
def test_new_course_anyone_temporary
|
def test_new_course_anyone_temporary
|
||||||
@request.session[:user_id] = 5
|
@request.session[:user_id] = 5
|
||||||
|
@ -29,6 +31,7 @@ class CoursesControllerTest < ActionController::TestCase
|
||||||
assert_template :new
|
assert_template :new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# post :create
|
||||||
def test_create_course_with_access_control
|
def test_create_course_with_access_control
|
||||||
@request.session[:user_id] = 5
|
@request.session[:user_id] = 5
|
||||||
Role.find_by_name("Non member").add_permission! :add_course #Non member
|
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"
|
# assert_redirected_to "courses/#{course.id}/settings"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# post :create 403
|
||||||
def test_create_course_without_access_control
|
def test_create_course_without_access_control
|
||||||
@request.session[:user_id] = 5
|
@request.session[:user_id] = 5
|
||||||
#Role.find_by_name("Non member").add_permission! :add_course #Non member
|
#Role.find_by_name("Non member").add_permission! :add_course #Non member
|
||||||
|
|
Loading…
Reference in New Issue