Skip to content

Commit 1a5879c

Browse files
committed
test: Increase test coverage
1 parent 2bef87e commit 1a5879c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

spec/service/active_storage/service/db_service_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@
141141
expect(download_block).to eq fixture_data
142142
end
143143
end
144+
145+
context "with download a block and when the attachment is not found" do
146+
let(:download_block) do
147+
service.download("#{key}!") do |_data| # rubocop:disable Lint/EmptyBlock
148+
end
149+
end
150+
151+
it { expect { download_block }.to raise_exception(ActiveStorage::FileNotFoundError) }
152+
end
144153
end
145154
end
146155

@@ -154,6 +163,12 @@
154163
after { service.delete(key) }
155164

156165
it { is_expected.to eq fixture_data[range] }
166+
167+
context "when the attachment is not found" do
168+
subject(:download_chunk) { service.download_chunk("#{key}!", range) }
169+
170+
it { expect { download_chunk }.to raise_exception(ActiveStorage::FileNotFoundError) }
171+
end
157172
end
158173

159174
describe '.exist?' do

0 commit comments

Comments
 (0)