template/spec/spec_helper.rb in pliny-0.3.0 vs template/spec/spec_helper.rb in pliny-0.4.0
- old
+ new
@@ -8,20 +8,23 @@
ENV["RACK_ENV"] = "test"
require "bundler"
Bundler.require(:default, :test)
-root = File.expand_path("../../", __FILE__)
-ENV.update(Pliny::Utils.parse_env("#{root}/.env.test"))
+require 'dotenv'
+Dotenv.load('.env.test')
require_relative "../lib/initializer"
-DatabaseCleaner.strategy = :transaction
-
# pull in test initializers
Pliny::Utils.require_glob("#{Config.root}/spec/support/**/*.rb")
RSpec.configure do |config|
+ config.before :suite do
+ DatabaseCleaner.clean_with(:truncation)
+ DatabaseCleaner.strategy = :transaction
+ end
+
config.before :all do
load('db/seeds.rb') if File.exist?('db/seeds.rb')
end
config.before :each do