Sha256: 7382e93f02df33480ec777a08c73a23f5dfb19c03d2207ad75f2a90756266076

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'tork/config'
require 'active_support/inflector'

Tork::Config.reabsorb_file_greps.push(
  %r<^config/.+\.(rb|yml)$>,
  %r<^db/schema\.rb$>,
  %r<^Gemfile\.lock$>
)

Tork::Config.test_file_globbers[%r<^(app|lib|test|spec)/.+\.rb$>] =
  lambda do |path|
    base = File.basename(path, '.rb')
    poly = ActiveSupport::Inflector.pluralize(base)
    "{test,spec}/**/{#{base},#{poly}_*}_{test,spec}.rb"
  end

Tork::Config.test_file_globbers[%r<^(test|spec)/factories/.+_factory\.rb$>] =
  lambda do |path|
    base = File.basename(path, '_factory.rb')
    poly = ActiveSupport::Inflector.pluralize(base)
    "{test,spec}/**/{#{base},#{poly}_*}_{test,spec}.rb"
  end

Tork::Config.after_fork_hooks << proc do
  unless ActiveRecord::Base.connection_config[:database] == ':memory:'
    ActiveRecord::Base.connection.reconnect!
  end
end

begin
  require 'rails/railtie'
  class Tork::Railtie < Rails::Railtie
    config.before_initialize do |app|
      if app.config.cache_classes
        warn "tork/config/rails: Setting #{app.class}.config.cache_classes = false"
        app.config.cache_classes = false
      end
    end
  end
rescue LoadError
  warn "tork/config/rails: Railtie not available; please manually set:\n\t"\
       "config.cache_classes = false"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tork-15.0.1 lib/tork/config/rails.rb