Patch #43130 ยป Fix-random-test-failures-by-calling-Setting.clear_cache-after-all-tests.diff
test/functional/reactions_controller_test.rb | ||
---|---|---|
26 | 26 |
@request.session[:user_id] = users(:users_002).id |
27 | 27 |
end |
28 | 28 | |
29 |
teardown do |
|
30 |
Setting.clear_cache |
|
31 |
end |
|
32 | ||
33 | 29 |
test 'create for issue' do |
34 | 30 |
issue = issues(:issues_002) |
35 | 31 |
test/functional/settings_controller_test.rb | ||
---|---|---|
25 | 25 |
@request.session[:user_id] = 1 # admin |
26 | 26 |
end |
27 | 27 | |
28 |
def teardown |
|
29 |
Setting.delete_all |
|
30 |
Setting.clear_cache |
|
31 |
end |
|
32 | ||
33 | 28 |
def test_index |
34 | 29 |
get :index |
35 | 30 |
assert_response :success |
test/functional/sys_controller_test.rb | ||
---|---|---|
25 | 25 |
Setting.enabled_scm = %w(Subversion Git) |
26 | 26 |
end |
27 | 27 | |
28 |
def teardown |
|
29 |
Setting.clear_cache |
|
30 |
end |
|
31 | ||
32 | 28 |
def test_projects_with_repository_enabled |
33 | 29 |
get :projects |
34 | 30 |
assert_response :success |
test/helpers/reactions_helper_test.rb | ||
---|---|---|
27 | 27 |
Setting.reactions_enabled = '1' |
28 | 28 |
end |
29 | 29 | |
30 |
teardown do |
|
31 |
Setting.clear_cache |
|
32 |
end |
|
33 | ||
34 | 30 |
test 'reaction_id_for generates a DOM id' do |
35 | 31 |
assert_equal "reaction_issue_1", reaction_id_for(issues(:issues_001)) |
36 | 32 |
end |
test/test_helper.rb | ||
---|---|---|
61 | 61 |
self.use_transactional_tests = true |
62 | 62 |
self.use_instantiated_fixtures = false |
63 | 63 | |
64 |
# Clear Settings cache after each test to prevent test interference |
|
65 |
teardown do |
|
66 |
Setting.clear_cache |
|
67 |
end |
|
68 | ||
64 | 69 |
def uploaded_test_file(name, mime) |
65 | 70 |
fixture_file_upload(name.to_s, mime, true) |
66 | 71 |
end |
test/unit/lib/redmine/reaction_test.rb | ||
---|---|---|
26 | 26 |
Setting.reactions_enabled = '1' |
27 | 27 |
end |
28 | 28 | |
29 |
teardown do |
|
30 |
Setting.clear_cache |
|
31 |
end |
|
32 | ||
33 | 29 |
test 'preload_reaction_details preloads ReactionDetail for all objects in the collection' do |
34 | 30 |
User.current = users(:users_002) |
35 | 31 |
test/unit/mail_handler_test.rb | ||
---|---|---|
28 | 28 |
User.current = nil |
29 | 29 |
end |
30 | 30 | |
31 |
def teardown |
|
32 |
Setting.clear_cache |
|
33 |
end |
|
34 | ||
35 | 31 |
def test_add_issue_with_specific_overrides |
36 | 32 |
issue = |
37 | 33 |
submit_email( |
test/unit/setting_test.rb | ||
---|---|---|
24 | 24 |
User.current = nil |
25 | 25 |
end |
26 | 26 | |
27 |
def teardown |
|
28 |
Setting.delete_all |
|
29 |
Setting.clear_cache |
|
30 |
end |
|
31 | ||
32 | 27 |
def test_read_default |
33 |
Setting.delete_all |
|
34 |
Setting.clear_cache |
|
35 | ||
36 | 28 |
assert_equal "Redmine", Setting.app_title |
37 | 29 |
assert Setting.self_registration? |
38 | 30 |
assert !Setting.login_required? |
... | ... | |
127 | 119 |
assert_equal 'UTF-8', Setting.commit_update_keywords.first['keywords'].encoding.name |
128 | 120 |
ensure |
129 | 121 |
Setting.where(:name => 'commit_update_keywords').delete_all |
130 |
Setting.clear_cache |
|
131 | 122 |
end |
132 | 123 | |
133 | 124 |
def test_mail_from_format_should_be_validated |