Test updates

This commit is contained in:
Netscape Navigator 2020-04-25 09:47:58 -05:00
parent 7edf4db041
commit 2d7c1b2f26
4 changed files with 12 additions and 5 deletions

View File

@ -208,7 +208,12 @@ module Pigeon
end
def self.mkdir_p(path)
FileUtils.makedirs(path) unless Dir.exists?(path)
if Dir.exists?(path)
FileUtils.makedirs(path)
else
end
rescue => x
binding.pry
end
def self.write_to_disk(base_path, mhash, data)

View File

@ -110,8 +110,10 @@ module Pigeon
.flatten
.uniq
.map do |mhash|
blob_path = File.join(file_path, Helpers.hash2file_path(mhash))
Helpers.write_to_disk(blob_path, mhash, get_blob(mhash))
hash2filepath = Helpers.hash2file_path(mhash)
blob_path = File.join(file_path, hash2filepath)
blob = get_blob(mhash)
Helpers.write_to_disk(blob_path, mhash, blob) if blob
end
# Render messages for all peers.

BIN
pigeon.db

Binary file not shown.

View File

@ -47,8 +47,8 @@ RSpec.describe Pigeon::Message do
it "ingests a bundle's blobs" do
db.reset_database
db.add_message(db.add_blob("a.gif"), {
db.add_blob("b.gif") => db.add_blob("c.gif"),
db.add_message(db.add_blob(File.read("a.gif")), {
db.add_blob(File.read("b.gif")) => db.add_blob(File.read("c.gif")),
})
db.export_bundle("./spec/fixtures/has_blobs")
STDERR.puts("The directory structure is not correct.")