Created
May 25, 2017 10:51
-
-
Save carlosipe/8bd1fdfa3ead2311944058f350a42caf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env_hash = Hash[File.read("env.sh").scan(/(.*?)="?(.*)"?$/)] | |
ENV["POSTGRESQL_URL"] = env_hash.fetch('DB_TEST') | |
require_relative '../main' | |
module Settings | |
def self.testing? | |
true | |
end | |
end | |
def db_test(title, &block) | |
DB.transaction do | |
test(title, &block) | |
raise Sequel::Rollback | |
end | |
end | |
# Using transactions not only serves to clean the database | |
# It also guarantees isolation between concurrent tests | |
# Note: cutest forks tests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment