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 1 commit
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.
19 changes: 19 additions & 0 deletions spec/workers/preparsing_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
RSpec.describe Preparsing do
Comment thread
tsujigiri marked this conversation as resolved.
subject(:worker) { described_class.new }

let!(:genotype) do
create(
:genotype,
genotype: Rails.root.join("spec/fixtures/files/broken_genotype_file.gz").open
Comment thread
tsujigiri marked this conversation as resolved.
Outdated
)
end

it "handles errors" do
Comment thread
tsujigiri marked this conversation as resolved.
Outdated
expect { worker.perform(genotype.id) }
.to raise_error(ArgumentError, "invalid byte sequence in UTF-8")
Comment thread
tsujigiri marked this conversation as resolved.
Outdated

expect(ActionMailer::Base.deliveries.count).to eq(1)
expect(ActionMailer::Base.deliveries.last.subject)
.to eq("openSNP.org: Something went wrong while parsing")
Comment thread
tsujigiri marked this conversation as resolved.
Outdated
end
end