Skip to content

Commit a0687ef

Browse files
committed
Fix sqlite3 adapter fixtures :custom_fields_group_fields delete issue temporarily
1 parent dd6bcaf commit a0687ef

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

test/functional/custom_fields_groups_controller_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ class CustomFieldsGroupsControllerTest < ActionController::TestCase
77
setup do
88
User.current = nil
99
@request.session[:user_id] = 1 # admin
10+
if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
11+
load_plugin_fixtures(true)
12+
end
1013
end
1114

1215
teardown do

test/integration/layout_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class LayoutTest < Redmine::IntegrationTest
1111
setup do
1212
User.current = nil
1313
@user = User.find_by_login('dlopper')
14+
if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
15+
load_plugin_fixtures(true)
16+
end
1417
end
1518

1619
teardown do

test/system/fieldset_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ class FieldsetTest < ApplicationSystemTestCase
88
:watchers, :journals, :journal_details,
99
:custom_fields, :custom_fields_groups, :custom_fields_group_fields
1010

11+
setup do
12+
if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
13+
load_plugin_fixtures(true)
14+
end
15+
end
16+
1117
teardown do
1218
Setting.where(name: 'plugin_redmine_custom_fields_groups').destroy_all
1319
Setting.clear_cache

test/test_helper.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Load the Redmine helper
22
require_relative '../../../test/test_helper'
33

4-
ActiveRecord::FixtureSet.create_fixtures(
5-
File.dirname(__FILE__) + '/fixtures',
6-
['custom_fields_groups', 'custom_fields_group_fields']
7-
)
4+
def load_plugin_fixtures(reset_cache = false)
5+
if reset_cache
6+
ActiveRecord::FixtureSet.reset_cache
7+
end
8+
ActiveRecord::FixtureSet.create_fixtures(
9+
File.dirname(__FILE__) + '/fixtures',
10+
['custom_fields_groups', 'custom_fields_group_fields']
11+
)
12+
end
13+
14+
load_plugin_fixtures

test/unit/custom_fields_group_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
class CustomFieldsGroupTest < ActiveSupport::TestCase
44
fixtures :custom_fields, :custom_fields_groups, :custom_fields_group_fields
55

6+
setup do
7+
if ActiveRecord::Base.connection_db_config.adapter == 'sqlite3'
8+
load_plugin_fixtures(true)
9+
end
10+
end
11+
612
test 'create' do
713
issue_custom_field = IssueCustomField.new(:name => 'test', :field_format => 'text')
814
issue_custom_field.save!

0 commit comments

Comments
 (0)