spec/spec_helper.rb in knapsack_pro-3.0.0 vs spec/spec_helper.rb in knapsack_pro-3.1.0
- old
+ new
@@ -14,10 +14,12 @@
require 'knapsack_pro'
Dir["#{KnapsackPro.root}/spec/{support,fixtures}/**/*.rb"].each { |f| require f }
+KNAPSACK_PRO_TMP_DIR = File.join(KnapsackPro.root, '.knapsack_pro')
+
RSpec.configure do |config|
config.order = :random
config.mock_with :rspec do |mocks|
mocks.syntax = :expect
mocks.verify_partial_doubles = true
@@ -27,15 +29,16 @@
c.syntax = :expect
end
config.before(:each) do
if RSpec.current_example.metadata[:clear_tmp]
- FileUtils.mkdir_p(File.join(KnapsackPro.root, 'tmp'))
+ FileUtils.rm_r(KNAPSACK_PRO_TMP_DIR) if File.exist?(KNAPSACK_PRO_TMP_DIR)
+ FileUtils.mkdir_p(KNAPSACK_PRO_TMP_DIR)
end
end
config.after(:each) do
if RSpec.current_example.metadata[:clear_tmp]
- FileUtils.rm_r(File.join(KnapsackPro.root, 'tmp'))
+ FileUtils.rm_r(KNAPSACK_PRO_TMP_DIR) if File.exist?(KNAPSACK_PRO_TMP_DIR)
end
end
end