Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/workers/preparsing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def perform(genotype_id)
file_has_mails = true
end

ensure
# not proper file!
if not file_is_ok
if file_is_duplicate
Expand Down
Binary file added spec/fixtures/files/broken_genotype_file.gz
Binary file not shown.
23 changes: 23 additions & 0 deletions spec/workers/preparsing_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

RSpec.describe Preparsing do
subject(:worker) { described_class.new }

let!(:genotype) do
create(
:genotype,
genotype: Rails.root.join('spec', 'fixtures', 'files', 'broken_genotype_file.gz').open
)
end

context 'when there is an exception' do
it 'still sends emails ' do
expect { worker.perform(genotype.id) }
.to raise_error(ArgumentError, 'invalid byte sequence in UTF-8')

expect(ActionMailer::Base.deliveries.count).to eq(1)
expect(ActionMailer::Base.deliveries.last.subject)
.to eq('openSNP.org: Something went wrong while parsing')
end
end
end