Sha256: e497b1e1512dc7df59a3875356d751adefa4f5fde4da2d2fee5235f4eb26ecfd

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'testr/config'
require 'active_support/inflector'

TestR::Config.reabsorb_file_globs.push(
  'config/**/*.{rb,yml}',
  'db/schema.rb',
  'Gemfile.lock'
)

TestR::Config.test_file_matchers[%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

TestR::Config.test_file_matchers[%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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
testr-14.0.2 lib/testr/config/rails.rb
testr-14.0.1 lib/testr/config/rails.rb
testr-14.0.0 lib/testr/config/rails.rb