Skip to content

Commit

Permalink
fix test dependencies on user directory
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Sep 21, 2014
1 parent 9c1db88 commit 5dcbbd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion keyth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.homepage = 'http://rubygems.org/gems/keyth'
s.license = 'MIT'

s.add_development_dependency 'dotenv'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_development_dependency 'dotenv'
end
12 changes: 9 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# encoding: utf-8
require 'fileutils'
require 'tmpdir'
require_relative '../lib/keyth'

TESTING_NAMESPACE = 'rspec_testing_only'

def make_temp_store
Keyth.namespace('rspec_testing_only')
Keyth.namespace(TESTING_NAMESPACE)
@dir = Dir.mktmpdir
ENV['KEYTH_KEYFILE'] = File.join(@dir, TESTING_NAMESPACE + '.yml')
end

def destroy_temp_store
key_file = File.join(Dir.home, '.keyth', 'rspec_testing_only.yml')
File.unlink(key_file) if File.file?(key_file)
File.unlink(ENV['KEYTH_KEYFILE']) if File.file?(ENV['KEYTH_KEYFILE'])
FileUtils.remove_entry_secure @dir
end

0 comments on commit 5dcbbd5

Please sign in to comment.