-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
test_helper.rb
53 lines (44 loc) · 1.47 KB
/
test_helper.rb
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
# frozen_string_literal: true
ENV["RAILS_ENV"] = "test"
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
$:.unshift File.dirname(__FILE__)
puts "\n==> Devise.orm = #{DEVISE_ORM.inspect}"
require "rails_app/config/environment"
require "rails/test_help"
require "orm/#{DEVISE_ORM}"
I18n.load_path.concat Dir["#{File.dirname(__FILE__)}/support/locale/*.yml"]
require 'mocha/minitest'
require 'timecop'
require 'webrat'
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false
end
if ActiveSupport.respond_to?(:test_order)
ActiveSupport.test_order = :random
end
class ActiveSupport::TestCase
if ActiveSupport.version < Gem::Version.new("5.0")
def assert_deprecated(match, deprecator)
super(match) do
# TODO: remove extra begin..end when dropping support for Ruby <= 2.4
begin
behavior = deprecator.behavior
deprecator.behavior = ActiveSupport::Deprecation.behavior
yield
ensure
deprecator.behavior = behavior
end
end
end
end
end
OmniAuth.config.logger = Logger.new('/dev/null')
# Add support to load paths so we can overwrite broken webrat setup
$:.unshift File.expand_path('../support', __FILE__)
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
# For generators
require "rails/generators/test_case"
require "generators/devise/install_generator"
require "generators/devise/views_generator"
require "generators/devise/controllers_generator"