move things into SequelHelper that are only used there.

This commit is contained in:
Micah Geisel 2018-05-05 13:03:27 -07:00
parent 4013cba733
commit 469ab03c65
5 changed files with 11 additions and 15 deletions

View file

@ -1,9 +1,6 @@
require 'database_cleaner/sequel/deletion'
require 'database_cleaner/shared_strategy'
require 'sequel'
require 'support/sequel/sequel_setup'
# XXX: use ActiveRecord's db_config (`db/config.yml`) for CI/dev convenience
require 'support/active_record/database_setup'
require 'support/sequel/sequel_helper'
module DatabaseCleaner
module Sequel

View file

@ -1,6 +1,6 @@
require 'database_cleaner/sequel/transaction'
require 'database_cleaner/shared_strategy'
require 'sequel'
require 'support/sequel/sequel_helper'
module DatabaseCleaner
module Sequel

View file

@ -1,9 +1,6 @@
require 'database_cleaner/sequel/truncation'
require 'database_cleaner/shared_strategy'
require 'sequel'
require 'support/sequel/sequel_setup'
# XXX: use ActiveRecord's db_config (`db/config.yml`) for CI/dev convenience
require 'support/active_record/database_setup'
require 'support/sequel/sequel_helper'
module DatabaseCleaner
module Sequel

View file

@ -1,6 +0,0 @@
require 'yaml'
def db_config
config_path = 'db/config.yml'
@db_config ||= YAML.load(IO.read(config_path))
end

View file

@ -1,3 +1,11 @@
require 'sequel'
require 'yaml'
def db_config
config_path = 'db/config.yml'
@db_config ||= YAML.load(IO.read(config_path))
end
class SequelHelper < Struct.new(:config)
def setup
if config[:url] == "postgres:///" || config[:url] == "sqlite:///"