# Delete all fixtured journals, a race condition can occur causing the wrong
# journal to get fetched in the next find.
Journal.delete_all
+ JournalDetail.delete_all
with_settings :notified_events => %w(issue_updated) do
# anonymous user
end
def test_bulk_edit_should_warn_about_custom_field_values_about_to_be_cleared
- CustomField.delete_all
+ CustomField.destroy_all
cleared = IssueCustomField.generate!(:name => 'Cleared', :tracker_ids => [2], :is_for_all => true)
CustomValue.create!(:customized => Issue.find(2), :custom_field => cleared, :value => 'foo')
:workflows
def setup
- CustomField.delete_all
+ CustomField.destroy_all
Issue.delete_all
+
field_attributes = {:field_format => 'string', :is_for_all => true, :is_filter => true, :trackers => Tracker.all}
@fields = []
@fields << (@field1 = IssueCustomField.create!(field_attributes.merge(:name => 'Field 1', :visible => true)))
end
def test_index_with_partial_custom_field_visibility
+ CustomValue.delete_all
Issue.delete_all
+
p1 = Project.generate!
p2 = Project.generate!
user = User.generate!
def test_destroying_override_should_not_update_positions
Enumeration.delete_all
+ Issue.delete_all
a = IssuePriority.create!(:name => 'A')
b = IssuePriority.create!(:name => 'B')
end
def test_required_custom_field_that_is_not_visible_for_the_user_should_not_be_required
- CustomField.delete_all
+ CustomField.destroy_all
field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true)
user = User.generate!
User.add_to_project(user, Project.find(1), Role.find(2))
end
def test_required_custom_field_that_is_visible_for_the_user_should_be_required
- CustomField.delete_all
+ CustomField.destroy_all
field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true)
user = User.generate!
User.add_to_project(user, Project.find(1), Role.find(1))
def test_copy_issues_should_reassign_version_custom_fields_to_copied_versions
User.current = User.find(1)
- CustomField.delete_all
+ CustomField.destroy_all
field = IssueCustomField.generate!(:field_format => 'version', :is_for_all => true, :trackers => Tracker.all)
source_project = Project.generate!(:trackers => Tracker.all)
source_version = Version.generate!(:project => source_project)
end
def test_set_parent_should_add_roots_in_alphabetical_order
- ProjectCustomField.delete_all
- Project.delete_all
- Project.create!(:name => 'Project C', :identifier => 'project-c').set_parent!(nil)
- Project.create!(:name => 'Project B', :identifier => 'project-b').set_parent!(nil)
- Project.create!(:name => 'Project D', :identifier => 'project-d').set_parent!(nil)
- Project.create!(:name => 'Project A', :identifier => 'project-a').set_parent!(nil)
-
- assert_equal 4, Project.count
- assert_equal Project.all.sort_by(&:name), Project.all.sort_by(&:lft)
+ projects = new_records(Project, 4) do
+ Project.create!(:name => 'Project C', :identifier => 'project-c').set_parent!(nil)
+ Project.create!(:name => 'Project B', :identifier => 'project-b').set_parent!(nil)
+ Project.create!(:name => 'Project D', :identifier => 'project-d').set_parent!(nil)
+ Project.create!(:name => 'Project A', :identifier => 'project-a').set_parent!(nil)
+ end
+ assert_equal projects.sort_by(&:name), projects.sort_by(&:lft)
end
def test_set_parent_should_add_children_in_alphabetical_order