summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/functional/issues_controller_test.rb3
-rw-r--r--test/functional/issues_custom_fields_visibility_test.rb5
-rw-r--r--test/unit/enumeration_test.rb1
-rw-r--r--test/unit/issue_test.rb4
-rw-r--r--test/unit/project_copy_test.rb2
-rw-r--r--test/unit/project_test.rb16
6 files changed, 17 insertions, 14 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 0e2505eef..a5fb68b59 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -4874,6 +4874,7 @@ class IssuesControllerTest < Redmine::ControllerTest
# 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
@@ -5469,7 +5470,7 @@ class IssuesControllerTest < Redmine::ControllerTest
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')
diff --git a/test/functional/issues_custom_fields_visibility_test.rb b/test/functional/issues_custom_fields_visibility_test.rb
index f23d9a9d4..1ce32bf79 100644
--- a/test/functional/issues_custom_fields_visibility_test.rb
+++ b/test/functional/issues_custom_fields_visibility_test.rb
@@ -32,8 +32,9 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
: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)))
@@ -220,7 +221,9 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
end
def test_index_with_partial_custom_field_visibility
+ CustomValue.delete_all
Issue.delete_all
+
p1 = Project.generate!
p2 = Project.generate!
user = User.generate!
diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb
index 936099784..3efba77b7 100644
--- a/test/unit/enumeration_test.rb
+++ b/test/unit/enumeration_test.rb
@@ -162,6 +162,7 @@ class EnumerationTest < ActiveSupport::TestCase
def test_destroying_override_should_not_update_positions
Enumeration.delete_all
+ Issue.delete_all
a = IssuePriority.create!(:name => 'A')
b = IssuePriority.create!(:name => 'B')
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 40be6b66a..4d2b68663 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -1103,7 +1103,7 @@ class IssueTest < ActiveSupport::TestCase
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))
@@ -1114,7 +1114,7 @@ class IssueTest < ActiveSupport::TestCase
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))
diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb
index 05d5d2e4d..752e51b4c 100644
--- a/test/unit/project_copy_test.rb
+++ b/test/unit/project_copy_test.rb
@@ -149,7 +149,7 @@ class ProjectCopyTest < ActiveSupport::TestCase
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)
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 23fadd2d5..d86c30d13 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -315,15 +315,13 @@ class ProjectTest < ActiveSupport::TestCase
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