FIX: Don't assume a clean slate in tests (#19499)

since plugins can have fixtures
This commit is contained in:
Daniel Waterworth 2022-12-19 12:12:03 -06:00 committed by GitHub
parent d244eb0d7c
commit 97c5e19537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -445,6 +445,7 @@ RSpec.describe Group do
DB.exec("UPDATE groups SET user_count = 0 WHERE id = #{Group::AUTO_GROUPS[:trust_level_2]}") DB.exec("UPDATE groups SET user_count = 0 WHERE id = #{Group::AUTO_GROUPS[:trust_level_2]}")
Group.delete_all
Group.refresh_automatic_groups! Group.refresh_automatic_groups!
groups = Group.includes(:users).to_a groups = Group.includes(:users).to_a
@ -964,6 +965,9 @@ RSpec.describe Group do
end end
it 'should return the right groups' do it 'should return the right groups' do
Group.delete_all
Group.refresh_automatic_groups!
group_name = Fabricate(:group, name: 'tEsT_more_things', full_name: 'Abc something awesome').name group_name = Fabricate(:group, name: 'tEsT_more_things', full_name: 'Abc something awesome').name
expect(search_group_names('te')).to eq([group_name]) expect(search_group_names('te')).to eq([group_name])