Sha256: 10718d0a363853fcbe935234ad632421d4fb7739fb6ee3984289bd04fef2f5ad
Contents?: true
Size: 961 Bytes
Versions: 3
Compression:
Stored size: 961 Bytes
Contents
module Ddr::Models RSpec.describe WithContentFile do let(:obj) { FactoryGirl.create(:component) } it "yields a temp file path to the block and deletes the temp file afterwards" do WithContentFile.new(obj) do |path| @path = path expect(File.exist?(path)).to be true end expect(File.exist?(@path)).to be false end it "deletes the temp file even when an exception is raised in the block" do begin WithContentFile.new(obj) do |path| @path = path expect(File.exist?(path)).to be true raise Error, "error" end rescue Error expect(File.exist?(@path)).to be false end end it "raises an exception when the checksum verification fails" do allow(obj.content).to receive(:checksum) { double(value: "foo", algorithm: "SHA1") } expect { WithContentFile.new(obj) { |p| nil } }.to raise_error(ChecksumInvalid) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ddr-models-3.0.0.beta.7 | spec/models/with_content_file_spec.rb |
ddr-models-3.0.0.beta.6 | spec/models/with_content_file_spec.rb |
ddr-models-3.0.0.beta.4 | spec/models/with_content_file_spec.rb |