Sha256: 526011e08dbe5133e30ed19e3796704379cc771483f8f938f3bf82d53b9a988e
Contents?: true
Size: 969 Bytes
Versions: 29
Compression:
Stored size: 969 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
29 entries across 29 versions & 1 rubygems