File: test_helper.rb

package info (click to toggle)
ruby-enumerize 2.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 432 kB
  • sloc: ruby: 3,712; makefile: 6
file content (57 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# frozen_string_literal: true

require 'minitest/autorun'
require 'minitest/spec'
require 'active_support/core_ext/kernel/reporting'
require 'active_model'
require 'active_job'
require 'rails'
begin
  require 'mongoid'
rescue LoadError
end

module RailsAdmin
end

module EnumerizeTest
  class Application < Rails::Application
    config.active_support.deprecation = :stderr
    config.active_support.test_order = :random
    config.eager_load = false
    config.secret_key_base = 'secret'
  end
end

EnumerizeTest::Application.initialize!

$VERBOSE=true

require 'enumerize'

Dir["#{File.dirname(__FILE__)}/support/*.rb"].each do |file|
  require file
end

module MiscHelpers
  def store_translations(locale, translations, &block)
    begin
      I18n.backend.store_translations locale, translations
      yield
    ensure
      I18n.reload!
    end
  end

  def unsafe_yaml_load(yaml)
    if YAML.respond_to?(:unsafe_load)
      YAML.unsafe_load(yaml)
    else
      YAML.load(yaml)
    end
  end
end

class Minitest::Spec
  include MiscHelpers
end