Fix flaky tests related to file creation (#28248)

This commit is contained in:
Claire 2023-12-06 23:22:25 +01:00 committed by GitHub
parent af66d3d836
commit 658ad7a6ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -12,7 +12,7 @@ describe PostDeploymentMigrationGenerator, type: :generator do
include FileUtils include FileUtils
tests described_class tests described_class
destination File.expand_path('../../tmp', __dir__) destination Rails.root.join('tmp', 'generator-test')
before { prepare_destination } before { prepare_destination }
after { rm_rf(destination_root) } after { rm_rf(destination_root) }

View file

@ -41,11 +41,17 @@ describe Mastodon::CLI::Emoji do
describe '#export' do describe '#export' do
context 'with existing custom emoji' do context 'with existing custom emoji' do
before { Fabricate(:custom_emoji) } before do
after { File.delete(export_path) } FileUtils.rm_rf(export_path.dirname)
FileUtils.mkdir_p(export_path.dirname)
let(:export_path) { Rails.root.join('tmp', 'export.tar.gz') } Fabricate(:custom_emoji)
let(:args) { [Rails.root.join('tmp')] } end
after { FileUtils.rm_rf(export_path.dirname) }
let(:export_path) { Rails.root.join('tmp', 'cli-tests', 'export.tar.gz') }
let(:args) { [export_path.dirname.to_s] }
let(:action) { :export } let(:action) { :export }
it 'reports about exported emoji' do it 'reports about exported emoji' do