comparison test/unit/.svn/text-base/project_test.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents 8661b858af72
children 0c939c159af4
comparison
equal deleted inserted replaced
245:051f544170fe 441:cbce1fd3b1b7
1 # redMine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
180 assert_nil Member.first(:conditions => {:project_id => @ecookbook.id}) 180 assert_nil Member.first(:conditions => {:project_id => @ecookbook.id})
181 assert_nil Board.first(:conditions => {:project_id => @ecookbook.id}) 181 assert_nil Board.first(:conditions => {:project_id => @ecookbook.id})
182 assert_nil Issue.first(:conditions => {:project_id => @ecookbook.id}) 182 assert_nil Issue.first(:conditions => {:project_id => @ecookbook.id})
183 end 183 end
184 184
185 def test_destroying_root_projects_should_clear_data
186 Project.roots.each do |root|
187 root.destroy
188 end
189
190 assert_equal 0, Project.count, "Projects were not deleted: #{Project.all.inspect}"
191 assert_equal 0, Member.count, "Members were not deleted: #{Member.all.inspect}"
192 assert_equal 0, MemberRole.count
193 assert_equal 0, Issue.count
194 assert_equal 0, Journal.count
195 assert_equal 0, JournalDetail.count
196 assert_equal 0, Attachment.count
197 assert_equal 0, EnabledModule.count
198 assert_equal 0, IssueCategory.count
199 assert_equal 0, IssueRelation.count
200 assert_equal 0, Board.count
201 assert_equal 0, Message.count
202 assert_equal 0, News.count
203 assert_equal 0, Query.count(:conditions => "project_id IS NOT NULL")
204 assert_equal 0, Repository.count
205 assert_equal 0, Changeset.count
206 assert_equal 0, Change.count
207 assert_equal 0, Comment.count
208 assert_equal 0, TimeEntry.count
209 assert_equal 0, Version.count
210 assert_equal 0, Watcher.count
211 assert_equal 0, Wiki.count
212 assert_equal 0, WikiPage.count
213 assert_equal 0, WikiContent.count
214 assert_equal 0, WikiContent::Version.count
215 assert_equal 0, Project.connection.select_all("SELECT * FROM projects_trackers").size
216 assert_equal 0, Project.connection.select_all("SELECT * FROM custom_fields_projects").size
217 assert_equal 0, CustomValue.count(:conditions => {:customized_type => ['Project', 'Issue', 'TimeEntry', 'Version']})
218 end
219
185 def test_move_an_orphan_project_to_a_root_project 220 def test_move_an_orphan_project_to_a_root_project
186 sub = Project.find(2) 221 sub = Project.find(2)
187 sub.set_parent! @ecookbook 222 sub.set_parent! @ecookbook
188 assert_equal @ecookbook.id, sub.parent.id 223 assert_equal @ecookbook.id, sub.parent.id
189 @ecookbook.reload 224 @ecookbook.reload
551 def test_next_identifier_first_project 586 def test_next_identifier_first_project
552 Project.delete_all 587 Project.delete_all
553 assert_nil Project.next_identifier 588 assert_nil Project.next_identifier
554 end 589 end
555 590
591 def test_enabled_module_names
592 with_settings :default_projects_modules => ['issue_tracking', 'repository'] do
593 project = Project.new
594
595 project.enabled_module_names = %w(issue_tracking news)
596 assert_equal %w(issue_tracking news), project.enabled_module_names.sort
597 end
598 end
556 599
557 def test_enabled_module_names_should_not_recreate_enabled_modules 600 def test_enabled_module_names_should_not_recreate_enabled_modules
558 project = Project.find(1) 601 project = Project.find(1)
559 # Remove one module 602 # Remove one module
560 modules = project.enabled_modules.slice(0..-2) 603 modules = project.enabled_modules.slice(0..-2)