IDENTIFIER_MAX_LENGTH = 100
# Specific overridden Activities
- has_many :time_entry_activities
+ has_many :time_entry_activities, :dependent => :destroy
has_many :memberships, :class_name => 'Member', :inverse_of => :project
# Memberships of active users only
has_many :members,
belongs_to :default_version, :class_name => 'Version'
belongs_to :default_assigned_to, :class_name => 'Principal'
has_many :time_entries, :dependent => :destroy
- has_many :queries, :dependent => :delete_all
+ has_many :queries, :dependent => :destroy
has_many :documents, :dependent => :destroy
has_many :news, lambda {includes(:author)}, :dependent => :destroy
has_many :issue_categories, lambda {order(:name)}, :dependent => :delete_all
# some boards
assert @ecookbook.boards.any?
+ # generate some dependent objects
+ overridden_activity = TimeEntryActivity.new({:name => "Project", :project => @ecookbook})
+ assert overridden_activity.save!
+
+ query = IssueQuery.generate!(:project => @ecookbook, :visibility => Query::VISIBILITY_ROLES, :roles => Role.where(:id => [1, 3]).to_a)
+
@ecookbook.destroy
# make sure that the project non longer exists
assert_raise(ActiveRecord::RecordNotFound) {Project.find(@ecookbook.id)}
assert_not Member.where(:project_id => @ecookbook.id).exists?
assert_not Board.where(:project_id => @ecookbook.id).exists?
assert_not Issue.where(:project_id => @ecookbook.id).exists?
+ assert_not Enumeration.where(:project_id => @ecookbook.id).exists?
+
+ assert_not Query.where(:project_id => @ecookbook.id).exists?
+ assert_nil ActiveRecord::Base.connection.select_value("SELECT 1 FROM queries_roles WHERE query_id = #{query.id}")
end
def test_destroy_should_destroy_subtasks