]> source.dussan.org Git - redmine.git/commitdiff
Test failures with sqlite3.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 23 Sep 2018 11:57:38 +0000 (11:57 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 23 Sep 2018 11:57:38 +0000 (11:57 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@17502 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/issues_controller_test.rb
test/functional/issues_custom_fields_visibility_test.rb
test/unit/enumeration_test.rb
test/unit/issue_test.rb
test/unit/project_copy_test.rb
test/unit/project_test.rb

index 0e2505eef05219f416c302f567b944be3ed572e7..a5fb68b59bd5d1453ae283fbe9f43970cd4d14b0 100644 (file)
@@ -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')
index f23d9a9d4d21babbb8e7f0e0a53b63b22a5d37df..1ce32bf794a3fcbbaefeb6248404c32fdba167b7 100644 (file)
@@ -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!
index 936099784c68560134dbeafa6de6ec32de5664ab..3efba77b748c1126b9aa15482e2cea3ecae34672 100644 (file)
@@ -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')
index 40be6b66a7bddaf98540abbe476daf372466d4a7..4d2b6866336af289b02bf8016236681bee959039 100644 (file)
@@ -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))
index 05d5d2e4d3716bbb65ff35027ee734de94f6760d..752e51b4cd4510d7e6e4e6a7437bbd59c69a178f 100644 (file)
@@ -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)
index 23fadd2d5ebc1337b7355d27722ab944501c104f..d86c30d139e3a4b83dc46afbb5c89b8969874258 100644 (file)
@@ -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