Fixed: Boards are not deleted when project is deleted (closes #963).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1316 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
68fe7856c9
commit
80a5ad7ff3
|
@ -33,7 +33,7 @@ class Project < ActiveRecord::Base
|
||||||
has_many :documents, :dependent => :destroy
|
has_many :documents, :dependent => :destroy
|
||||||
has_many :news, :dependent => :delete_all, :include => :author
|
has_many :news, :dependent => :delete_all, :include => :author
|
||||||
has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name"
|
has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name"
|
||||||
has_many :boards, :order => "position ASC"
|
has_many :boards, :dependent => :destroy, :order => "position ASC"
|
||||||
has_one :repository, :dependent => :destroy
|
has_one :repository, :dependent => :destroy
|
||||||
has_many :changesets, :through => :repository
|
has_many :changesets, :through => :repository
|
||||||
has_one :wiki, :dependent => :destroy
|
has_one :wiki, :dependent => :destroy
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
class ProjectTest < Test::Unit::TestCase
|
class ProjectTest < Test::Unit::TestCase
|
||||||
fixtures :projects, :issues, :issue_statuses, :journals, :journal_details, :users, :members, :roles, :projects_trackers, :trackers
|
fixtures :projects, :issues, :issue_statuses, :journals, :journal_details, :users, :members, :roles, :projects_trackers, :trackers, :boards
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@ecookbook = Project.find(1)
|
@ecookbook = Project.find(1)
|
||||||
|
@ -84,12 +84,15 @@ class ProjectTest < Test::Unit::TestCase
|
||||||
assert_equal 2, @ecookbook.members.size
|
assert_equal 2, @ecookbook.members.size
|
||||||
# and 1 is locked
|
# and 1 is locked
|
||||||
assert_equal 3, Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).size
|
assert_equal 3, Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).size
|
||||||
|
# some boards
|
||||||
|
assert @ecookbook.boards.any?
|
||||||
|
|
||||||
@ecookbook.destroy
|
@ecookbook.destroy
|
||||||
# make sure that the project non longer exists
|
# make sure that the project non longer exists
|
||||||
assert_raise(ActiveRecord::RecordNotFound) { Project.find(@ecookbook.id) }
|
assert_raise(ActiveRecord::RecordNotFound) { Project.find(@ecookbook.id) }
|
||||||
# make sure all members have been removed
|
# make sure related data was removed
|
||||||
assert_equal 0, Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).size
|
assert Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).empty?
|
||||||
|
assert Board.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_subproject_ok
|
def test_subproject_ok
|
||||||
|
|
Loading…
Reference in New Issue