FIX: Fixed testsuite

The backup restorer tests weren't cleaning up after themselves and
playing poorly with prefabrication.
This commit is contained in:
Daniel Waterworth 2019-10-23 09:43:00 +01:00
parent f34a0141c7
commit 1a72a61822
1 changed files with 5 additions and 2 deletions

View File

@ -21,7 +21,7 @@ describe BackupRestore::Restorer do
end end
describe 'Decompressing a backup' do describe 'Decompressing a backup' do
fab!(:admin) { Fabricate(:admin) } let!(:admin) { Fabricate(:admin) }
before do before do
SiteSetting.allow_restore = true SiteSetting.allow_restore = true
@ -102,13 +102,16 @@ describe BackupRestore::Restorer do
end end
context 'Database connection' do context 'Database connection' do
fab!(:admin) { Fabricate(:admin) } let!(:admin) { Fabricate(:admin) }
before do before do
SiteSetting.allow_restore = true SiteSetting.allow_restore = true
@restore_path = File.join(Rails.root, 'public', 'backups', RailsMultisite::ConnectionManagement.current_db) @restore_path = File.join(Rails.root, 'public', 'backups', RailsMultisite::ConnectionManagement.current_db)
described_class.any_instance.stubs(ensure_we_have_a_filename: true) described_class.any_instance.stubs(ensure_we_have_a_filename: true)
described_class.any_instance.stubs(initialize_state: true) described_class.any_instance.stubs(initialize_state: true)
end end
after do
conn.establish_connection(db: 'default')
end
let(:conn) { RailsMultisite::ConnectionManagement } let(:conn) { RailsMultisite::ConnectionManagement }
let(:restorer) { described_class.new(admin.id) } let(:restorer) { described_class.new(admin.id) }