Reset file system before each run in storage_spec.rb

This commit is contained in:
Netscape Navigator 2019-12-01 20:45:28 -06:00
parent 7096099b8a
commit 55c02e06df
5 changed files with 7 additions and 6 deletions

BIN
db.pigeon

Binary file not shown.

View File

@ -11,8 +11,8 @@ module Pigeon
desc "new", "Creates a new identiy in `.pigeon` directory if none exists"
def new
if Dir.exist?(Pigeon::Storage::ROOT_DIR)
puts "Pigeon has detected a `.pigeon` directory.
if File.file?(Pigeon::Storage::PIGEON_DB_PATH)
puts "Pigeon has detected a `pigeon.db` file.
Refusing to overwrite existing Pigeon config.
Remove config dir or switch to a different directory."
raise ConfigAlreadyExists

View File

@ -5,7 +5,7 @@
# for quick QA.
echo "Deleting old pigeon configs"
rm -rf .pigeon/
rm -f db.pigeon
echo "OK"
echo "Creating new config:"

View File

@ -2,9 +2,7 @@ require "spec_helper"
RSpec.describe "Kitch sink spec" do
it "does everything" do
$lol = true
kp = Pigeon::KeyPair.new()
$lol = false
kp.save!
Pigeon::KeyPair.current.public_key
# ./pigeon-cli identity new

View File

@ -4,7 +4,10 @@ RSpec.describe Pigeon::Storage do
LOGO_BLOB = File.read("./logo.png")
IDS = %w(@_TlC2z3FT4fimecC4eytrBhOwhLUZsVBZEZriBO9cWs=.ed25519
@28FyT7evjcYrrwngr8G2V1HZ0ODK0VPsFctDEZwfZJc=.ed25519)
let(:s) { Pigeon::Storage.current }
let(:s) do
FileUtils.rm_r(Pigeon::Storage::PIGEON_DB_PATH)
Pigeon::Storage.current
end
it "deletes a config" do
s.set_config("FOO", "BAR")