Skip to content

Commit

Permalink
Reduce amount of test lifecycles in FileMover spec
Browse files Browse the repository at this point in the history
  • Loading branch information
masaball committed Jan 8, 2025
1 parent da33201 commit 25f83b5
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions spec/services/file_mover_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,25 @@
end

describe 's3 source to s3 dest', s3: true do
it 'copies file from source to dest' do
it 'moves file from source to dest' do
expect(@dest_object).to receive(:copy_from).with(Aws::S3::Object.new(key: 'test.mp4', bucket_name: 'source_bucket'), multipart_copy: false)
described_class.move(s3_file, s3_dest)
end

it 'deletes file after copying' do
expect(@source_object).to receive(:delete)
described_class.move(s3_file, s3_dest)
end
end

describe 's3 source to filesystem dest', s3: true do
it 'copies file from source to dest' do
it 'moves file from source to dest' do
expect(@source_object).to receive(:download_file).with(fs_dest.uri.path)
described_class.move(s3_file, fs_dest)
end

it 'deletes file after copying' do
expect(@source_object).to receive(:delete)
described_class.move(s3_file, fs_dest)
end
end

describe 'filesystem source to s3 dest', s3: true do
it 'copies file from source to dest' do
expect(@dest_object).to receive(:upload_file).with(fs_file.uri.path)
described_class.move(fs_file, s3_dest)
end

it 'deletes file after copying' do
it 'moves file from source to dest' do
allow(@dest_object).to receive(:upload_file).and_return(true)
expect(@dest_object).to receive(:upload_file).with(fs_file.uri.path)
expect(FileUtils).to receive(:rm).with(fs_file.uri.path)
described_class.move(fs_file, s3_dest)
end
Expand Down

0 comments on commit 25f83b5

Please sign in to comment.