@@ -33,7 +33,7 class Project < ActiveRecord::Base | |||||
33 | has_many :documents, :dependent => :destroy |
|
33 | has_many :documents, :dependent => :destroy | |
34 | has_many :news, :dependent => :delete_all, :include => :author |
|
34 | has_many :news, :dependent => :delete_all, :include => :author | |
35 | has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name" |
|
35 | has_many :issue_categories, :dependent => :delete_all, :order => "#{IssueCategory.table_name}.name" | |
36 | has_many :boards, :order => "position ASC" |
|
36 | has_many :boards, :dependent => :destroy, :order => "position ASC" | |
37 | has_one :repository, :dependent => :destroy |
|
37 | has_one :repository, :dependent => :destroy | |
38 | has_many :changesets, :through => :repository |
|
38 | has_many :changesets, :through => :repository | |
39 | has_one :wiki, :dependent => :destroy |
|
39 | has_one :wiki, :dependent => :destroy |
@@ -18,7 +18,7 | |||||
18 | require File.dirname(__FILE__) + '/../test_helper' |
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
19 |
|
19 | |||
20 | class ProjectTest < Test::Unit::TestCase |
|
20 | class ProjectTest < Test::Unit::TestCase | |
21 | fixtures :projects, :issues, :issue_statuses, :journals, :journal_details, :users, :members, :roles, :projects_trackers, :trackers |
|
21 | fixtures :projects, :issues, :issue_statuses, :journals, :journal_details, :users, :members, :roles, :projects_trackers, :trackers, :boards | |
22 |
|
22 | |||
23 | def setup |
|
23 | def setup | |
24 | @ecookbook = Project.find(1) |
|
24 | @ecookbook = Project.find(1) | |
@@ -84,12 +84,15 class ProjectTest < Test::Unit::TestCase | |||||
84 | assert_equal 2, @ecookbook.members.size |
|
84 | assert_equal 2, @ecookbook.members.size | |
85 | # and 1 is locked |
|
85 | # and 1 is locked | |
86 | assert_equal 3, Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).size |
|
86 | assert_equal 3, Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).size | |
|
87 | # some boards | |||
|
88 | assert @ecookbook.boards.any? | |||
87 |
|
89 | |||
88 | @ecookbook.destroy |
|
90 | @ecookbook.destroy | |
89 | # make sure that the project non longer exists |
|
91 | # make sure that the project non longer exists | |
90 | assert_raise(ActiveRecord::RecordNotFound) { Project.find(@ecookbook.id) } |
|
92 | assert_raise(ActiveRecord::RecordNotFound) { Project.find(@ecookbook.id) } | |
91 |
# make sure |
|
93 | # make sure related data was removed | |
92 |
assert |
|
94 | assert Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).empty? | |
|
95 | assert Board.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).empty? | |||
93 | end |
|
96 | end | |
94 |
|
97 | |||
95 | def test_subproject_ok |
|
98 | def test_subproject_ok |
General Comments 0
You need to be logged in to leave comments.
Login now